From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id DF92D386102B for ; Mon, 20 Jul 2020 14:10:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DF92D386102B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-7-GilL3O3NMtGm7w9occi0vQ-1; Mon, 20 Jul 2020 10:10:35 -0400 X-MC-Unique: GilL3O3NMtGm7w9occi0vQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D26B80183C; Mon, 20 Jul 2020 14:10:34 +0000 (UTC) Received: from blade.nx (ovpn-114-202.ams2.redhat.com [10.36.114.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEA2676214; Mon, 20 Jul 2020 14:10:33 +0000 (UTC) Received: from blade.com (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 37FE2816CCA9; Mon, 20 Jul 2020 15:10:32 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Cc: Pedro Alves , Luis Machado , Simon Marchi Subject: [PUSHED] Skip tests requiring "alignof (void)" when compiling using clang Date: Mon, 20 Jul 2020 15:10:29 +0100 Message-Id: <1595254229-20136-1-git-send-email-gbenson@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-13.8 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2020 14:10:39 -0000 Hi all, Thanks for the reviews. This is the version that I pushed. The last part isn't exactly as Pedro suggested, so I hope it's ok! Cheers, Gary -- As an extension, GCC allows void pointer arithmetic, with sizeof(void) and alignof(void) both 1. GDB supports this extension, but clang does not, and fails to compile the generated output of gdb.cp/align.exp with the following error: gdb compile failed, /gdbtest/build/gdb/testsuite/outputs/gdb.cp/align/align.cc:28:23: error: invalid application of 'alignof' to an incomplete type 'void' unsigned a_void = alignof (void); ^ ~~~~~~ 1 error generated. This commit adds preprocessor conditionals to the generated output, to omit the unsupported code when using clang, and supplies the expected value so the test can complete. gdb/testsuite/ChangeLog: * gdb.cp/align.exp: Fix "alignof (void)" tests when compiling with clang. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.cp/align.exp | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.cp/align.exp b/gdb/testsuite/gdb.cp/align.exp index 0905a27..4894de0 100644 --- a/gdb/testsuite/gdb.cp/align.exp +++ b/gdb/testsuite/gdb.cp/align.exp @@ -80,7 +80,9 @@ puts $outfile { unsigned a_int3 = alignof (int[3]); +#if !defined (__clang__) unsigned a_void = alignof (void); +#endif struct base { char c; }; struct derived : public virtual base { int i; }; @@ -170,5 +172,14 @@ foreach type $typelist { set expected [get_integer_valueof a_int3 0] gdb_test "print alignof(int\[3\])" " = $expected" -set expected [get_integer_valueof a_void 0] + +# As an extension, GCC allows void pointer arithmetic, with +# sizeof(void) and alignof(void) both 1. This test checks +# GDB's support of GCC's extension. +if [test_compiler_info clang*] { + # Clang doesn't support GCC's extension. + set expected 1 +} else { + set expected [get_integer_valueof a_void 0] +} gdb_test "print alignof(void)" " = $expected" -- 1.8.3.1