From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by sourceware.org (Postfix) with ESMTPS id AAC3A3858D35 for ; Tue, 30 Jun 2020 17:10:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AAC3A3858D35 Received: by mail-qt1-x844.google.com with SMTP id o38so16149311qtf.6 for ; Tue, 30 Jun 2020 10:10:34 -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=HABcWztBpge6piFXZqwfhnakZV+9t6ezkRgf/IBYuPA=; b=F55xxq/bZtnJb4LxxeftTWfmHa2dTRuxmoPhjTerPgv2gs08Yl+R7JEWDuSSIWa7Vo vgaVCCLPBfF/q+VyxP0N9SMD4XVzs6BvShbLlQlof4Nx8TorsDK8CEg0j76y9Kik0z2+ t5m4aE83AkALhCqRZkTwMR00gDSqlXMi0KMg5fWq/6T7tlxvPokAC8BARU98OJSKKdf5 voMvz7uTIE8eiDIAt6V30TQ241DyVBeRuKRXtPBf2a2SQv6ugBL3xD0cqDHm3uwYqziX 9hQHMcCpbHxOuzVWam8hDczFQdPH+BY+wxqg5RcuiYQynSbVPvWC3y+msCXkF5IVLerz dH3g== X-Gm-Message-State: AOAM530l5y1cIAkYjy1QVUWCcRJDYEcu4MC0CzWAAxKtBR2PRf5JlDg4 O77KlJMtAyotvw/L5Do1KrAGBA7mv5I= X-Google-Smtp-Source: ABdhPJy+jZOAezq6mQESSQvmz2L3ZO6mE78eUyuscorjVgLF1jx4ObmffYimSB0o5gqqiTejWe2S0Q== X-Received: by 2002:ac8:4507:: with SMTP id q7mr21600779qtn.142.1593537033646; Tue, 30 Jun 2020 10:10:33 -0700 (PDT) Received: from ?IPv6:2804:7f0:8283:20c3:e01d:4330:d5b2:db25? ([2804:7f0:8283:20c3:e01d:4330:d5b2:db25]) by smtp.gmail.com with ESMTPSA id r35sm1301741qtb.11.2020.06.30.10.10.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jun 2020 10:10:32 -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: Luis Machado Message-ID: <4b0f9611-b597-46b3-e1b2-208c26d0b91a@linaro.org> Date: Tue, 30 Jun 2020 14:10:30 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1593529380-8689-1-git-send-email-gbenson@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: Tue, 30 Jun 2020 17:10:36 -0000 Hi, On 6/30/20 12: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 > > 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" > +} > Instead of adding such pre-processing blocks, should we fix the code instead, to be more portable across compilers?