From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id BACAB385701F for ; Fri, 28 Oct 2022 11:37:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BACAB385701F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666957059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nSrq4oENtezXfUN7HuUv5tI3NXAKRrCSHF8g5Ye6bPY=; b=Xbcbtbd+iJXcHl0VMJE+SWQrZMViegiL1wcZ6NHRC8Suv39vjK0rG/BwrL8372RPdvrwV7 LiBNvXKq424DeO7w5Ix/q9IX9aSp/eXJ79H0j3LUbpuH/owmgshCc5ypmHU6KDDmdeH1hB srDomWiQLKY29ShuWuTsI1D+U2OkFlQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-484-jqX5GNyjOKuo1TS6fRu9nA-1; Fri, 28 Oct 2022 07:37:38 -0400 X-MC-Unique: jqX5GNyjOKuo1TS6fRu9nA-1 Received: by mail-wm1-f72.google.com with SMTP id o18-20020a05600c4fd200b003c6ceb1339bso3447027wmq.1 for ; Fri, 28 Oct 2022 04:37:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=NbYdgIvpY1B2u0IxFxx7qNvIH9wFymvyt7EDe+nTwnw=; b=i9NaX66e2GHpLqcrwXV2lEF2qdSvIkceRyVcw7yXATnK7to4z+ni4dcO6x+O3ZsART GAoDmYRftKCLvNDfjO0EACgFMd0/JYFbNejlPiEIzK+oQM8v3THuhHHpdkkbF54t74KZ XsAk5rCglsWY0D3Mt14vTRgC2B6/jYvVcHvkT04iJVZIUMxH9XaAhKByQjcm7VEHk3B5 oZXvIdsSb88/g7qTE0BB67fzFm1OYGezMG71rh32dildJWhqULkHxqcZ+lK2cpJUK9a6 /rGNzrJ3UFuU/GS2DWgnb9rnrsCyD7hkwroV8VIIabsYwvsUmsypakopljamJ39PSGUl I7wg== X-Gm-Message-State: ACrzQf0fQf2Pz7OF0D0EHzOXiX7e3YzyupBsOLock/Pvz1/abNyatrPQ +X7iA9YkXSOQg1weY3rIZSLrZFPD3afmKmxCjifXmObCnyKU1uzcuQMiory491XYUW+z1n098vp Vu8kdM98KG7YRknyHui+y/g== X-Received: by 2002:adf:f081:0:b0:236:5e7c:4ec2 with SMTP id n1-20020adff081000000b002365e7c4ec2mr20941319wro.641.1666957057232; Fri, 28 Oct 2022 04:37:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4lj8+nLjjsxD4yV68UM1Lk39WJUK32FgsYIWiLKIisQ5MA0CT6bRBjMGBpSllIW0mg4aWMAw== X-Received: by 2002:adf:f081:0:b0:236:5e7c:4ec2 with SMTP id n1-20020adff081000000b002365e7c4ec2mr20941312wro.641.1666957057008; Fri, 28 Oct 2022 04:37:37 -0700 (PDT) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id o7-20020a5d6847000000b00236545edc91sm3473867wrw.76.2022.10.28.04.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 04:37:36 -0700 (PDT) From: Andrew Burgess To: Bruno Larsen , gdb-patches@sourceware.org Subject: Re: [PATCH 01/11] gdb/testsuite: ignore Non-C-typedefs for gdb.cp/class2.exp In-Reply-To: <886c6c34-ff72-5c47-6e65-4722295384cc@redhat.com> References: <20221004170747.154307-1-blarsen@redhat.com> <20221004170747.154307-2-blarsen@redhat.com> <87h6zq7pyf.fsf@redhat.com> <886c6c34-ff72-5c47-6e65-4722295384cc@redhat.com> Date: Fri, 28 Oct 2022 12:37:35 +0100 Message-ID: <87ilk4ch6o.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Bruno Larsen writes: > On 26/10/2022 14:02, Andrew Burgess wrote: >> Bruno Larsen via Gdb-patches writes: >> >>> When attempting to test gdb.cp/class2.exp using clang, it fails to >>> prepare with the following error: >>> >>> 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 >>> >>> This can be silenced by adding -Wno-non-c-typedef-for-linkage. The test >>> shows no failures with this change. >>> --- >>> gdb/testsuite/gdb.cp/class2.exp | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/cla= ss2.exp >>> index 32f9dfc18a5..e1e4ad0fae6 100644 >>> --- a/gdb/testsuite/gdb.cp/class2.exp >>> +++ b/gdb/testsuite/gdb.cp/class2.exp >>> @@ -18,7 +18,7 @@ if { [skip_cplus_tests] } { return } >>> =20 >>> standard_testfile .cc >>> =20 >>> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug= c++}]} { >>> +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug= c++ additional_flags=3D-Wno-non-c-typedef-for-linkage}]} { >>> return -1 >> I worry about just adding an extra flag like this. GCC is happy enough >> as it ignores unknown arguments, but some other compiler might be >> unhappy. >> >> Additionally, with earlier versions of clang++ (I tested 9.0.1) the new >> flag isn't recognised, and actually causes the build to fail. > Good call. This flag seems to have been added by clang-11, so I'll check= =20 > for that version. >> >> I wonder if we should look to something like gdb.cp/pr9167.exp for how >> to solve this? In that script we do this: >> >> set flags [list debug c++] >> if { [test_compiler_info gcc-*] && [gcc_major_version] >=3D 10 } { >> # Work around PR gcc/101452. >> lappend flags additional_flags=3D-fno-eliminate-unused-debug-type= s >> } >> >> this might be a better model for how to add the flag. > > Looking at gcc_major_version, this looks too verbose. gcc_major_version= =20 > already checks for the given compiler, returning -1 if the compiler is=20 > not the expected one, so that code from gdb.cp/pr9167.exp could be=20 > shortened to: > > if=C2=A0 { [ gcc_major_version ] >=3D 10 } { > =C2=A0=C2=A0=C2=A0 .... > } I guess you actually need: [ gcc_major_version "gcc-*" c++ ] in order to check the C++ compiler. Thanks, Andrew > > What do you think? > > (I also think the function should be renamed, but that is a patch for=20 > another day). > > Cheers, > Bruno > >> >> Thanks, >> Andrew >>