* [PATCH 0/2] [gdb/build] Two gdbsupport/warning.m4 updates
@ 2026-10-28 10:41 Tom de Vries
2026-10-28 10:41 ` [PATCH 1/2] [gdb/build] Put warnings one per line Tom de Vries
2026-10-28 10:41 ` [PATCH 2/2] [gdb/build] Rework warnings order Tom de Vries
0 siblings, 2 replies; 3+ messages in thread
From: Tom de Vries @ 2026-10-28 10:41 UTC (permalink / raw)
To: gdb-patches
This series contains two patches. Both of them are follow-ups on commit
df3eb64a53c ("gdbsupport: re-format and sort warning flags").
The first fixes a minor oversight.
The second makes ordering constraints between warnings explicit.
Tom de Vries (2):
[gdb/build] Put warnings one per line
[gdb/build] Rework warnings order
gdb/configure | 57 +++++++++++++++++++++++++++++++++++++------
gdbserver/configure | 57 +++++++++++++++++++++++++++++++++++++------
gdbsupport/configure | 57 +++++++++++++++++++++++++++++++++++++------
gdbsupport/warning.m4 | 57 +++++++++++++++++++++++++++++++++++++------
4 files changed, 196 insertions(+), 32 deletions(-)
base-commit: 7a593bcacd21f1ae684ed49dc2f8e3ea558c7c64
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] [gdb/build] Put warnings one per line
2026-10-28 10:41 [PATCH 0/2] [gdb/build] Two gdbsupport/warning.m4 updates Tom de Vries
@ 2026-10-28 10:41 ` Tom de Vries
2026-10-28 10:41 ` [PATCH 2/2] [gdb/build] Rework warnings order Tom de Vries
1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2026-10-28 10:41 UTC (permalink / raw)
To: gdb-patches
Commit df3eb64a53c ("gdbsupport: re-format and sort warning flags") put each
warning on its own line, except for one: -Wno-error=maybe-uninitialized.
Fix this.
---
gdb/configure | 3 ++-
gdbserver/configure | 3 ++-
gdbsupport/configure | 3 ++-
gdbsupport/warning.m4 | 3 ++-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index e747ffce49f..07bf6edf1d1 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -31159,8 +31159,9 @@ build_warnings=" \
-Wmissing-declarations \
-Wno-char-subscripts \
-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
-Wno-mismatched-tags \
--Wno-sign-compare -Wno-error=maybe-uninitialized \
+-Wno-sign-compare \
-Wno-switch \
-Wno-unused \
-Wpointer-arith \
diff --git a/gdbserver/configure b/gdbserver/configure
index e00e1e1c1c5..725c28e19ad 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -12889,8 +12889,9 @@ build_warnings=" \
-Wmissing-declarations \
-Wno-char-subscripts \
-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
-Wno-mismatched-tags \
--Wno-sign-compare -Wno-error=maybe-uninitialized \
+-Wno-sign-compare \
-Wno-switch \
-Wno-unused \
-Wpointer-arith \
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 7ed4e259ffe..31e9732ed1a 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -13892,8 +13892,9 @@ build_warnings=" \
-Wmissing-declarations \
-Wno-char-subscripts \
-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
-Wno-mismatched-tags \
--Wno-sign-compare -Wno-error=maybe-uninitialized \
+-Wno-sign-compare \
-Wno-switch \
-Wno-unused \
-Wpointer-arith \
diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
index 3148feb740a..7cae9996765 100644
--- a/gdbsupport/warning.m4
+++ b/gdbsupport/warning.m4
@@ -47,8 +47,9 @@ build_warnings=" \
-Wmissing-declarations \
-Wno-char-subscripts \
-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
-Wno-mismatched-tags \
--Wno-sign-compare -Wno-error=maybe-uninitialized \
+-Wno-sign-compare \
-Wno-switch \
-Wno-unused \
-Wpointer-arith \
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] [gdb/build] Rework warnings order
2026-10-28 10:41 [PATCH 0/2] [gdb/build] Two gdbsupport/warning.m4 updates Tom de Vries
2026-10-28 10:41 ` [PATCH 1/2] [gdb/build] Put warnings one per line Tom de Vries
@ 2026-10-28 10:41 ` Tom de Vries
1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2026-10-28 10:41 UTC (permalink / raw)
To: gdb-patches
I looked at gdbsupport/warning.m4 and noticed that the warnings list is sorted
purely alphabetically, but not on warning name, so Wfoo, Wno-foo and
Wno-error=foo are sorted to different locations.
I tried out sorting on warning names instead, but then noticed that it's
harder to check that the warnings are in the right order.
Fix this by introducing two additional lists, build_warnings_no and
build_warnings_no_error.
Then I noticed that there are two ordering constraints:
- Wall needs to be ordered before Wno-char-subscripts and others, and
- Wno-unused needs to be ordered before Wunused-variable and others.
These constraints were met before commit df3eb64a53c ("gdbsupport:
re-format and sort warning flags"). After the commit, they still held but
only accidentally, because:
- Wall comes first alphabetically, and
- Wno-unused comes alphabetically before Wunused-variable.
Put differently, if we had applied reverse alphabetical order, both
constraints would have been broken.
Introduce another list build_warnings_base, and handle these ordering
constraints explicitly.
---
gdb/configure | 58 ++++++++++++++++++++++++++++++++++++-------
gdbserver/configure | 58 ++++++++++++++++++++++++++++++++++++-------
gdbsupport/configure | 58 ++++++++++++++++++++++++++++++++++++-------
gdbsupport/warning.m4 | 58 ++++++++++++++++++++++++++++++++++++-------
4 files changed, 196 insertions(+), 36 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index 07bf6edf1d1..b30ab95a551 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -31147,9 +31147,24 @@ if test "${ERROR_ON_WARNING}" = yes ; then
WERROR_CFLAGS="-Werror"
fi
-# The options we'll try to enable.
-build_warnings=" \
+# The options we'll try to enable. Put options we want to override using
+# build_warnings_no here. Sorted alphabetically.
+build_warnings_base=" \
-Wall \
+"
+
+# The options we'll try to disable. Sorted alphabetically.
+build_warnings_no=" \
+-Wno-char-subscripts \
+-Wno-mismatched-tags \
+-Wno-sign-compare \
+-Wno-switch \
+-Wno-unused \
+"
+
+# The options we'll try to enable. Don't put options we want to override
+# using build_warnings_no here. Sorted alphabetically.
+build_warnings=" \
-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
@@ -31157,13 +31172,6 @@ build_warnings=" \
-Wempty-body \
-Wimplicit-fallthrough=5 \
-Wmissing-declarations \
--Wno-char-subscripts \
--Wno-error=deprecated-register \
--Wno-error=maybe-uninitialized \
--Wno-mismatched-tags \
--Wno-sign-compare \
--Wno-switch \
--Wno-unused \
-Wpointer-arith \
-Wredundant-move \
-Wshadow=local \
@@ -31184,6 +31192,14 @@ build_warnings=" \
-Wvla \
"
+# The warnings which, if enabled, we don't want to turn into errors if -Werror
+# is in effect. Note that these neither enable nor disable any warnings.
+# Sorted alphabetically.
+build_warnings_no_error=" \
+-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
+"
+
# The -Wmissing-prototypes flag will be accepted by GCC, but results
# in a warning being printed about the flag not being valid for C++,
# this is something to do with using ccache, and argument ordering.
@@ -31191,6 +31207,30 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# The order here is significant:
+# - some warnings are enabled by default
+# - build_warnings_base (contains -Wall) enables more warnings
+# - build_warnings_no switches some of those off
+# - build_warnings enables warnings that were:
+# - enabled neither by default nor by build_warnings_base,
+# for example -Wshadow=local
+# - enabled by default or build_warnings_base but disabled by
+# build_warnings_no, for example -Wno-unused and -Wunused-variable
+build_warnings=" \
+$build_warnings_base \
+$build_warnings_no \
+$build_warnings \
+"
+
+# Variable build_warnings_no_error doesn't enable or disable warnings, so the
+# concatenation order is not significant.
+build_warnings=" \
+$build_warnings \
+$build_warnings_no_error \
+"
+
+# Host-specific warning settings. Apply these last to make sure they are
+# not overridden.
case "${host}" in
*-*-mingw32*)
# Enable -Wno-format by default when using gcc on mingw since many
diff --git a/gdbserver/configure b/gdbserver/configure
index 725c28e19ad..9bcaba6550a 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -12877,9 +12877,24 @@ if test "${ERROR_ON_WARNING}" = yes ; then
WERROR_CFLAGS="-Werror"
fi
-# The options we'll try to enable.
-build_warnings=" \
+# The options we'll try to enable. Put options we want to override using
+# build_warnings_no here. Sorted alphabetically.
+build_warnings_base=" \
-Wall \
+"
+
+# The options we'll try to disable. Sorted alphabetically.
+build_warnings_no=" \
+-Wno-char-subscripts \
+-Wno-mismatched-tags \
+-Wno-sign-compare \
+-Wno-switch \
+-Wno-unused \
+"
+
+# The options we'll try to enable. Don't put options we want to override
+# using build_warnings_no here. Sorted alphabetically.
+build_warnings=" \
-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
@@ -12887,13 +12902,6 @@ build_warnings=" \
-Wempty-body \
-Wimplicit-fallthrough=5 \
-Wmissing-declarations \
--Wno-char-subscripts \
--Wno-error=deprecated-register \
--Wno-error=maybe-uninitialized \
--Wno-mismatched-tags \
--Wno-sign-compare \
--Wno-switch \
--Wno-unused \
-Wpointer-arith \
-Wredundant-move \
-Wshadow=local \
@@ -12914,6 +12922,14 @@ build_warnings=" \
-Wvla \
"
+# The warnings which, if enabled, we don't want to turn into errors if -Werror
+# is in effect. Note that these neither enable nor disable any warnings.
+# Sorted alphabetically.
+build_warnings_no_error=" \
+-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
+"
+
# The -Wmissing-prototypes flag will be accepted by GCC, but results
# in a warning being printed about the flag not being valid for C++,
# this is something to do with using ccache, and argument ordering.
@@ -12921,6 +12937,30 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# The order here is significant:
+# - some warnings are enabled by default
+# - build_warnings_base (contains -Wall) enables more warnings
+# - build_warnings_no switches some of those off
+# - build_warnings enables warnings that were:
+# - enabled neither by default nor by build_warnings_base,
+# for example -Wshadow=local
+# - enabled by default or build_warnings_base but disabled by
+# build_warnings_no, for example -Wno-unused and -Wunused-variable
+build_warnings=" \
+$build_warnings_base \
+$build_warnings_no \
+$build_warnings \
+"
+
+# Variable build_warnings_no_error doesn't enable or disable warnings, so the
+# concatenation order is not significant.
+build_warnings=" \
+$build_warnings \
+$build_warnings_no_error \
+"
+
+# Host-specific warning settings. Apply these last to make sure they are
+# not overridden.
case "${host}" in
*-*-mingw32*)
# Enable -Wno-format by default when using gcc on mingw since many
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 31e9732ed1a..b0a879710f2 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -13880,9 +13880,24 @@ if test "${ERROR_ON_WARNING}" = yes ; then
WERROR_CFLAGS="-Werror"
fi
-# The options we'll try to enable.
-build_warnings=" \
+# The options we'll try to enable. Put options we want to override using
+# build_warnings_no here. Sorted alphabetically.
+build_warnings_base=" \
-Wall \
+"
+
+# The options we'll try to disable. Sorted alphabetically.
+build_warnings_no=" \
+-Wno-char-subscripts \
+-Wno-mismatched-tags \
+-Wno-sign-compare \
+-Wno-switch \
+-Wno-unused \
+"
+
+# The options we'll try to enable. Don't put options we want to override
+# using build_warnings_no here. Sorted alphabetically.
+build_warnings=" \
-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
@@ -13890,13 +13905,6 @@ build_warnings=" \
-Wempty-body \
-Wimplicit-fallthrough=5 \
-Wmissing-declarations \
--Wno-char-subscripts \
--Wno-error=deprecated-register \
--Wno-error=maybe-uninitialized \
--Wno-mismatched-tags \
--Wno-sign-compare \
--Wno-switch \
--Wno-unused \
-Wpointer-arith \
-Wredundant-move \
-Wshadow=local \
@@ -13917,6 +13925,14 @@ build_warnings=" \
-Wvla \
"
+# The warnings which, if enabled, we don't want to turn into errors if -Werror
+# is in effect. Note that these neither enable nor disable any warnings.
+# Sorted alphabetically.
+build_warnings_no_error=" \
+-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
+"
+
# The -Wmissing-prototypes flag will be accepted by GCC, but results
# in a warning being printed about the flag not being valid for C++,
# this is something to do with using ccache, and argument ordering.
@@ -13924,6 +13940,30 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# The order here is significant:
+# - some warnings are enabled by default
+# - build_warnings_base (contains -Wall) enables more warnings
+# - build_warnings_no switches some of those off
+# - build_warnings enables warnings that were:
+# - enabled neither by default nor by build_warnings_base,
+# for example -Wshadow=local
+# - enabled by default or build_warnings_base but disabled by
+# build_warnings_no, for example -Wno-unused and -Wunused-variable
+build_warnings=" \
+$build_warnings_base \
+$build_warnings_no \
+$build_warnings \
+"
+
+# Variable build_warnings_no_error doesn't enable or disable warnings, so the
+# concatenation order is not significant.
+build_warnings=" \
+$build_warnings \
+$build_warnings_no_error \
+"
+
+# Host-specific warning settings. Apply these last to make sure they are
+# not overridden.
case "${host}" in
*-*-mingw32*)
# Enable -Wno-format by default when using gcc on mingw since many
diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
index 7cae9996765..2eb6e8dc537 100644
--- a/gdbsupport/warning.m4
+++ b/gdbsupport/warning.m4
@@ -35,9 +35,24 @@ if test "${ERROR_ON_WARNING}" = yes ; then
WERROR_CFLAGS="-Werror"
fi
-# The options we'll try to enable.
-build_warnings=" \
+# The options we'll try to enable. Put options we want to override using
+# build_warnings_no here. Sorted alphabetically.
+build_warnings_base=" \
-Wall \
+"
+
+# The options we'll try to disable. Sorted alphabetically.
+build_warnings_no=" \
+-Wno-char-subscripts \
+-Wno-mismatched-tags \
+-Wno-sign-compare \
+-Wno-switch \
+-Wno-unused \
+"
+
+# The options we'll try to enable. Don't put options we want to override
+# using build_warnings_no here. Sorted alphabetically.
+build_warnings=" \
-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
@@ -45,13 +60,6 @@ build_warnings=" \
-Wempty-body \
-Wimplicit-fallthrough=5 \
-Wmissing-declarations \
--Wno-char-subscripts \
--Wno-error=deprecated-register \
--Wno-error=maybe-uninitialized \
--Wno-mismatched-tags \
--Wno-sign-compare \
--Wno-switch \
--Wno-unused \
-Wpointer-arith \
-Wredundant-move \
-Wshadow=local \
@@ -72,6 +80,14 @@ build_warnings=" \
-Wvla \
"
+# The warnings which, if enabled, we don't want to turn into errors if -Werror
+# is in effect. Note that these neither enable nor disable any warnings.
+# Sorted alphabetically.
+build_warnings_no_error=" \
+-Wno-error=deprecated-register \
+-Wno-error=maybe-uninitialized \
+"
+
# The -Wmissing-prototypes flag will be accepted by GCC, but results
# in a warning being printed about the flag not being valid for C++,
# this is something to do with using ccache, and argument ordering.
@@ -79,6 +95,30 @@ if test "$GDB_COMPILER_TYPE" != gcc; then
build_warnings="$build_warnings -Wmissing-prototypes"
fi
+# The order here is significant:
+# - some warnings are enabled by default
+# - build_warnings_base (contains -Wall) enables more warnings
+# - build_warnings_no switches some of those off
+# - build_warnings enables warnings that were:
+# - enabled neither by default nor by build_warnings_base,
+# for example -Wshadow=local
+# - enabled by default or build_warnings_base but disabled by
+# build_warnings_no, for example -Wno-unused and -Wunused-variable
+build_warnings=" \
+$build_warnings_base \
+$build_warnings_no \
+$build_warnings \
+"
+
+# Variable build_warnings_no_error doesn't enable or disable warnings, so the
+# concatenation order is not significant.
+build_warnings=" \
+$build_warnings \
+$build_warnings_no_error \
+"
+
+# Host-specific warning settings. Apply these last to make sure they are
+# not overridden.
case "${host}" in
*-*-mingw32*)
# Enable -Wno-format by default when using gcc on mingw since many
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-28 10:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 10:41 [PATCH 0/2] [gdb/build] Two gdbsupport/warning.m4 updates Tom de Vries
2026-10-28 10:41 ` [PATCH 1/2] [gdb/build] Put warnings one per line Tom de Vries
2026-10-28 10:41 ` [PATCH 2/2] [gdb/build] Rework warnings order Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox