From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7862) id 3F191386EC0C; Fri, 11 Nov 2022 09:17:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F191386EC0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668158227; bh=gxziQPh1nj1L/ap3VA9eMje4xi+LH8/Rp0e5M9AW3/s=; h=From:To:Subject:Date:From; b=OzkS1brxAMTkbiuIiC3P2yxThz/9WIsXzBdAnIygXhlcVSjaWlVOJrbtZqQbv2Yl2 AwGq3tIDSLgFgLoAJSNsfgbwAsyMkuutIHDKZI3LT8ZGYzT+F+TtKPXPD6IKDkq418 JKgD/HMNOxXJkBky13MN8XYjomHGhKL5kzNBC0rg= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Bruno Larsen To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: ignore Non-C-typedefs for gdb.cp/class2.exp X-Act-Checkin: binutils-gdb X-Git-Author: Bruno Larsen X-Git-Refname: refs/heads/master X-Git-Oldrev: b60f6a628897335a857c1e0100db0a4724159c45 X-Git-Newrev: 9e9ffe8ee6c986e6788ad08b5635091e1f49b376 Message-Id: <20221111091707.3F191386EC0C@sourceware.org> Date: Fri, 11 Nov 2022 09:17:07 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D9e9ffe8ee6c9= 86e6788ad08b5635091e1f49b376 commit 9e9ffe8ee6c986e6788ad08b5635091e1f49b376 Author: Bruno Larsen Date: Wed Sep 7 09:50:21 2022 +0200 gdb/testsuite: ignore Non-C-typedefs for gdb.cp/class2.exp =20 When attempting to test gdb.cp/class2.exp using Clang, it fails to prepare with the following error: =20 Executing on host: clang++ -fdiagnostics-color=3Dnever -Wno-unknown-= warning-option -c -g -o /home/blarsen/Documents/fsf_build/gdb/testsuite/ou= tputs/gdb.cp/class2/class20.o /home/blarsen/Documents/fsf_build/gdb/testsui= te/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc (timeout =3D 300) builtin_spawn -ignore SIGHUP clang++ -fdiagnostics-color=3Dnever -Wno-u= nknown-warning-option -c -g -o /home/blarsen/Documents/fsf_build/gdb/testsu= ite/outputs/gdb.cp/class2/class20.o /home/blarsen/Documents/fsf_build/gdb/t= estsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/g= db/testsuite/gdb.cp/class2.cc:53:14: warning: anonymous non-C-compatible ty= pe given name for linkage purposes by typedef declaration; add a tag name h= ere [-Wnon-c-typedef-for-linkage] typedef class { ^ Dbase /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/g= db/testsuite/gdb.cp/class2.cc:54:2: note: type is not C-compatible due to t= his member declaration public: ^~~~~~~ /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/g= db/testsuite/gdb.cp/class2.cc:58:3: note: type is given name 'Dbase' for li= nkage purposes by this typedef declaration } Dbase; ^ 1 warning generated. gdb compile failed, /home/blarsen/Documents/fsf_build/gdb/testsuite/../= ../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:53:14: warning: anonymous= non-C-compatible type given name for linkage purposes by typedef declarati= on; add a tag name here [-Wnon-c-typedef-for-linkage] typedef class { ^ Dbase /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/g= db/testsuite/gdb.cp/class2.cc:54:2: note: type is not C-compatible due to t= his member declaration public: ^~~~~~~ /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/g= db/testsuite/gdb.cp/class2.cc:58:3: note: type is given name 'Dbase' for li= nkage purposes by this typedef declaration } Dbase; ^ 1 warning generated. UNTESTED: gdb.cp/class2.exp: failed to prepare =20 This can be silenced by adding -Wno-non-c-typedef-for-linkage for Clang 11 or later. The test shows no failures with this change. =20 Approved-by: Tom Tromey Diff: --- gdb/testsuite/gdb.cp/class2.exp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.= exp index 32f9dfc18a5..cc192b6de64 100644 --- a/gdb/testsuite/gdb.cp/class2.exp +++ b/gdb/testsuite/gdb.cp/class2.exp @@ -18,7 +18,14 @@ if { [skip_cplus_tests] } { return } =20 standard_testfile .cc =20 -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++= }]} { +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 } { + lappend flags additional_flags=3D-Wno-non-c-typedef-for-linkage +} + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { return -1 }