]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: modernize GCC warning configuration
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 9 May 2025 22:55:47 +0000 (15:55 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 9 May 2025 22:57:13 +0000 (15:57 -0700)
* configure.ac: Simplify the setup of GCC’s -W... options,
by removing options no longer needed for GCC 15 (when
configuring with --enable-gcc-warnings) or GCC 12 (without).
I hope this is good enough nowadays.
Add GCC 15’s -Wtrailing-whitespace, since that works for us.

configure.ac

index 775c4cc7feaf51a22af2b200a3b4d636a492802e..9c8721f885b178b6d5edefb7934300ca6f243725 100644 (file)
@@ -190,30 +190,10 @@ if test $gl_gcc_warnings != no; then
 
   # This, $nw, is the list of warnings we disable.
   nw=$ew
-  nw="$nw -Wdeclaration-after-statement" # too useful to forbid
-  nw="$nw -Waggregate-return"       # anachronistic
-  nw="$nw -Wlong-long"              # C90 is anachronistic (lib/gethrxtime.h)
-  nw="$nw -Wc++-compat"             # We don't care about C++ compilers
-  nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
-  nw="$nw -Wtraditional"            # Warns on #elif which we use often
-  nw="$nw -Wcast-qual"              # Too many warnings for now
-  nw="$nw -Wconversion"             # Too many warnings for now
-  nw="$nw -Wsign-conversion"        # Too many warnings for now
-  nw="$nw -Wtraditional-conversion" # Too many warnings for now
-  nw="$nw -Wunreachable-code"       # Too many warnings for now
-  nw="$nw -Wpadded"                 # Our structs are not padded
-  nw="$nw -Wredundant-decls"        # openat.h declares e.g., mkdirat
-  nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
-  nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
-  nw="$nw -Wstack-protector"        # not worth working around
+  nw="$nw -Wstack-protector"        # not worth working around for pre GCC 15
   nw="$nw -Wformat-overflow=2"      # False alarms due to GCC bug 110333
   nw="$nw -Wformat-truncation=2"    # False alarm in ls.c, probably related
-  # things I might fix soon:
-  nw="$nw -Wfloat-equal"            # sort.c, seq.c
-  nw="$nw -Wmissing-format-attribute" # copy.c
-  nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
   nw="$nw -Winline"                 # system.h's readdir_ignoring_dot_and_dotdot
-  nw="$nw -Wvector-operation-performance" # warns about randperm.c
 
   # Suppress noreturn warnings with single binaries; otherwise
   # GCC complains about the renamed 'main' not being declared noreturn
@@ -229,17 +209,14 @@ if test $gl_gcc_warnings != no; then
 
   gl_MANYWARN_ALL_GCC([ws])
   AS_VAR_APPEND([ws], [' -Wswitch-enum'])
+  AS_VAR_APPEND([ws], [' -Wtrailing-whitespace'])
   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
   for w in $ws; do
     gl_WARN_ADD([$w])
   done
   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
-  gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
   gl_WARN_ADD([-Wno-format-nonliteral])
 
-  gl_WARN_ADD([-fdiagnostics-show-option])
-  gl_WARN_ADD([-funit-at-a-time])
-
   AC_SUBST([WARN_CFLAGS])
 
   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
@@ -257,34 +234,15 @@ if test $gl_gcc_warnings != no; then
   nw=$ew
   nw="$nw -Wduplicated-branches"    # Too many false alarms
   nw="$nw -Wformat-truncation=2"
-  nw="$nw -Wmissing-variable-declarations"
-  nw="$nw -Wstrict-overflow"
-  nw="$nw -Wuninitialized"
   nw="$nw -Wunused-macros"
-  nw="$nw -Wmissing-prototypes"
-  nw="$nw -Wold-style-definition"
-  # FIXME: it may be easy to remove this, since it affects only one file:
-  # the snprintf call at ftoastr.c:132.
-  nw="$nw -Wdouble-promotion"
-
-  # FIXME: remove this line when gcc improves
-  # FP in careadlinkat.c w/gcc 10.0.1 20200205
-  gl_WARN_ADD([-Wno-return-local-addr])
-
-  # FIXME: remove this line when gcc improves
-  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
-  gl_WARN_ADD([-Wno-stringop-overflow])
 
   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
   AC_SUBST([GNULIB_WARN_CFLAGS])
 
   # For gnulib-tests, the set is slightly smaller still.
   nw=
-  nw="$nw -Wstrict-prototypes"
   # It's not worth being this picky about test programs.
-  nw="$nw -Wsuggest-attribute=cold"
-  nw="$nw -Wsuggest-attribute=const"
-  nw="$nw -Wsuggest-attribute=format"
+  nw="$nw -Wmissing-variable-declarations"
   nw="$nw -Wsuggest-attribute=pure"
   gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
                          [$GNULIB_WARN_CFLAGS], [$nw])