From 63c80c4cf725564196b603e3a7c39d439218570f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 1 Jul 2020 15:23:10 +0200 Subject: [PATCH] build-sys: add --enable-werror Add new ./configure option to make all compiler warnings into errors. Addresses: https://github.com/karelzak/util-linux/issues/1083 Signed-off-by: Karel Zak --- configure.ac | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 80da3f4201..543f2cc0ca 100644 --- a/configure.ac +++ b/configure.ac @@ -122,7 +122,6 @@ AC_C_BIGENDIAN dnl Compiler warnings UL_WARN_ADD([-fno-common]) UL_WARN_ADD([-Wall]) -UL_WARN_ADD([-Werror=sequence-point]) UL_WARN_ADD([-Wextra]) UL_WARN_ADD([-Wextra-semi]) UL_WARN_ADD([-Wembedded-directive]) @@ -146,8 +145,20 @@ UL_WARN_ADD([-Wformat-security]) UL_WARN_ADD([-Wimplicit-function-declaration]) UL_WARN_ADD([-Wdiscarded-qualifiers]) UL_WARN_ADD([-Waddress-of-packed-member]) + +AC_ARG_ENABLE([werror], + AS_HELP_STRING([--enable-werror], [make all compiler warnings into errors]), + [], [enable_werror=no] +) +AS_IF([test "x$enable_werror" = xyes], [ + UL_WARN_ADD([-Werror]) +],[ + UL_WARN_ADD([-Werror=sequence-point]) +]) + AC_SUBST([WARN_CFLAGS]) + UL_WARN_ADD([-Wno-clobbered], [BSD_WARN_CFLAGS]) AC_SUBST([BSD_WARN_CFLAGS]) -- 2.47.2