]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: update GCC warnings
authorPádraig Brady <P@draigBrady.com>
Tue, 10 Jun 2014 23:39:45 +0000 (00:39 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 10 Jun 2014 23:49:38 +0000 (00:49 +0100)
* configure.ac: Remove the -Wsuggest-attribute=pure
enablement on GCC >= 4.7, as that was moot since
gnulib was already enabling that warning in its default set.
The false positive was seen with 4.6.2, but confirmed
not present in 4.6.3, so that's sufficiently old to
just leave this enabled unconditionally.

Remove the -Wsuggest-attribute={const,noreturn}
enablement, as gnulib already has those in the default set.

Enable the -Wlogical-op warning for GCC >= 4.8.0
as that is confirmed OK with coreutils at least, due to
fixing: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772

Remove the -Wno-logical-op override since the main
-Wlogical-op flag is now sufficient to control this warning
as of GCC 4.6.3 at least.

configure.ac

index 7c210d91f3ac3082d930c0e1c42f5f6a3bcf6b9a..01098cf34d30334eb93cbcd9bf21a692b435e474 100644 (file)
@@ -125,7 +125,7 @@ if test "$gl_gcc_warnings" = yes; then
   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 -Wlogical-op"             # any use of fwrite provokes this
+  nw="$nw -Wlogical-op"             # Too many warnings until GCC 4.8.0
   nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
   nw="$nw -Wvla"                    # warnings in gettext.h
   nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
@@ -151,20 +151,12 @@ if test "$gl_gcc_warnings" = yes; then
   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([-Wsuggest-attribute=const])
-  gl_WARN_ADD([-Wsuggest-attribute=noreturn])
   gl_WARN_ADD([-Wno-format-nonliteral])
 
-  # Enable this warning only with gcc-4.7 and newer.  With 4.6.2 20111027,
-  # it suggests test.c's advance function may be pure, even though it
-  # increments a global variable.  Oops.
-  # Normally we'd write code to test for the precise failure, but that
-  # requires a relatively large input to make gcc exhibit the failure.
-  gl_GCC_VERSION_IFELSE([4], [7], [gl_WARN_ADD([-Wsuggest-attribute=pure])])
-
-  # In spite of excluding -Wlogical-op above, it is enabled, as of
-  # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
-  gl_WARN_ADD([-Wno-logical-op])
+  # Enable this warning only with gcc-4.8 and newer.  Before that
+  # bounds checking as done in truncate.c was incorrectly flagged.
+  # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
+  gl_GCC_VERSION_IFELSE([4], [8], [gl_WARN_ADD([-Wlogical-op])])
 
   # clang is unduly picky about some things.
   AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],