From f1628857d783fee0171f16f1bad0b7816460dec5 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 5 Sep 2018 13:46:47 -0600 Subject: Make -Wformat-nonliteral work with gcc After looking into why the build failed for Simon but not for me, we found that the underlying cause was due to how gcc treats -Wformat-nonliteral. gcc requires -Wformat to be given first; but warning.m4 was not doing this, so -Wformat-nonliteral was not being used. This patch changes warning.m4 to account gcc's requirement. This then showed that the target-float.c build change in the earlier Makefile patch was also incorrect. Simon didn't see this in his build, but gcc now points it out. So, this patch fixes this problem as well. 2018-09-05 Tom Tromey * warning.m4 (AM_GDB_WARNINGS): Add -Wformat when testing -Wformat-nonliteral. * target-float.c (host_float_ops::to_string) (host_float_ops::from_string): Use DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL. * configure: Rebuild. gdb/gdbserver/ChangeLog 2018-09-05 Tom Tromey * configure: Rebuild. --- gdb/gdbserver/configure | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gdb/gdbserver/configure') diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 7454cd8..f5cbbae 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -7258,7 +7258,10 @@ case "${host}" in build_warnings="$build_warnings -Wno-unknown-pragmas" # Solaris 11 marks vfork deprecated. build_warnings="$build_warnings -Wno-deprecated-declarations" ;; - *) build_warnings="$build_warnings -Wformat-nonliteral" ;; + *) + # Note that gcc requires -Wformat for -Wformat-nonliteral to work, + # but there's a special case for this below. + build_warnings="$build_warnings -Wformat-nonliteral" ;; esac # Check whether --enable-build-warnings was given. @@ -7314,6 +7317,12 @@ $as_echo_n "checking compiler warning flags... " >&6; } case $w in -Wno-*) wtest=`echo $w | sed 's/-Wno-/-W/g'` ;; + -Wformat-nonliteral) + # gcc requires -Wformat before -Wformat-nonliteral + # will work, so stick them together. + w="-Wformat $w" + wtest="$w" + ;; *) wtest=$w ;; esac -- cgit v1.1