844a9ba2a07213fe89d135faef8448a225b618ce
[debian/gzip] / m4 / manywarnings.m4
1 # manywarnings.m4 serial 1
2 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl From Simon Josefsson
8
9 # gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
10 # --------------------------------------------------
11 # Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
12 # Elements separated by whitespace.  In set logic terms, the function
13 # does OUTVAR = LISTVAR \ REMOVEVAR.
14 AC_DEFUN([gl_MANYWARN_COMPLEMENT],
15 [
16   gl_warn_set=
17   set x $2; shift
18   for gl_warn_item
19   do
20     case " $3 " in
21       *" $gl_warn_item "*)
22         ;;
23       *)
24         gl_warn_set="$gl_warn_set $gl_warn_item"
25         ;;
26     esac
27   done
28   $1=$gl_warn_set
29 ])
30
31 # gl_MANYWARN_ALL_GCC(VARIABLE)
32 # -----------------------------
33 # Add all documented GCC (currently as per version 4.4) warning
34 # parameters to variable VARIABLE.  Note that you need to test them
35 # using gl_WARN_ADD if you want to make sure your gcc understands it.
36 AC_DEFUN([gl_MANYWARN_ALL_GCC],
37 [
38  gl_manywarn_set=
39  for gl_manywarn_item in \
40    -Wall \
41    -W \
42    -Wformat-y2k \
43    -Wformat-nonliteral \
44    -Wformat-security \
45    -Winit-self \
46    -Wmissing-include-dirs \
47    -Wswitch-default \
48    -Wswitch-enum \
49    -Wunused \
50    -Wunknown-pragmas \
51    -Wstrict-aliasing \
52    -Wstrict-overflow \
53    -Wsystem-headers \
54    -Wfloat-equal \
55    -Wtraditional \
56    -Wtraditional-conversion \
57    -Wdeclaration-after-statement \
58    -Wundef \
59    -Wshadow \
60    -Wunsafe-loop-optimizations \
61    -Wpointer-arith \
62    -Wbad-function-cast \
63    -Wc++-compat \
64    -Wcast-qual \
65    -Wcast-align \
66    -Wwrite-strings \
67    -Wconversion \
68    -Wsign-conversion \
69    -Wlogical-op \
70    -Waggregate-return \
71    -Wstrict-prototypes \
72    -Wold-style-definition \
73    -Wmissing-prototypes \
74    -Wmissing-declarations \
75    -Wmissing-noreturn \
76    -Wmissing-format-attribute \
77    -Wpacked \
78    -Wpadded \
79    -Wredundant-decls \
80    -Wnested-externs \
81    -Wunreachable-code \
82    -Winline \
83    -Winvalid-pch \
84    -Wlong-long \
85    -Wvla \
86    -Wvolatile-register-var \
87    -Wdisabled-optimization \
88    -Wstack-protector \
89    -Woverlength-strings \
90    -Wbuiltin-macro-redefined \
91    -Wmudflap \
92    -Wpacked-bitfield-compat \
93    -Wsync-nand \
94   ; do
95     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
96   done
97  # The following are not documented in the manual but are included in
98  # output from gcc --help=warnings.
99  for gl_manywarn_item in \
100    -Wattributes \
101    -Wcoverage-mismatch \
102    -Wmultichar \
103    -Wunused-macros \
104   ; do
105     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
106   done
107   $1=$gl_manywarn_set
108 ])