public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@linaro.org>
To: Gary Benson <gbenson@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Skip tests requiring "alignof (void)" when compiling using clang
Date: Tue, 30 Jun 2020 14:10:30 -0300	[thread overview]
Message-ID: <4b0f9611-b597-46b3-e1b2-208c26d0b91a@linaro.org> (raw)
In-Reply-To: <1593529380-8689-1-git-send-email-gbenson@redhat.com>

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?

  reply	other threads:[~2020-06-30 17:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 15:03 Gary Benson
2020-06-30 17:10 ` Luis Machado [this message]
2020-07-02 20:50   ` Pedro Alves
2020-07-02 20:49 ` Pedro Alves
2020-07-02 20:52   ` Simon Marchi
2020-07-02 21:08     ` Pedro Alves
2020-07-20 14:10   ` [PUSHED] " Gary Benson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b0f9611-b597-46b3-e1b2-208c26d0b91a@linaro.org \
    --to=luis.machado@linaro.org \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).