From 0a312d34b98940f6543b4ae07077d1d59d0afe5b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 27 Aug 2020 20:39:41 -0400 Subject: configure: use additive warnings instead of subtracting from -Wall -Wall varies too much by compiler and version. rather than trying to track all the unwanted style warnings that need to be subtracted, just enable wanted warnings. also, move -Wno-pointer-to-int-cast outside --enable-warnings conditional so that it always applies, since it's turning off a nuisance warning that's on-by-default with most compilers. --- configure | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 5b63e9b1..9fc74a9b 100755 --- a/configure +++ b/configure @@ -508,10 +508,13 @@ fi # # GCC defines -w as overriding any -W options, regardless of order, but # clang has a bunch of annoying warnings enabled by default and needs -w -# to start from a clean slate. So use -w if building with clang. +# to start from a clean slate. So use -w if building with clang. Also +# turn off a common on-by-default cast warning regardless of compiler. # test "$cc_family" = clang && tryflag CFLAGS_AUTO -w +tryflag CFLAGS_AUTO -Wno-pointer-to-int-cast + # # Even with -std=c99, gcc accepts some constructs which are constraint # violations. We want to treat these as errors regardless of whether @@ -535,14 +538,17 @@ tryflag CFLAGS_AUTO -Werror=discarded-array-qualifiers test "$cc_family" = clang && tryflag CFLAGS_AUTO -Qunused-arguments if test "x$warnings" = xyes ; then -tryflag CFLAGS_AUTO -Wall -tryflag CFLAGS_AUTO -Wno-parentheses -tryflag CFLAGS_AUTO -Wno-uninitialized -tryflag CFLAGS_AUTO -Wno-missing-braces -tryflag CFLAGS_AUTO -Wno-unused-value -tryflag CFLAGS_AUTO -Wno-unused-but-set-variable -tryflag CFLAGS_AUTO -Wno-unknown-pragmas -tryflag CFLAGS_AUTO -Wno-pointer-to-int-cast +tryflag CFLAGS_AUTO -Waddress +tryflag CFLAGS_AUTO -Warray-bounds +tryflag CFLAGS_AUTO -Wchar-subscripts +tryflag CFLAGS_AUTO -Wduplicate-decl-specifier +tryflag CFLAGS_AUTO -Winit-self +tryflag CFLAGS_AUTO -Wreturn-type +tryflag CFLAGS_AUTO -Wsequence-point +tryflag CFLAGS_AUTO -Wstrict-aliasing +tryflag CFLAGS_AUTO -Wunused-function +tryflag CFLAGS_AUTO -Wunused-label +tryflag CFLAGS_AUTO -Wunused-variable fi # Determine if the compiler produces position-independent code (PIC) -- cgit v1.2.1