diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-06-17 23:18:20 +0200 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-06-17 23:18:20 +0200 |
commit | 3e019bdc20eb81b91ab5bc774386201b874c0bac (patch) | |
tree | fb557b99058e01de70269a3181b6c93753f8a127 /gdb/warning.m4 | |
parent | cf0dd6f02cd45d6dbb6bd87dde25dd3ed74eb7d0 (diff) | |
download | gdb-3e019bdc20eb81b91ab5bc774386201b874c0bac.zip gdb-3e019bdc20eb81b91ab5bc774386201b874c0bac.tar.gz gdb-3e019bdc20eb81b91ab5bc774386201b874c0bac.tar.bz2 |
gdb: Use -Werror when checking for (un)supported warning flags
In warning.m4, we pass all the warning flags one by one to the compiler
to test if they are supported by this particular compiler. If the
compiler exits with an error, we conclude that this warning flag is not
supported and exclude it. This allows us to use warning flags without
having to worry about which versions of which compilers support each
flag.
clang, by default, only emits a warning if an unknown flag is passed:
warning: unknown warning option '-Wfoo' [-Wunknown-warning-option]
The result is that we think that all the warning flags we use are
supported by clang (they are not), and the compilation fails later when
building with -Werror, since the aforementioned warning becomes an
error. The fix is to also pass -Werror when probing for supported
flags, then we'll correctly get an error when using an unknown warning,
and we'll exclude it:
error: unknown warning option '-Wfoo' [-Werror,-Wunknown-warning-option]
I am not sure why there is a change in a random comment in
gdbserver/configure, but I suppose it's a leftfover from a previous
patch, so I included it.
gdb/ChangeLog:
* configure: Re-generate.
* warning.m4: Pass -Werror to compiler when checking for
supported warning flags.
gdb/gdbserver/ChangeLog:
* configure: Re-generate.
Diffstat (limited to 'gdb/warning.m4')
-rw-r--r-- | gdb/warning.m4 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/warning.m4 b/gdb/warning.m4 index 98e7453..00e0f38 100644 --- a/gdb/warning.m4 +++ b/gdb/warning.m4 @@ -103,9 +103,9 @@ then *) # Check whether GCC accepts it. saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $wtest" + CFLAGS="$CFLAGS -Werror $wtest" saved_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $wtest" + CXXFLAGS="$CXXFLAGS -Werror $wtest" AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) CFLAGS="$saved_CFLAGS" CXXFLAGS="$saved_CXXFLAGS" |