* [PATCH] Add two new warnings to warning.m4
@ 2026-06-03 19:05 Tom Tromey
2026-06-05 7:38 ` Tom de Vries
0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2026-06-03 19:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
I recently learned that GCC has improved -Wdangling-reference and
added -Wunterminated-string-initialization. Both of these seem
sensible to me, so this patch adds them to warning.m4.
gdb rebuilds cleanly with this in place on x86-64 Fedora 43.
---
gdb/configure | 2 ++
gdbserver/configure | 2 ++
gdbsupport/configure | 2 ++
gdbsupport/warning.m4 | 2 ++
4 files changed, 8 insertions(+)
diff --git a/gdb/configure b/gdb/configure
index 17c95930f60..80931d10bef 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -31580,6 +31580,7 @@ fi
# The options we'll try to enable.
build_warnings=" \
-Wall \
+-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
-Wduplicated-cond \
@@ -31597,6 +31598,7 @@ build_warnings=" \
-Wshadow=local \
-Wstrict-null-sentinel \
-Wsuggest-override \
+-Wunterminated-string-initialization \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-Wunused-const-variable=1 \
diff --git a/gdbserver/configure b/gdbserver/configure
index 0159da6bdf4..46faecc3a20 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -13448,6 +13448,7 @@ fi
# The options we'll try to enable.
build_warnings=" \
-Wall \
+-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
-Wduplicated-cond \
@@ -13465,6 +13466,7 @@ build_warnings=" \
-Wshadow=local \
-Wstrict-null-sentinel \
-Wsuggest-override \
+-Wunterminated-string-initialization \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-Wunused-const-variable=1 \
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 584a80ef825..0bc9ff1db9a 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -14123,6 +14123,7 @@ fi
# The options we'll try to enable.
build_warnings=" \
-Wall \
+-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
-Wduplicated-cond \
@@ -14140,6 +14141,7 @@ build_warnings=" \
-Wshadow=local \
-Wstrict-null-sentinel \
-Wsuggest-override \
+-Wunterminated-string-initialization \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-Wunused-const-variable=1 \
diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
index 718ac34aa3c..3148feb740a 100644
--- a/gdbsupport/warning.m4
+++ b/gdbsupport/warning.m4
@@ -38,6 +38,7 @@ fi
# The options we'll try to enable.
build_warnings=" \
-Wall \
+-Wdangling-reference \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
-Wduplicated-cond \
@@ -55,6 +56,7 @@ build_warnings=" \
-Wshadow=local \
-Wstrict-null-sentinel \
-Wsuggest-override \
+-Wunterminated-string-initialization \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-Wunused-const-variable=1 \
base-commit: 663cb9c0428068165fc98675599442163d302d41
--
2.54.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add two new warnings to warning.m4
2026-06-03 19:05 [PATCH] Add two new warnings to warning.m4 Tom Tromey
@ 2026-06-05 7:38 ` Tom de Vries
2026-06-05 7:41 ` Tom de Vries
2026-06-05 20:51 ` Tom Tromey
0 siblings, 2 replies; 5+ messages in thread
From: Tom de Vries @ 2026-06-05 7:38 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 6/3/26 9:05 PM, Tom Tromey wrote:
> I recently learned that GCC has improved -Wdangling-reference and
> added -Wunterminated-string-initialization. Both of these seem
> sensible to me, so this patch adds them to warning.m4.
>
This looks fine to me.
I did wonder whether we should add __attribute__((nonstring)) to
gdb_byte, but atm it doesn't seem necessary.
Reviewed-By: Tom de Vries <tdevries@suse.de>
Thanks,
- Tom
> gdb rebuilds cleanly with this in place on x86-64 Fedora 43.
> ---
> gdb/configure | 2 ++
> gdbserver/configure | 2 ++
> gdbsupport/configure | 2 ++
> gdbsupport/warning.m4 | 2 ++
> 4 files changed, 8 insertions(+)
>
> diff --git a/gdb/configure b/gdb/configure
> index 17c95930f60..80931d10bef 100755
> --- a/gdb/configure
> +++ b/gdb/configure
> @@ -31580,6 +31580,7 @@ fi
> # The options we'll try to enable.
> build_warnings=" \
> -Wall \
> +-Wdangling-reference \
> -Wdeprecated-copy \
> -Wdeprecated-copy-dtor \
> -Wduplicated-cond \
> @@ -31597,6 +31598,7 @@ build_warnings=" \
> -Wshadow=local \
> -Wstrict-null-sentinel \
> -Wsuggest-override \
> +-Wunterminated-string-initialization \
> -Wunused-but-set-parameter \
> -Wunused-but-set-variable \
> -Wunused-const-variable=1 \
> diff --git a/gdbserver/configure b/gdbserver/configure
> index 0159da6bdf4..46faecc3a20 100755
> --- a/gdbserver/configure
> +++ b/gdbserver/configure
> @@ -13448,6 +13448,7 @@ fi
> # The options we'll try to enable.
> build_warnings=" \
> -Wall \
> +-Wdangling-reference \
> -Wdeprecated-copy \
> -Wdeprecated-copy-dtor \
> -Wduplicated-cond \
> @@ -13465,6 +13466,7 @@ build_warnings=" \
> -Wshadow=local \
> -Wstrict-null-sentinel \
> -Wsuggest-override \
> +-Wunterminated-string-initialization \
> -Wunused-but-set-parameter \
> -Wunused-but-set-variable \
> -Wunused-const-variable=1 \
> diff --git a/gdbsupport/configure b/gdbsupport/configure
> index 584a80ef825..0bc9ff1db9a 100755
> --- a/gdbsupport/configure
> +++ b/gdbsupport/configure
> @@ -14123,6 +14123,7 @@ fi
> # The options we'll try to enable.
> build_warnings=" \
> -Wall \
> +-Wdangling-reference \
> -Wdeprecated-copy \
> -Wdeprecated-copy-dtor \
> -Wduplicated-cond \
> @@ -14140,6 +14141,7 @@ build_warnings=" \
> -Wshadow=local \
> -Wstrict-null-sentinel \
> -Wsuggest-override \
> +-Wunterminated-string-initialization \
> -Wunused-but-set-parameter \
> -Wunused-but-set-variable \
> -Wunused-const-variable=1 \
> diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
> index 718ac34aa3c..3148feb740a 100644
> --- a/gdbsupport/warning.m4
> +++ b/gdbsupport/warning.m4
> @@ -38,6 +38,7 @@ fi
> # The options we'll try to enable.
> build_warnings=" \
> -Wall \
> +-Wdangling-reference \
> -Wdeprecated-copy \
> -Wdeprecated-copy-dtor \
> -Wduplicated-cond \
> @@ -55,6 +56,7 @@ build_warnings=" \
> -Wshadow=local \
> -Wstrict-null-sentinel \
> -Wsuggest-override \
> +-Wunterminated-string-initialization \
> -Wunused-but-set-parameter \
> -Wunused-but-set-variable \
> -Wunused-const-variable=1 \
>
> base-commit: 663cb9c0428068165fc98675599442163d302d41
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add two new warnings to warning.m4
2026-06-05 7:38 ` Tom de Vries
@ 2026-06-05 7:41 ` Tom de Vries
2026-06-05 20:51 ` Tom Tromey
1 sibling, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2026-06-05 7:41 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 6/5/26 9:38 AM, Tom de Vries wrote:
> On 6/3/26 9:05 PM, Tom Tromey wrote:
>> I recently learned that GCC has improved -Wdangling-reference and
>> added -Wunterminated-string-initialization. Both of these seem
>> sensible to me, so this patch adds them to warning.m4.
>>
>
> This looks fine to me.
>
> I did wonder whether we should add __attribute__((nonstring)) to
> gdb_byte, but atm it doesn't seem necessary.
>
Ah, I just read that the attribute doesn't apply to types, so nm.
Thanks,
- Tom
> Reviewed-By: Tom de Vries <tdevries@suse.de>
>
> Thanks,
> - Tom
>
>> gdb rebuilds cleanly with this in place on x86-64 Fedora 43.
>> ---
>> gdb/configure | 2 ++
>> gdbserver/configure | 2 ++
>> gdbsupport/configure | 2 ++
>> gdbsupport/warning.m4 | 2 ++
>> 4 files changed, 8 insertions(+)
>>
>> diff --git a/gdb/configure b/gdb/configure
>> index 17c95930f60..80931d10bef 100755
>> --- a/gdb/configure
>> +++ b/gdb/configure
>> @@ -31580,6 +31580,7 @@ fi
>> # The options we'll try to enable.
>> build_warnings=" \
>> -Wall \
>> +-Wdangling-reference \
>> -Wdeprecated-copy \
>> -Wdeprecated-copy-dtor \
>> -Wduplicated-cond \
>> @@ -31597,6 +31598,7 @@ build_warnings=" \
>> -Wshadow=local \
>> -Wstrict-null-sentinel \
>> -Wsuggest-override \
>> +-Wunterminated-string-initialization \
>> -Wunused-but-set-parameter \
>> -Wunused-but-set-variable \
>> -Wunused-const-variable=1 \
>> diff --git a/gdbserver/configure b/gdbserver/configure
>> index 0159da6bdf4..46faecc3a20 100755
>> --- a/gdbserver/configure
>> +++ b/gdbserver/configure
>> @@ -13448,6 +13448,7 @@ fi
>> # The options we'll try to enable.
>> build_warnings=" \
>> -Wall \
>> +-Wdangling-reference \
>> -Wdeprecated-copy \
>> -Wdeprecated-copy-dtor \
>> -Wduplicated-cond \
>> @@ -13465,6 +13466,7 @@ build_warnings=" \
>> -Wshadow=local \
>> -Wstrict-null-sentinel \
>> -Wsuggest-override \
>> +-Wunterminated-string-initialization \
>> -Wunused-but-set-parameter \
>> -Wunused-but-set-variable \
>> -Wunused-const-variable=1 \
>> diff --git a/gdbsupport/configure b/gdbsupport/configure
>> index 584a80ef825..0bc9ff1db9a 100755
>> --- a/gdbsupport/configure
>> +++ b/gdbsupport/configure
>> @@ -14123,6 +14123,7 @@ fi
>> # The options we'll try to enable.
>> build_warnings=" \
>> -Wall \
>> +-Wdangling-reference \
>> -Wdeprecated-copy \
>> -Wdeprecated-copy-dtor \
>> -Wduplicated-cond \
>> @@ -14140,6 +14141,7 @@ build_warnings=" \
>> -Wshadow=local \
>> -Wstrict-null-sentinel \
>> -Wsuggest-override \
>> +-Wunterminated-string-initialization \
>> -Wunused-but-set-parameter \
>> -Wunused-but-set-variable \
>> -Wunused-const-variable=1 \
>> diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
>> index 718ac34aa3c..3148feb740a 100644
>> --- a/gdbsupport/warning.m4
>> +++ b/gdbsupport/warning.m4
>> @@ -38,6 +38,7 @@ fi
>> # The options we'll try to enable.
>> build_warnings=" \
>> -Wall \
>> +-Wdangling-reference \
>> -Wdeprecated-copy \
>> -Wdeprecated-copy-dtor \
>> -Wduplicated-cond \
>> @@ -55,6 +56,7 @@ build_warnings=" \
>> -Wshadow=local \
>> -Wstrict-null-sentinel \
>> -Wsuggest-override \
>> +-Wunterminated-string-initialization \
>> -Wunused-but-set-parameter \
>> -Wunused-but-set-variable \
>> -Wunused-const-variable=1 \
>>
>> base-commit: 663cb9c0428068165fc98675599442163d302d41
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add two new warnings to warning.m4
2026-06-05 7:38 ` Tom de Vries
2026-06-05 7:41 ` Tom de Vries
@ 2026-06-05 20:51 ` Tom Tromey
2026-06-05 21:13 ` Tom de Vries
1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2026-06-05 20:51 UTC (permalink / raw)
To: Tom de Vries; +Cc: Tom Tromey, gdb-patches
Tom> I did wonder whether we should add __attribute__((nonstring)) to
Tom> gdb_byte, but atm it doesn't seem necessary.
Thinking about this, I wonder if we should change gdb_byte to be a
uint8_t rather than unsigned char.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add two new warnings to warning.m4
2026-06-05 20:51 ` Tom Tromey
@ 2026-06-05 21:13 ` Tom de Vries
0 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2026-06-05 21:13 UTC (permalink / raw)
To: Tom Tromey; +Cc: Tom Tromey, gdb-patches
On 6/5/26 10:51 PM, Tom Tromey wrote:
> Tom> I did wonder whether we should add __attribute__((nonstring)) to
> Tom> gdb_byte, but atm it doesn't seem necessary.
>
> Thinking about this, I wonder if we should change gdb_byte to be a
> uint8_t rather than unsigned char.
>
I suppose there can be type-based alias consequences.
Thanks,
- Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-05 21:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 19:05 [PATCH] Add two new warnings to warning.m4 Tom Tromey
2026-06-05 7:38 ` Tom de Vries
2026-06-05 7:41 ` Tom de Vries
2026-06-05 20:51 ` Tom Tromey
2026-06-05 21:13 ` 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