From 4cfe81189a1728be2b360a2e672f56bb44a5023e Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 8 Nov 2018 16:13:32 +0000 Subject: [PATCH] Subscribe to particular warning flags, not to -Wextra. -Wextra now entails -Wcast-function-type, which is incompatible with various Unix APIs like sigaction. --- src/microcode/configure.ac | 39 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac index 895bab4c9..300baf74f 100644 --- a/src/microcode/configure.ac +++ b/src/microcode/configure.ac @@ -212,24 +212,27 @@ if test ${GCC} = yes; then CFLAGS="-Wstrict-prototypes -Wnested-externs -Wredundant-decls ${CFLAGS}" CFLAGS_WERROR=-Werror - AC_MSG_CHECKING([for GCC>=4]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ - #if __GNUC__ >= 4 - ; - #else - #error "gcc too old" - #endif - ]], - [[]] - )], - [ - AC_MSG_RESULT([yes]) - CFLAGS="-Wextra -Wno-sign-compare -Wno-unused-parameter ${CFLAGS}" - CFLAGS="-Wold-style-definition ${CFLAGS}" - ], - [AC_MSG_RESULT([no])]) + for flag in \ + -Wclobbered \ + -Wempty-body \ + -Wignored-qualifiers \ + -Wimplicit-fallthrough \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wold-style-declaration \ + -Woverride-init \ + -Wtype-limits \ + -Wuninitialized \ + -Wshift-negative-value \ + ; do + AC_MSG_CHECKING([for compiler warning $flag]) + SAVED_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $flag" + AC_TRY_COMPILE([],[], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + CFLAGS="$SAVED_CFLAGS"]) + done # other possibilities: # -Wmissing-prototypes -Wunreachable-code -Wwrite-strings -- 2.25.1