warnings: Split off some code to new module manywarnings.
authorSimon Josefsson <simon@josefsson.org>
Tue, 18 Nov 2008 12:50:32 +0000 (13:50 +0100)
committerSimon Josefsson <simon@josefsson.org>
Tue, 18 Nov 2008 12:50:32 +0000 (13:50 +0100)
ChangeLog
MODULES.html.sh
m4/manywarnings.m4 [new file with mode: 0644]
m4/warnings.m4
modules/manywarnings [new file with mode: 0644]

index ba2d3d8..00df019 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-11-18  Simon Josefsson  <simon@josefsson.org>
+
+       * m4/manywarnings.m4: New file with gl_MANYWARN_COMPLEMENT and
+       gl_MANYWARN_ALL_GCC.
+       * m4/warnings.m4: Removed gl_WARN_SUPPORTED and
+       gl_WARN_COMPLEMENT.  Suggested by Bruno Haible <bruno@clisp.org>.
+       * modules/manywarnings: New file.
+       * MODULES.html.sh: Mention manywarnings module.
+
 2008-11-18  Bruno Haible  <bruno@clisp.org>
 
        * doc/gnulib-tool.texi (Unit tests): New section.
index d3e5c13..b07229d 100755 (executable)
@@ -2973,6 +2973,7 @@ func_all_modules ()
   func_module relocatable-prog-wrapper
   func_module relocatable-script
   func_module warnings
+  func_module manywarnings
   func_end_table
 
   element="Support for building documentation"
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
new file mode 100644 (file)
index 0000000..5eb5a66
--- /dev/null
@@ -0,0 +1,94 @@
+# manywarnings.m4 serial 1
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
+# --------------------------------------------------
+# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
+# Elements separated by whitespace.  In set logic terms, the function
+# does OUTVAR = LISTVAR \ REMOVEVAR.
+AC_DEFUN([gl_COMPLEMENT],
+[
+  gl_warn_set=
+  set x $2; shift
+  for gl_warn_item
+  do
+    case " $3 " in
+      *" $gl_warn_item "*)
+        ;;
+      *)
+        gl_warn_set="$gl_warn_set $gl_warn_item"
+        ;;
+    esac
+  done
+  $1=$gl_warn_set
+])
+
+# gl_MANYWARN_ALL_GCC(VARIABLE)
+# -----------------------------
+# Add all documented GCC (currently as per version 4.3.2) warning
+# parameters to variable VARIABLE.  Note that you need to test them
+# using gl_WARN_ADD if you want to make sure your gcc understands it.
+AC_DEFUN([gl_MANYWARN_ALL_GCC],
+[
+ gl_manywarn_set=
+ for gl_manywarn_item in \
+   -Wall \
+   -W \
+   -Wformat-y2k \
+   -Wformat-nonliteral \
+   -Wformat-security \
+   -Winit-self \
+   -Wmissing-include-dirs \
+   -Wswitch-default \
+   -Wswitch-enum \
+   -Wunused \
+   -Wunknown-pragmas \
+   -Wstrict-aliasing \
+   -Wstrict-overflow \
+   -Wsystem-headers \
+   -Wfloat-equal \
+   -Wtraditional \
+   -Wtraditional-conversion \
+   -Wdeclaration-after-statement \
+   -Wundef \
+   -Wshadow \
+   -Wunsafe-loop-optimizations \
+   -Wpointer-arith \
+   -Wbad-function-cast \
+   -Wc++-compat \
+   -Wcast-qual \
+   -Wcast-align \
+   -Wwrite-strings \
+   -Wconversion \
+   -Wsign-conversion \
+   -Wlogical-op \
+   -Waggregate-return \
+   -Wstrict-prototypes \
+   -Wold-style-definition \
+   -Wmissing-prototypes \
+   -Wmissing-declarations \
+   -Wmissing-noreturn \
+   -Wmissing-format-attribute \
+   -Wpacked \
+   -Wpadded \
+   -Wredundant-decls \
+   -Wnested-externs \
+   -Wunreachable-code \
+   -Winline \
+   -Winvalid-pch \
+   -Wlong-long \
+   -Wvla \
+   -Wvolatile-register-var \
+   -Wdisabled-optimization \
+   -Wstack-protector \
+   -Woverlength-strings \
+  ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+  $1=$gl_manywarn_set
+])
index 3585c3e..c32cf4e 100644 (file)
@@ -1,4 +1,4 @@
-# warnings.m4 serial 1
+# warnings.m4 serial 2
 dnl Copyright (C) 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -42,89 +42,3 @@ AS_VAR_POPDEF([gl_Flags])dnl
 AS_VAR_POPDEF([gl_Warn])dnl
 m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
 ])
-
-# gl_WARN_SUPPORTED(VARIABLE)
-# ----------------------
-# Add all supported warning parameters to variable VARIABLE.
-AC_DEFUN([gl_WARN_SUPPORTED],
-[
- FOO=
- # List of all supported warning parameters according to GCC 4.3.2 manual.
- for w in \
-   -Wall \
-   -W \
-   -Wformat-y2k \
-   -Wformat-nonliteral \
-   -Wformat-security \
-   -Winit-self \
-   -Wmissing-include-dirs \
-   -Wswitch-default \
-   -Wswitch-enum \
-   -Wunused \
-   -Wunknown-pragmas \
-   -Wstrict-aliasing \
-   -Wstrict-overflow \
-   -Wsystem-headers \
-   -Wfloat-equal \
-   -Wtraditional \
-   -Wtraditional-conversion \
-   -Wdeclaration-after-statement \
-   -Wundef \
-   -Wshadow \
-   -Wunsafe-loop-optimizations \
-   -Wpointer-arith \
-   -Wbad-function-cast \
-   -Wc++-compat \
-   -Wcast-qual \
-   -Wcast-align \
-   -Wwrite-strings \
-   -Wconversion \
-   -Wsign-conversion \
-   -Wlogical-op \
-   -Waggregate-return \
-   -Wstrict-prototypes \
-   -Wold-style-definition \
-   -Wmissing-prototypes \
-   -Wmissing-declarations \
-   -Wmissing-noreturn \
-   -Wmissing-format-attribute \
-   -Wpacked \
-   -Wpadded \
-   -Wredundant-decls \
-   -Wnested-externs \
-   -Wunreachable-code \
-   -Winline \
-   -Winvalid-pch \
-   -Wlong-long \
-   -Wvla \
-   -Wvolatile-register-var \
-   -Wdisabled-optimization \
-   -Wstack-protector \
-   -Woverlength-strings \
-  ; do
-    FOO="$FOO $w"
-  done
-  $1=$FOO
-])
-
-# gl_WARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
-# ----------------------
-# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
-# Elements separated by whitespace.  In set logic terms, the function
-# does OUTVAR = LISTVAR \ REMOVEVAR.
-AC_DEFUN([gl_WARN_COMPLEMENT],
-[
-  gl_warn_set=
-  set x $2; shift
-  for gl_warn_item
-  do
-    case " $3 " in
-      *" $gl_warn_item "*)
-        ;;
-      *)
-        gl_warn_set="$gl_warn_set $gl_warn_item"
-        ;;
-    esac
-  done
-  $1=$gl_warn_set
-])
diff --git a/modules/manywarnings b/modules/manywarnings
new file mode 100644 (file)
index 0000000..fae9221
--- /dev/null
@@ -0,0 +1,15 @@
+Description:
+Helper M4 functions to help work out a set of warning parameters to use.
+
+Files:
+m4/manywarnings.m4
+
+Depends-on:
+
+configure.ac:
+
+License:
+unlimited
+
+Maintainer:
+Simon Josefsson