From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/2] [gdb/testsuite] Use Wno-non-c-typedef-for-linkage for gcc 16
Date: Fri, 29 May 2026 14:51:49 +0200 [thread overview]
Message-ID: <20260529125149.2027857-3-tdevries@suse.de> (raw)
In-Reply-To: <20260529125149.2027857-1-tdevries@suse.de>
With gcc 16 and test-case gdb.cp/classes.exp I run into:
...
classes.cc:440:15: warning: anonymous non-C-compatible type given name for linkage purposes by 'typedef' declaration [-Wnon-c-typedef-for-linkage]^M
440 | typedef class {^M
| ^^M
| DynamicBase2^M
classes.cc:443:15: note: type is not C-compatible because it contains 'virtual int DynamicBase2::get_x()' declaration^M
443 | virtual int get_x () { return x; }^M
| ^~~~~^M
...
Fix this by applying Wno-non-c-typedef-for-linkage, which is already done for
clang.
Likewise for gdb.cp/class2.exp.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34187
---
gdb/testsuite/gdb.cp/class2.exp | 3 ++-
gdb/testsuite/gdb.cp/classes.exp | 9 ++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.exp
index 705f51ac3e0..aa2a04467f4 100644
--- a/gdb/testsuite/gdb.cp/class2.exp
+++ b/gdb/testsuite/gdb.cp/class2.exp
@@ -21,7 +21,8 @@ standard_testfile .cc
set flags [list debug c++]
# When using recent Clangs, this test fails to compile without this warning
# being disabled. However, older Clangs fail to recognize the flag.
-if { [gcc_major_version "clang-*" "c++"] > 10 } {
+if { [gcc_major_version "clang-*" "c++"] > 10
+ || [gcc_major_version "gcc-*" "c++"] >= 16} {
lappend flags additional_flags=-Wno-non-c-typedef-for-linkage
}
diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index 71ce810adad..d2fb7c0c14c 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -25,12 +25,15 @@ load_lib "cp-support.exp"
standard_testfile .cc
set flags [list debug c++]
+
set clang_used false
if { [test_compiler_info "clang-*" "c++"] } {
set clang_used true
- if { [gcc_major_version "clang-*" "c++"] >= 11} {
- lappend flags additional_flags=-Wno-non-c-typedef-for-linkage
- }
+}
+
+if { [gcc_major_version "clang-*" "c++"] >= 11
+ || [gcc_major_version "gcc-*" "c++"] >= 16} {
+ lappend flags additional_flags=-Wno-non-c-typedef-for-linkage
}
if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
--
2.51.0
next prev parent reply other threads:[~2026-05-29 12:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 12:51 [PATCH 0/2] [gdb/testsuite] Handle " Tom de Vries
2026-05-29 12:51 ` [PATCH 1/2] [gdb/testsuite] Fix ambiguous operator warning Tom de Vries
2026-05-29 16:23 ` Keith Seitz
2026-05-29 12:51 ` Tom de Vries [this message]
2026-05-29 16:25 ` [PATCH 2/2] [gdb/testsuite] Use Wno-non-c-typedef-for-linkage for gcc 16 Keith Seitz
2026-05-30 8:49 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260529125149.2027857-3-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox