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 8357C382EA3C for ; Thu, 27 Oct 2022 08:37:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8357C382EA3C 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=1666859839; 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=h7j8QDSZ1uF/QTv3MSVl+dVw+XusV7r0yhvg+TvW8wo=; b=RngI3/VjlFMd8VhXbSqYygFw8WMadX9oQJVlm8DMPeecpEcAHThg5WJ6wtNFXljT76C6h5 tBzt9c0WZ/ZmIVDt073ybHGvJ/1/vtgP5gbSn7otnbO2o1ddGBaLksz3U9BWus5s8d6eh3 P1VXONnjHAzmlyBW8alUs1gO35HPvuE= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-158-EafJQdXVOo2-aKii2czmfw-1; Thu, 27 Oct 2022 04:37:16 -0400 X-MC-Unique: EafJQdXVOo2-aKii2czmfw-1 Received: by mail-ej1-f72.google.com with SMTP id hc43-20020a17090716ab00b0078e28567ffbso580591ejc.15 for ; Thu, 27 Oct 2022 01:37:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h7j8QDSZ1uF/QTv3MSVl+dVw+XusV7r0yhvg+TvW8wo=; b=GXLN5YlCV2JHr8nWakAeJqmEwnZNFjd4PdZ65s622F4ue9IEwoiopR5AQFNQra6ukG Etw0fGvLsj2omiPcJyEbHCD//3kDlzdfAS94FW+QrBT55g0F1VsGC7URvFfeEIAMGXBa 87KiIe3yKw4ui0+jU/9wizHZSe1NUp6iS5Pjdb5ziQOjdKcUCsNCYwrj4fil2HKE8IU7 C3SCsCijaWa9CDvKYiFN8HOb6maHYMeoTHR1wFUr30aFOnSbj8cGv9oFPYdy5ItHmiWd XOBe/6Jm74lK3pwsbO5a7YJONa0sqvaZLZgz6eoHNzo7kgFUMeXJgBrXthpoksVDGOsA E0/A== X-Gm-Message-State: ACrzQf3s4iyQjGbHR3ThuF/5ih9LQ5MTHRkk1e5H2kLhyb5SE8eNxj2U 269G1Nv3FHhsDh98rM2TcO4n92hNIAR16Iseo5NrvaXKORY0h8BpBhcS0uDKEq0LbB/46Ao+j14 h1VCP02SBKZCexpFvrQF/Tw== X-Received: by 2002:a17:906:5d04:b0:77f:ca9f:33d1 with SMTP id g4-20020a1709065d0400b0077fca9f33d1mr41167698ejt.526.1666859834145; Thu, 27 Oct 2022 01:37:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IeNXDOkOgSm20Vkwr5EIX2+aQ9hOLSbia4Vk9UaYVGlycCWjwtrdyYqqxp1Gi1SMiF+HkTw== X-Received: by 2002:a17:907:7f07:b0:779:7f94:d259 with SMTP id qf7-20020a1709077f0700b007797f94d259mr41238198ejc.525.1666859823759; Thu, 27 Oct 2022 01:37:03 -0700 (PDT) Received: from [10.43.2.105] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id m2-20020a50ef02000000b00461c375d88csm562037eds.97.2022.10.27.01.37.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Oct 2022 01:37:03 -0700 (PDT) Message-ID: <886c6c34-ff72-5c47-6e65-4722295384cc@redhat.com> Date: Thu, 27 Oct 2022 10:37:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 01/11] gdb/testsuite: ignore Non-C-typedefs for gdb.cp/class2.exp To: Andrew Burgess , gdb-patches@sourceware.org References: <20221004170747.154307-1-blarsen@redhat.com> <20221004170747.154307-2-blarsen@redhat.com> <87h6zq7pyf.fsf@redhat.com> From: Bruno Larsen In-Reply-To: <87h6zq7pyf.fsf@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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: 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=never -Wno-unknown-warning-option -c -g -o /home/blarsen/Documents/fsf_build/gdb/testsuite/outputs/gdb.cp/class2/class20.o /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc (timeout = 300) >> builtin_spawn -ignore SIGHUP clang++ -fdiagnostics-color=never -Wno-unknown-warning-option -c -g -o /home/blarsen/Documents/fsf_build/gdb/testsuite/outputs/gdb.cp/class2/class20.o /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc >> /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 declaration; add a tag name here [-Wnon-c-typedef-for-linkage] >> typedef class { >> ^ >> Dbase >> /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:54:2: note: type is not C-compatible due to this member declaration >> public: >> ^~~~~~~ >> /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:58:3: note: type is given name 'Dbase' for linkage 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 declaration; add a tag name here [-Wnon-c-typedef-for-linkage] >> typedef class { >> ^ >> Dbase >> /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:54:2: note: type is not C-compatible due to this member declaration >> public: >> ^~~~~~~ >> /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:58:3: note: type is given name 'Dbase' for linkage 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/class2.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 } >> >> standard_testfile .cc >> >> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { >> +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++ additional_flags=-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 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] >= 10 } { > # Work around PR gcc/101452. > lappend flags additional_flags=-fno-eliminate-unused-debug-types > } > > this might be a better model for how to add the flag. Looking at gcc_major_version, this looks too verbose. gcc_major_version already checks for the given compiler, returning -1 if the compiler is not the expected one, so that code from gdb.cp/pr9167.exp could be shortened to: if  { [ gcc_major_version ] >= 10 } {     .... } What do you think? (I also think the function should be renamed, but that is a patch for another day). Cheers, Bruno > > Thanks, > Andrew >