bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Adopt the use of the manywarnings module.


From: James Youngman
Subject: [PATCH] Adopt the use of the manywarnings module.
Date: Wed, 15 Jun 2011 21:42:23 +0100

* import-gnulib.config (modules): Add manywarnings.
* configure.ac: Invoke gl_MANYWARN_ALL_GCC and
gl_MANYWARN_COMPLEMENT.
* configure.ac: Turn on the compiler warnings only if
--enable-compiler-warnings was specified to configure.

Signed-off-by: James Youngman <address@hidden>
---
 ChangeLog            |    9 +++++++++
 configure.ac         |   32 +++++++++++++++++++++++++++++---
 import-gnulib.config |    2 +-
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b1fa969..2d9cd72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-06-15  James Youngman  <address@hidden>
+
+       Adopt the use of the maywarnings module.
+       * import-gnulib.config (modules): Add manywarnings.
+       * configure.ac: Invoke gl_MANYWARN_ALL_GCC and
+       gl_MANYWARN_COMPLEMENT.
+       * configure.ac: Turn on the compiler warnings only if
+       --enable-compiler-warnings was specified to configure.
+
 2011-06-14  James Youngman  <address@hidden>
 
        Avoid pointer/integer comparison on value returned by strchr.
diff --git a/configure.ac b/configure.ac
index 6f7087e..5ed3e91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,9 +89,35 @@ AC_SYS_LARGEFILE
 gl_INIT
 
 dnl Enable various GCC warnings.
-gl_WARN_ADD([-Wdeclaration-after-statement])
-gl_WARN_ADD([-Wall])
-
+gl_MANYWARN_ALL_GCC([warnings])
+# Set up the list of the pointless, undesired warnings.
+nw=
+nw="$nw -Wsystem-headers"       # Don't let system headers trigger warnings
+nw="$nw -Wundef"                # All compiler preprocessors support #if UNDEF
+nw="$nw -Wtraditional"          # All compilers nowadays support ANSI C
+nw="$nw -Wconversion"           # These warnings usually don't point to 
mistakes.
+nw="$nw -Wsign-conversion"      # Likewise.
+nw="$nw -Wc++-compat"           # malloc returns void* and a cast would be 
ugly.
+# Warnings we might enable in the future, but not yet (because they generate a
+# lot of noise).
+marginal=""
+marginal="$marginal -Wtraditional-conversion"
+marginal="$marginal -Wpadded"
+marginal="$marginal -Wformat-nonliteral"
+marginal="$marginal -Wunreachable-code"
+marginal="$marginal -Wunused-parameter"
+excluded_warnings="$nw $marginal"
+
+# Enable all GCC warnings not in this list.
+gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$excluded_warnings])
+
+AC_ARG_ENABLE(compiler-warnings,
+  AS_HELP_STRING(--enable-compiler-warnings,Enable many compiler warnings),
+  for w in $warnings
+  do
+    gl_WARN_ADD([$w])
+  done
+)
 
 dnl Older versions of gl/m4/nls.m4 provide AM_MKINSTALLDIRS.
 dnl The current version of gnulib does not, but the version of
diff --git a/import-gnulib.config b/import-gnulib.config
index 567d66c..7419906 100644
--- a/import-gnulib.config
+++ b/import-gnulib.config
@@ -28,7 +28,6 @@ update-copyright
 # consider using gnu-web-doc-update
 # consider using idprov-drop and privset for locate
 # consider using long-options
-# consider using manywarnings
 # consider using nproc in xargs
 # consider using pmccabe2html
 # consider using selinux-h
@@ -95,6 +94,7 @@ isblank
 locale
 lstat
 malloc
+manywarnings
 math
 mbrtowc
 mbscasestr
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]