diff options
author | Tom Tromey <tom@tromey.com> | 2018-07-08 21:05:41 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-07-22 13:20:07 -0600 |
commit | a0de763e32b381369896fef63d221376f29a9113 (patch) | |
tree | 4471af9aa69c5ac073b1f4d3ef6255dd8b48266d /gdb/warning.m4 | |
parent | 3b20124b3d6df31b5bde0f6bcd718cc40de8d49b (diff) | |
download | gdb-a0de763e32b381369896fef63d221376f29a9113.zip gdb-a0de763e32b381369896fef63d221376f29a9113.tar.gz gdb-a0de763e32b381369896fef63d221376f29a9113.tar.bz2 |
Add -Wunused-variable to warnings.m4
This adds -Wunused-variable to the build. This required a special
check in configure in order to work around a bug in GCC 4.9. Simon
ound the correct test to use, so I've added him to the ChangeLog.
gdb/ChangeLog
2018-07-22 Simon Marchi <simon.marchi@polymtl.ca>
Tom Tromey <tom@tromey.com>
* warning.m4 (AM_GDB_WARNINGS): Add -Wunused-variable and special
test for it.
* configure: Rebuild.
gdb/gdbserver/ChangeLog
2018-07-22 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
Diffstat (limited to 'gdb/warning.m4')
-rw-r--r-- | gdb/warning.m4 | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gdb/warning.m4 b/gdb/warning.m4 index 632cc21..00e7cd6 100644 --- a/gdb/warning.m4 +++ b/gdb/warning.m4 @@ -37,7 +37,7 @@ fi # The options we'll try to enable. build_warnings="-Wall -Wpointer-arith \ --Wno-unused -Wunused-value -Wunused-function \ +-Wno-unused -Wunused-value -Wunused-variable -Wunused-function \ -Wno-switch -Wno-char-subscripts \ -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \ @@ -118,7 +118,20 @@ then CFLAGS="$CFLAGS -Werror $wtest" saved_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -Werror $wtest" - AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) + if test "x$w" = "x-Wunused-variable"; then + # Check for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38958, + # fixed in GCC 4.9. This test is derived from the gdb + # source code that triggered this bug in GCC. + AC_TRY_COMPILE( + [struct scoped_restore_base {}; + struct scoped_restore_tmpl : public scoped_restore_base { + ~scoped_restore_tmpl() {} + };], + [const scoped_restore_base &b = scoped_restore_tmpl();], + WARN_CFLAGS="${WARN_CFLAGS} $w",) + else + AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) + fi CFLAGS="$saved_CFLAGS" CXXFLAGS="$saved_CXXFLAGS" esac |