[binutils-gdb] [gdb/testsuite] Use Wno-non-c-typedef-for-linkage for gcc 16
Tom de Vries via Gdb-cvs <[email protected]> Sat, 30 May 2026 12:46:37 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=44df4c640694765fc028bdb0c64d346638466eab commit 44df4c640694765fc028bdb0c64d346638466eab Author: Tom de Vries <[email protected]> Date: Sat May 30 14:46:22 2026 +0200 [gdb/testsuite] Use Wno-non-c-typedef-for-linkage for gcc 16 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. Reviewed-By: Keith Seitz <[email protected]> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34187 Diff: --- gdb/testsuite/gdb.cp/class2.exp | 8 +++++--- gdb/testsuite/gdb.cp/classes.exp | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.exp index 705f51ac3e0..0d434fde174 100644 --- a/gdb/testsuite/gdb.cp/class2.exp +++ b/gdb/testsuite/gdb.cp/class2.exp @@ -19,9 +19,11 @@ require allow_cplus_tests 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 } { +# When using recent Clangs/GCCs, this test fails to compile without this +# warning being disabled. However, older Clangs/GCCs fail to recognize the +# flag. +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]} {