gdb: Use -Werror when checking for (un)supported warning flags
authorSimon Marchi <simon.marchi@ericsson.com>
Sat, 17 Jun 2017 21:18:20 +0000 (23:18 +0200)
committerSimon Marchi <simon.marchi@ericsson.com>
Sat, 17 Jun 2017 21:18:20 +0000 (23:18 +0200)
commit3e019bdc20eb81b91ab5bc774386201b874c0bac
treefb557b99058e01de70269a3181b6c93753f8a127
parentcf0dd6f02cd45d6dbb6bd87dde25dd3ed74eb7d0
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.
gdb/ChangeLog
gdb/configure
gdb/gdbserver/ChangeLog
gdb/gdbserver/configure
gdb/warning.m4
This page took 0.029943 seconds and 4 git commands to generate.