[binutils-gdb] [gdb/build] Re-enable Wformat-nonliteral on Solaris
Tom de Vries
vries@sourceware.org
Tue Dec 1 10:49:04 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f2fffbcecc70dac51cc0b67dcff3fa3eaab032eb
commit f2fffbcecc70dac51cc0b67dcff3fa3eaab032eb
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Dec 1 11:49:00 2026 +0100
[gdb/build] Re-enable Wformat-nonliteral on Solaris
Commit 4fa7574eecb ("Fix gdb 8.1 Solaris compilation") made the following
change (edited for readability) in gdb/warning.m4 (now gdbsupport/warning.m4):
...
case "${host}" in
*-*-mingw32*)
build_warnings="$build_warnings -Wno-format" ;;
+ *-*-solaris*)
+ build_warnings="$build_warnings -Wno-unknown-pragmas"
+ build_warnings="$build_warnings -Wno-deprecated-declarations" ;;
*)
build_warnings="$build_warnings -Wformat-nonliteral" ;;
esac
...
This dropped Wformat-nonliteral on Solaris.
Add it back by giving the Wformat handling its own case statement.
Tested by building on x86_64-solaris, sparc-solaris and x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=35047
Diff:
---
gdb/configure | 17 +++++++++++++----
gdbserver/configure | 17 +++++++++++++----
gdbsupport/configure | 17 +++++++++++++----
gdbsupport/warning.m4 | 17 +++++++++++++----
4 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index 5aee9b595e0..0e4ed1da98b 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -31192,17 +31192,26 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# Add host-specific settings.
case "${host}" in
- *-*-mingw32*)
- # Enable -Wno-format by default when using gcc on mingw since many
- # GCC versions complain about %I64.
- build_warnings="$build_warnings -Wno-format" ;;
*-*-solaris*)
# Solaris 11.4 <python2.7/ceval.h> uses #pragma no_inline that GCC
# doesn't understand.
build_warnings="$build_warnings -Wno-unknown-pragmas"
# Solaris 11 <unistd.h> marks vfork deprecated.
build_warnings="$build_warnings -Wno-deprecated-declarations" ;;
+ *)
+ # Intentionally left empty. If a default case is required, add another
+ # case statement, as for the Wformat settings.
+ : ;;
+esac
+
+# Add Wformat settings.
+case "${host}" in
+ *-*-mingw32*)
+ # Enable -Wno-format by default when using gcc on mingw since many
+ # GCC versions complain about %I64.
+ build_warnings="$build_warnings -Wno-format" ;;
*)
# Note that gcc requires -Wformat for -Wformat-nonliteral to work,
# but there's a special case for this below.
diff --git a/gdbserver/configure b/gdbserver/configure
index 9a56bd2b4e4..c97bcd0a0ab 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -12922,17 +12922,26 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# Add host-specific settings.
case "${host}" in
- *-*-mingw32*)
- # Enable -Wno-format by default when using gcc on mingw since many
- # GCC versions complain about %I64.
- build_warnings="$build_warnings -Wno-format" ;;
*-*-solaris*)
# Solaris 11.4 <python2.7/ceval.h> uses #pragma no_inline that GCC
# doesn't understand.
build_warnings="$build_warnings -Wno-unknown-pragmas"
# Solaris 11 <unistd.h> marks vfork deprecated.
build_warnings="$build_warnings -Wno-deprecated-declarations" ;;
+ *)
+ # Intentionally left empty. If a default case is required, add another
+ # case statement, as for the Wformat settings.
+ : ;;
+esac
+
+# Add Wformat settings.
+case "${host}" in
+ *-*-mingw32*)
+ # Enable -Wno-format by default when using gcc on mingw since many
+ # GCC versions complain about %I64.
+ build_warnings="$build_warnings -Wno-format" ;;
*)
# Note that gcc requires -Wformat for -Wformat-nonliteral to work,
# but there's a special case for this below.
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 8734ce9b375..a9a98a3e6f6 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -13925,17 +13925,26 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# Add host-specific settings.
case "${host}" in
- *-*-mingw32*)
- # Enable -Wno-format by default when using gcc on mingw since many
- # GCC versions complain about %I64.
- build_warnings="$build_warnings -Wno-format" ;;
*-*-solaris*)
# Solaris 11.4 <python2.7/ceval.h> uses #pragma no_inline that GCC
# doesn't understand.
build_warnings="$build_warnings -Wno-unknown-pragmas"
# Solaris 11 <unistd.h> marks vfork deprecated.
build_warnings="$build_warnings -Wno-deprecated-declarations" ;;
+ *)
+ # Intentionally left empty. If a default case is required, add another
+ # case statement, as for the Wformat settings.
+ : ;;
+esac
+
+# Add Wformat settings.
+case "${host}" in
+ *-*-mingw32*)
+ # Enable -Wno-format by default when using gcc on mingw since many
+ # GCC versions complain about %I64.
+ build_warnings="$build_warnings -Wno-format" ;;
*)
# Note that gcc requires -Wformat for -Wformat-nonliteral to work,
# but there's a special case for this below.
diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
index 966430137f5..12decac3534 100644
--- a/gdbsupport/warning.m4
+++ b/gdbsupport/warning.m4
@@ -80,17 +80,26 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# Add host-specific settings.
case "${host}" in
- *-*-mingw32*)
- # Enable -Wno-format by default when using gcc on mingw since many
- # GCC versions complain about %I64.
- build_warnings="$build_warnings -Wno-format" ;;
*-*-solaris*)
# Solaris 11.4 <python2.7/ceval.h> uses #pragma no_inline that GCC
# doesn't understand.
build_warnings="$build_warnings -Wno-unknown-pragmas"
# Solaris 11 <unistd.h> marks vfork deprecated.
build_warnings="$build_warnings -Wno-deprecated-declarations" ;;
+ *)
+ # Intentionally left empty. If a default case is required, add another
+ # case statement, as for the Wformat settings.
+ : ;;
+esac
+
+# Add Wformat settings.
+case "${host}" in
+ *-*-mingw32*)
+ # Enable -Wno-format by default when using gcc on mingw since many
+ # GCC versions complain about %I64.
+ build_warnings="$build_warnings -Wno-format" ;;
*)
# Note that gcc requires -Wformat for -Wformat-nonliteral to work,
# but there's a special case for this below.
More information about the Gdb-cvs
mailing list