~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to m4/manywarnings.m4

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-07-30 13:16:15 UTC
  • mfrom: (7.2.34 sid)
  • Revision ID: package-import@ubuntu.com-20140730131615-6uy87mosal6722s6
Tags: 3.2-1
* New upstream release.
* Drop currently-unused build-dependency on po4a (thanks, Johannes
  Schauer).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# manywarnings.m4 serial 3
2
 
dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
1
# manywarnings.m4 serial 6
 
2
dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
35
35
# make sure your gcc understands it.
36
36
AC_DEFUN([gl_MANYWARN_ALL_GCC],
37
37
[
38
 
  dnl First, check if -Wno-missing-field-initializers is needed.
39
 
  dnl -Wmissing-field-initializers is implied by -W, but that issues
40
 
  dnl warnings with GCC version before 4.7, for the common idiom
41
 
  dnl of initializing types on the stack to zero, using { 0, }
 
38
  dnl First, check for some issues that only occur when combining multiple
 
39
  dnl gcc warning categories.
42
40
  AC_REQUIRE([AC_PROG_CC])
43
41
  if test -n "$GCC"; then
44
42
 
45
 
    dnl First, check -W -Werror -Wno-missing-field-initializers is supported
 
43
    dnl Check if -W -Werror -Wno-missing-field-initializers is supported
46
44
    dnl with the current $CC $CFLAGS $CPPFLAGS.
47
45
    AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
48
46
    AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
77
75
      ])
78
76
      AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
79
77
    fi
 
78
 
 
79
    dnl Next, check if -Werror -Wuninitialized is useful with the
 
80
    dnl user's choice of $CFLAGS; some versions of gcc warn that it
 
81
    dnl has no effect if -O is not also used
 
82
    AC_MSG_CHECKING([whether -Wuninitialized is supported])
 
83
    AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
 
84
      gl_save_CFLAGS="$CFLAGS"
 
85
      CFLAGS="$CFLAGS -Werror -Wuninitialized"
 
86
      AC_COMPILE_IFELSE(
 
87
        [AC_LANG_PROGRAM([[]], [[]])],
 
88
        [gl_cv_cc_uninitialized_supported=yes],
 
89
        [gl_cv_cc_uninitialized_supported=no])
 
90
      CFLAGS="$gl_save_CFLAGS"])
 
91
    AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
 
92
 
80
93
  fi
81
94
 
 
95
  # List all gcc warning categories.
82
96
  gl_manywarn_set=
83
97
  for gl_manywarn_item in \
 
98
    -W \
 
99
    -Wabi \
 
100
    -Waddress \
 
101
    -Waggressive-loop-optimizations \
84
102
    -Wall \
85
 
    -W \
86
 
    -Wformat-y2k \
87
 
    -Wformat-nonliteral \
88
 
    -Wformat-security \
89
 
    -Winit-self \
90
 
    -Wmissing-include-dirs \
91
 
    -Wswitch-default \
92
 
    -Wswitch-enum \
93
 
    -Wunused \
94
 
    -Wunknown-pragmas \
95
 
    -Wstrict-aliasing \
96
 
    -Wstrict-overflow \
97
 
    -Wsystem-headers \
98
 
    -Wfloat-equal \
99
 
    -Wtraditional \
100
 
    -Wtraditional-conversion \
101
 
    -Wdeclaration-after-statement \
102
 
    -Wundef \
103
 
    -Wshadow \
104
 
    -Wunsafe-loop-optimizations \
105
 
    -Wpointer-arith \
 
103
    -Warray-bounds \
 
104
    -Wattributes \
106
105
    -Wbad-function-cast \
107
 
    -Wc++-compat \
108
 
    -Wcast-qual \
 
106
    -Wbuiltin-macro-redefined \
109
107
    -Wcast-align \
110
 
    -Wwrite-strings \
111
 
    -Wconversion \
112
 
    -Wsign-conversion \
113
 
    -Wlogical-op \
114
 
    -Waggregate-return \
115
 
    -Wstrict-prototypes \
116
 
    -Wold-style-definition \
117
 
    -Wmissing-prototypes \
118
 
    -Wmissing-declarations \
119
 
    -Wmissing-noreturn \
120
 
    -Wmissing-format-attribute \
121
 
    -Wpacked \
122
 
    -Wpadded \
123
 
    -Wredundant-decls \
124
 
    -Wnested-externs \
125
 
    -Wunreachable-code \
126
 
    -Winline \
127
 
    -Winvalid-pch \
128
 
    -Wlong-long \
129
 
    -Wvla \
130
 
    -Wvolatile-register-var \
131
 
    -Wdisabled-optimization \
132
 
    -Wstack-protector \
133
 
    -Woverlength-strings \
134
 
    -Wbuiltin-macro-redefined \
135
 
    -Wmudflap \
136
 
    -Wpacked-bitfield-compat \
137
 
    -Wsync-nand \
138
 
    ; do
139
 
    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
140
 
  done
141
 
  # The following are not documented in the manual but are included in
142
 
  # output from gcc --help=warnings.
