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 | |
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.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rwxr-xr-x | gdb/configure | 4 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 4 | ||||
-rwxr-xr-x | gdb/gdbserver/configure | 10 | ||||
-rw-r--r-- | gdb/warning.m4 | 4 |
5 files changed, 19 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2c4f96e..c14e204 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2017-06-17 Simon Marchi <simon.marchi@ericsson.com> + * configure: Re-generate. + * warning.m4: Pass -Werror to compiler when checking for + supported warning flags. + +2017-06-17 Simon Marchi <simon.marchi@ericsson.com> + * Makefile.in (COMPILE.pre): Add "-x c++". 2017-06-16 Alan Hayward <alan.hayward@arm.com> diff --git a/gdb/configure b/gdb/configure index 1f15d5d3..df2747a 100755 --- a/gdb/configure +++ b/gdb/configure @@ -15222,9 +15222,9 @@ $as_echo_n "checking compiler warning flags... " >&6; } *) # 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" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index eef680c..2eb492e 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,9 @@ 2017-06-17 Simon Marchi <simon.marchi@ericsson.com> + * configure: Re-generate. + +2017-06-17 Simon Marchi <simon.marchi@ericsson.com> + * Makefile.in (COMPILE.pre): Add "-x c++". 2017-06-09 Sergio Durigan Junior <sergiodj@redhat.com> diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index b314c41..2550c7b 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -7219,9 +7219,9 @@ $as_echo_n "checking compiler warning flags... " >&6; } *) # 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" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7498,9 +7498,9 @@ _ACEOF fi -# See if <sys/user.h> supports the %fs_base and %gs_base amd64 segment -# registers. Older amd64 Linux's don't have the fs_base and gs_base -# members of `struct user_regs_struct'. +# See if <sys/user.h> supports the %fs_base and %gs_bas amd64 segment registers. +# Older amd64 Linux's don't have the fs_base and gs_base members of +# `struct user_regs_struct'. ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "fs_base" "ac_cv_member_struct_user_regs_struct_fs_base" "#include <sys/user.h> " if test "x$ac_cv_member_struct_user_regs_struct_fs_base" = x""yes; then : 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" |