From c00c93e702be0b4ce7d24a66819c9702ff6e4af8 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Tue, 18 Nov 2008 13:50:32 +0100 Subject: [PATCH] warnings: Split off some code to new module manywarnings. --- ChangeLog | 9 +++++ MODULES.html.sh | 1 + m4/manywarnings.m4 | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++ m4/warnings.m4 | 88 +----------------------------------------------- modules/manywarnings | 15 +++++++++ 5 files changed, 120 insertions(+), 87 deletions(-) create mode 100644 m4/manywarnings.m4 create mode 100644 modules/manywarnings diff --git a/ChangeLog b/ChangeLog index ba2d3d8c5..00df01988 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-18 Simon Josefsson + + * 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 . + * modules/manywarnings: New file. + * MODULES.html.sh: Mention manywarnings module. + 2008-11-18 Bruno Haible * doc/gnulib-tool.texi (Unit tests): New section. diff --git a/MODULES.html.sh b/MODULES.html.sh index d3e5c1398..b07229ded 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -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 index 000000000..5eb5a66b2 --- /dev/null +++ b/m4/manywarnings.m4 @@ -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 +]) diff --git a/m4/warnings.m4 b/m4/warnings.m4 index 3585c3eeb..c32cf4ed6 100644 --- a/m4/warnings.m4 +++ b/m4/warnings.m4 @@ -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 index 000000000..fae922119 --- /dev/null +++ b/modules/manywarnings @@ -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 -- 2.11.0