On Fri, Apr 18, 2014 at 11:22 PM, Paul Eggert <[email protected]> wrote:
> Norihiro Tanaka wrote:
>>
>> Perhaps, I may run accross it in order to use old GCC (4.1.2 on CentOS
>> 5.10).
>
>
> Thanks, it's lucky you did, so that we won't be inundated by other people
> reporting similar problems.  I see now that we were passing
> -Wno-pointer-sign to GCC, and that this suppressed useful diagnostics on
> newer GCC instances (but not on your older one).  I installed the attached
> patch to fix both the signedness problem, and the diagnostic-suppression
> problem.

This has encouraged me to revisit grep's list of disabled gcc warnings.
It turns out that we've been disabling many unnecessarily.
The attached patch reenables those that do not elicit a warning
from gcc-4.9.
From d65dcf39f3d587027cccb6c7de6d7d70fb336e56 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Sat, 19 Apr 2014 08:23:14 -0700
Subject: [PATCH] build: reenable some compiler warning options

---
 configure.ac | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index 17a8920..6a99c40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,29 +114,12 @@ if test "$gl_gcc_warnings" = yes; then
   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 -Wsystem-headers"         # Don't let system headers trigger warnings
-  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 -Wlogical-op"             # any use of fwrite provokes this
-  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__
-  nw="$nw -Wswitch-enum"            # Too many warnings for now
   nw="$nw -Wswitch-default"         # Too many warnings for now
-  nw="$nw -Wstack-protector"        # not worth working around
-  # 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 -Wstrict-overflow"        # expr.c, pr.c, tr.c, factor.c
-  # ?? -Wstrict-overflow
+  nw="$nw -Winline"                 # streq.h's streq4, streq6 and strcaseeq6
+  nw="$nw -Wstrict-overflow"        # regexec.c

   gl_MANYWARN_ALL_GCC([ws])
   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
@@ -166,12 +149,7 @@ if test "$gl_gcc_warnings" = yes; then
   # We use a slightly smaller set of warning options for lib/.
   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
   nw=
-  #nw="$nw -Wuninitialized"
   nw="$nw -Wunused-macros"
-  #nw="$nw -Wmissing-prototypes"
-  nw="$nw -Wold-style-definition"
-  nw="$nw -Wcast-align"
-  nw="$nw -Wunsuffixed-float-constants"
   gl_WARN_ADD([-Wno-format-nonliteral])
   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
   AC_SUBST([GNULIB_WARN_CFLAGS])
-- 
1.9.2.459.g68773ac

Reply via email to