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.129.124]) by sourceware.org (Postfix) with ESMTPS id 537DF385702D for ; Wed, 26 Oct 2022 12:19:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 537DF385702D 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=1666786793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=444nrdk02yh/shc5z6u7mtC9HzMjZWQhKEhgbzrWRZU=; b=bmKYZma7hk/HDxUWPJWSRrlsP7inCQIv913PyDhFnmXXcUKCp4q+Z7mmWotXhv8ZNqUf/Q 4KRbbEkYOo0o/PC3qusLSDrgaCDdGV2/YqOGtBAQhr1fMLjk0uSUszXuKTB7Mb9LYNzyo3 13+uKjB/CBWyeCDW9/QhTvPpl9T0MRU= 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-65-WVmCl9YLNJuHeied8E51nw-1; Wed, 26 Oct 2022 08:19:52 -0400 X-MC-Unique: WVmCl9YLNJuHeied8E51nw-1 Received: by mail-wm1-f72.google.com with SMTP id h204-20020a1c21d5000000b003cf4e055442so258639wmh.1 for ; Wed, 26 Oct 2022 05:19:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=444nrdk02yh/shc5z6u7mtC9HzMjZWQhKEhgbzrWRZU=; b=WWMBXHbTITwhL6RjXIN2FuUlOUpTFeFzFuLAxryXjmPu4yhVKs0FugbQNTgbc3+Of8 ROsfJKW4hDCRDcE/cClTz/N3sSw1KYus2+Q8so62Jitou2RvvG1M3+NxW6i7fjJFD4UQ y/GfNs+J7ubYWwqNxF/RZOf8fr+uOM1QQd3nN0VD7G5eQVVnlgIdirvPMa80oHsY62AZ 5ID23PtoxonbrjDNa6925al480m2NK79q2cPf1JKWzIhkIRWeh1AneDmyOUXyD0vehCs aDOSUYCsF33qVwEA+GgFcbrA6QxnhbmlfUU1a9rHYQBXLr8yZB4h0Jo0a1aga6oJVpzW Oh5Q== X-Gm-Message-State: ACrzQf0KX3WbL9u+0QshXohCPMo7MPqS8P9l2fYhoex+Lvk2Wmj4EBag m1l3de2AAonn2swR71NYB2wfRk8/U7hHdmZyWBS0Y40ZLY16IDBWSqT8HBfajehFby12kLcVzdn eN7I3IwJW5otq8Etjep8xEQ== X-Received: by 2002:a05:600c:1c08:b0:3c6:e398:64e0 with SMTP id j8-20020a05600c1c0800b003c6e39864e0mr2289524wms.2.1666786791491; Wed, 26 Oct 2022 05:19:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lldIuD4oAZj9c2IHVEip4V3bcfpJCY82XQ7uZba7j9Mb2uNXk55Da8RyiUelLTrI8PjWPmQ== X-Received: by 2002:a05:600c:1c08:b0:3c6:e398:64e0 with SMTP id j8-20020a05600c1c0800b003c6e39864e0mr2289508wms.2.1666786791213; Wed, 26 Oct 2022 05:19:51 -0700 (PDT) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id r1-20020a0560001b8100b002366f300e57sm5132139wru.23.2022.10.26.05.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 05:19:50 -0700 (PDT) From: Andrew Burgess To: Bruno Larsen , gdb-patches@sourceware.org Subject: Re: [PATCH 02/11] gdb/testsuite: enable running gdb.cp/classes.exp with clang In-Reply-To: <20221004170747.154307-3-blarsen@redhat.com> References: <20221004170747.154307-1-blarsen@redhat.com> <20221004170747.154307-3-blarsen@redhat.com> Date: Wed, 26 Oct 2022 13:19:49 +0100 Message-ID: <87eduu7p5m.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 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 via Gdb-patches writes: > When attempting to run the gdb.cp/classes.exp test using clang++, the > test fails to prepare with -Wnon-c-typedef-for-linkage like the > previously fixed gdb.cp/class2.exp. Upon fixing this, the test shows 5 > unexpected failures. One such failures is: > > ptype/r class class_with_public_typedef > type = class class_with_public_typedef { > private: > int a; > public: > class_with_public_typedef::INT b; > > private: > typedef int INT; > } > (gdb) FAIL: gdb.cp/classes.exp: ptype class class_with_public_typedef // wrong access specifier for typedef: private > > While g++ provided the following output: > > ptype/r class class_with_public_typedef > type = class class_with_public_typedef { > private: > int a; > public: > class_with_public_typedef::INT b; > > typedef int INT; > } > (gdb) PASS: gdb.cp/classes.exp: ptype class class_with_public_typedef > > This error happens because clang does not add DW_AT_accessibility to > typedefs inside classes, and without this information GDB defaults to > assuming the typedef is private. Since there is nothing that GDB can do > about this, these tests have been set as xfails, and a clang bug has > been filed. I think it would be useful to include the bug number and URL in the commit message. I know you included this info in the comments below, which I think is also a good thing, but having it here too would be useful. > --- > gdb/testsuite/gdb.cp/classes.exp | 33 +++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp > index 7b8b315ac1f..3f3e587803c 100644 > --- a/gdb/testsuite/gdb.cp/classes.exp > +++ b/gdb/testsuite/gdb.cp/classes.exp > @@ -24,14 +24,20 @@ load_lib "cp-support.exp" > > 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}]} { My comments for the previous patch apply here too. > return -1 > } > > + > # Test ptype of class objects. Unexpected extra blank line added here. > > proc test_ptype_class_objects {} { > > + if {[test_compiler_info {clang*}]} { You should pass the correct language through to test_compiler_info, like this: if {[test_compiler_info {clang*} c++]} { otherwise you are checking the C compiler by default. When I tested this patch I only changed the C++ compiler to clang, I left the C compiler as GCC, and the tests showed as FAIL. Thanks, Andrew > + set clang_used true > + } else { > + set clang_used false > + } > # Simple type. > > cp_test_ptype_class \ > @@ -319,6 +325,12 @@ proc test_ptype_class_objects {} { > > # Classes with typedefs of different access. > > + # Clang does not add access information for typedefs in classes. > + # More information on: https://github.com/llvm/llvm-project/issues/57608 > + if {$clang_used} { > + setup_xfail "clang 57608" *-*-* > + } > + > cp_test_ptype_class \ > "class class_with_typedefs" "" "class" "class_with_typedefs" \ > { > @@ -339,6 +351,10 @@ proc test_ptype_class_objects {} { > { typedef private "typedef int private_int;" } > } > > + if {$clang_used} { > + setup_xfail "clang 57608" *-*-* > + } > + > cp_test_ptype_class \ > "class class_with_public_typedef" "" "class" \ > "class_with_public_typedef" { > @@ -346,6 +362,11 @@ proc test_ptype_class_objects {} { > { field public "class_with_public_typedef::INT b;" } > { typedef public "typedef int INT;" } > } > + > + if {$clang_used} { > + setup_xfail "clang 57608" *-*-* > + } > + > cp_test_ptype_class \ > "class class_with_protected_typedef" "" "class" \ > "class_with_protected_typedef" { > @@ -353,6 +374,11 @@ proc test_ptype_class_objects {} { > { field protected "class_with_protected_typedef::INT b;" } > { typedef protected "typedef int INT;" } > } > + > + if {$clang_used} { > + setup_xfail "clang 57608" *-*-* > + } > + > cp_test_ptype_class \ > "struct struct_with_protected_typedef" "" "struct" \ > "struct_with_protected_typedef" { > @@ -360,6 +386,11 @@ proc test_ptype_class_objects {} { > { field protected "struct_with_protected_typedef::INT b;" } > { typedef protected "typedef int INT;" } > } > + > + if {$clang_used} { > + setup_xfail "clang 57608" *-*-* > + } > + > cp_test_ptype_class \ > "struct struct_with_private_typedef" "" "struct" \ > "struct_with_private_typedef" { > -- > 2.37.3