143
 
  for gl_manywarn_item in \
144
 
    -Wattributes \
 
108
    -Wchar-subscripts \
 
109
    -Wclobbered \
 
110
    -Wcomment \
 
111
    -Wcomments \
145
112
    -Wcoverage-mismatch \
146
 
    -Wmultichar \
147
 
    -Wunused-macros \
148
 
    ; do
149
 
    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
150
 
  done
151
 
  # More warnings from gcc 4.6.2 --help=warnings.
152
 
  for gl_manywarn_item in \
153
 
    -Wabi \
154
113
    -Wcpp \
155
114
    -Wdeprecated \
156
115
    -Wdeprecated-declarations \
 
116
    -Wdisabled-optimization \
157
117
    -Wdiv-by-zero \
158
118
    -Wdouble-promotion \
 
119
    -Wempty-body \
159
120
    -Wendif-labels \
 
121
    -Wenum-compare \
160
122
    -Wextra \
161
123
    -Wformat-contains-nul \
162
124
    -Wformat-extra-args \
 
125
    -Wformat-nonliteral \
 
126
    -Wformat-security \
 
127
    -Wformat-y2k \
163
128
    -Wformat-zero-length \
164
 
    -Wformat=2 \
 
129
    -Wfree-nonheap-object \
 
130
    -Wignored-qualifiers \
 
131
    -Wimplicit \
 
132
    -Wimplicit-function-declaration \
 
133
    -Wimplicit-int \
 
134
    -Winit-self \
 
135
    -Winline \
 
136
    -Wint-to-pointer-cast \
 
137
    -Winvalid-memory-model \
 
138
    -Winvalid-pch \
 
139
    -Wjump-misses-init \
 
140
    -Wlogical-op \
 
141
    -Wmain \
 
142
    -Wmaybe-uninitialized \
 
143
    -Wmissing-braces \
 
144
    -Wmissing-declarations \
 
145
    -Wmissing-field-initializers \
 
146
    -Wmissing-include-dirs \
 
147
    -Wmissing-parameter-type \
 
148
    -Wmissing-prototypes \
165
149
    -Wmultichar \
 
150
    -Wnarrowing \
 
151
    -Wnested-externs \
 
152
    -Wnonnull \
166
153
    -Wnormalized=nfc \
 
154
    -Wold-style-declaration \
 
155
    -Wold-style-definition \
167
156
    -Woverflow \
 
157
    -Woverlength-strings \
 
158
    -Woverride-init \
 
159
    -Wpacked \
 
160
    -Wpacked-bitfield-compat \
 
161
    -Wparentheses \
 
162
    -Wpointer-arith \
 
163
    -Wpointer-sign \
168
164
    -Wpointer-to-int-cast \
169
165
    -Wpragmas \
 
166
    -Wreturn-local-addr \
 
167
    -Wreturn-type \
 
168
    -Wsequence-point \
 
169
    -Wshadow \
 
170
    -Wsizeof-pointer-memaccess \
 
171
    -Wstack-protector \
 
172
    -Wstrict-aliasing \
 
173
    -Wstrict-overflow \
 
174
    -Wstrict-prototypes \
170
175
    -Wsuggest-attribute=const \
 
176
    -Wsuggest-attribute=format \
171
177
    -Wsuggest-attribute=noreturn \
172
178
    -Wsuggest-attribute=pure \
 
179
    -Wswitch \
 
180
    -Wswitch-default \
 
181
    -Wsync-nand \
 
182
    -Wsystem-headers \
173
183
    -Wtrampolines \
 
184
    -Wtrigraphs \
 
185
    -Wtype-limits \
 
186
    -Wuninitialized \
 
187
    -Wunknown-pragmas \
 
188
    -Wunsafe-loop-optimizations \
 
189
    -Wunused \
 
190
    -Wunused-but-set-parameter \
 
191
    -Wunused-but-set-variable \
 
192
    -Wunused-function \
 
193
    -Wunused-label \
 
194
    -Wunused-local-typedefs \
 
195
    -Wunused-macros \
 
196
    -Wunused-parameter \
 
197
    -Wunused-result \
 
198
    -Wunused-value \
 
199
    -Wunused-variable \
 
200
    -Wvarargs \
 
201
    -Wvariadic-macros \
 
202
    -Wvector-operation-performance \
 
203
    -Wvla \
 
204
    -Wvolatile-register-var \
 
205
    -Wwrite-strings \
 
206
    -fdiagnostics-show-option \
 
207
    -funit-at-a-time \
 
208
    \
174
209
    ; do
175
210
    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
176
211
  done
177
212
 
178
 
  # Disable the missing-field-initializers warning if needed
 
213
  # Disable specific options as needed.
179
214
  if test "$gl_cv_cc_nomfi_needed" = yes; then
180
215
    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
181
216
  fi
182
217
 
 
218
  if test "$gl_cv_cc_uninitialized_supported" = no; then
 
219
    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
 
220
  fi
 
221
 
183
222
  $1=$gl_manywarn_set
184
223
])