From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by sourceware.org (Postfix) with ESMTPS id EBCE23875464 for ; Thu, 2 Jul 2020 20:49:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EBCE23875464 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f68.google.com with SMTP id a6so30028152wrm.4 for ; Thu, 02 Jul 2020 13:49:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=91haNx7BXcH+gkbF0qb8ag0RI52uTYH+idAMP2O7AMA=; b=E2VcgX1WxzG1/1CyyKnP9tOZ+TDFtNibjoyXrPgg0DgIVOluvGr1lSlxoV7yjunwkx Rc5YIgEOGdZVFZD4j6PfTCRoLGMYv6N8KYvSemvitE0MhI2gcaXIVg6yB+yFBK+UkDAO EFYkxLrOz6kEkYrpKfeaHeKjNJfUTR/YkdbAXcQpbAA/thXayk/v0pGQ0cTVNHL0Pr2b 5ACJ5dpIZKLoOOUGZRrk+M0QR2U/cNfoRm/TCvA5paIJmKjs3YxMN+3B26QZScfyEvdd OcN9calVxKrXc2jExcK1wLev8+coV0f3b0XC7aSHhpYI3LZKHbMuzbbWQH9dELiFgUo6 o5Ww== X-Gm-Message-State: AOAM533GbZ/2WcLanMB+1hrLd8P5jqRFGWDsWj4WkCrzUA8l50/MGOAq qCo6wv2WxFmwMrYY+YivcR076az5NstHzA== X-Google-Smtp-Source: ABdhPJx9PZpEj2G01+2hIdaNXa8fKX/cNVgINvsYvwCg7ViFCtsyucBUAHykXU9DiZpE0wUOVuzhUw== X-Received: by 2002:a5d:4845:: with SMTP id n5mr32361337wrs.353.1593722971137; Thu, 02 Jul 2020 13:49:31 -0700 (PDT) Received: from ?IPv6:2001:8a0:f922:c400:56ee:75ff:fe8d:232b? ([2001:8a0:f922:c400:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id f13sm11199915wmb.33.2020.07.02.13.49.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jul 2020 13:49:30 -0700 (PDT) Subject: Re: [PATCH] Skip tests requiring "alignof (void)" when compiling using clang To: Gary Benson , gdb-patches@sourceware.org References: <1593529380-8689-1-git-send-email-gbenson@redhat.com> From: Pedro Alves Message-ID: Date: Thu, 2 Jul 2020 21:49:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1593529380-8689-1-git-send-email-gbenson@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: Thu, 02 Jul 2020 20:49:34 -0000 On 6/30/20 4:03 PM, Gary Benson via Gdb-patches wrote: > Hi all, > > Clang fails to compile the generated output of gdb.cp/align.exp with > the following error: invalid application of 'alignof' to an incomplete > type 'void'. This patch adds preprocessor conditionals to the > generated output, to avoid the offending code, and causes the tests > that require it to be skipped. > > Checked on Fedora 31 x86_64, GCC and clang. Ok to commit? > > Cheers, > Gary > > -- > gdb/testsuite/ChangeLog: > > * gdb.cp/align.exp: Skip tests requiring "alignof (void)" > when compiling using clang. > --- > gdb/testsuite/ChangeLog | 5 +++++ > gdb/testsuite/gdb.cp/align.exp | 9 +++++++-- > 2 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/gdb/testsuite/gdb.cp/align.exp b/gdb/testsuite/gdb.cp/align.exp > index 0905a27..65ffb3b 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 Space before parens: #if !defined (__clang__) Or: #ifndef __clang__ > > struct base { char c; }; > struct derived : public virtual base { int i; }; > @@ -170,5 +172,8 @@ 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] > -gdb_test "print alignof(void)" " = $expected" > + > +if ![test_compiler_info clang*] { > + set expected [get_integer_valueof a_void 0] > + gdb_test "print alignof(void)" " = $expected" > +} I think this should still test GDB's support. And a comment would be helpful. Like: # As an extension, GCC allows void pointer arithmetic, with # sizeof(void) and alignof(void) both 1. GDB supports GCC's # extension. Clang does not. if ![test_compiler_info clang*] { set expected [get_integer_valueof a_void 0] gdb_test "print alignof(void)" " = $expected" } else { gdb_test "print alignof(void)" " = 1" } OK with those changes, and the commit log adjusted accordingly. Pedro Alves