Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lancelot SIX <lancelot.six@amd.com>
To: Tom de Vries <tdevries@suse.de>
Cc: Andrew Burgess <aburgess@redhat.com>, Tom Tromey <tom@tromey.com>,
	Simon Marchi <simark@simark.ca>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [gdb] Use using instead of typedef
Date: Fri, 12 Jun 2026 12:00:21 +0100	[thread overview]
Message-ID: <jcv62vrdrppyss76yxsdjnxatlhpaf3srcgwip7a3pnofqq6xs@5ze4ejackro7> (raw)
In-Reply-To: <9b6adbb6-7d5c-4125-a77a-dfd393766beb@suse.de>

On Thu, Jun 11, 2026 at 08:57:48AM +0200, Tom de Vries wrote:
> On 6/10/26 5:50 PM, Andrew Burgess wrote:
> > Tom Tromey <tom@tromey.com> writes:
> > 
> > > > > > > > "Tom" == Tom de Vries <tdevries@suse.de> writes:
> > > 
> > > Tom> After commit 1eed06ae51d ("[gdbsupport] Use using instead of typedef in
> > > Tom> next_iterator") I wondered if I could do something similar using sed.
> > > 
> > > First of all, thanks for doing this.
> > > 
> > > I don't know how anyone else feels but I normally find 'using' simpler
> > > to understand, I suppose because I don't need to try to decode the right
> > > hand side to find the name being defined -- it's right there before the
> > > '='.
> > > 
> > > So, I am in favor of this patch.  I'm going to approve it but I think
> > > you should wait for a bit before checking it in, in case someone wants
> > > to object.
> > 
> > I also think this is a good idea.
> > 
> > +1
> > 
> 
> Thanks all for the upvotes.  I've pushed this.
> 
> Thanks,
> - Toma

Hi Tom, FYI when building with clang on ubuntu (clang 18.1.3), I see the
following failure:

    ../../gdb/nat/amd64-linux-siginfo.c:610:16: error: static assertion failed due to requirement 'sizeof(compat_x32_siginfo_t) == 128'
      610 | static_assert (sizeof (compat_x32_siginfo_t) == GDB_SI_SIZE);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../gdb/nat/amd64-linux-siginfo.c:610:46: note: expression evaluates to '136 == 128'
      610 | static_assert (sizeof (compat_x32_siginfo_t) == GDB_SI_SIZE);
          |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

I traced this back to this part of your patch:

    --- a/gdb/nat/amd64-linux-siginfo.c
    +++ b/gdb/nat/amd64-linux-siginfo.c
    @@ -203,7 +203,7 @@ struct compat_siginfo_t
     };
     
     /* For x32, clock_t in _sigchld is 64bit aligned at 4 bytes.  */
    -typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t;
    +using compat_x32_clock_t = long __attribute__ ((__aligned__ (4)));
     
     struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t
     {

I do not think this part is wrong, it seems that clang miss-behaves and
drops the attribute.

Should we keep typedef just for this case just to keep compatibility
with other compilers?

Best,
Lancelot.

> 
> 
> > Thanks,
> > Andrew
> > 
> 

  reply	other threads:[~2026-06-12 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 16:22 Tom de Vries
2026-06-09 16:48 ` Tom Tromey
2026-06-09 22:37   ` Simon Marchi
2026-06-10 15:50   ` Andrew Burgess
2026-06-11  6:57     ` Tom de Vries
2026-06-12 11:00       ` Lancelot SIX [this message]
2026-06-12 11:01         ` Tom de Vries
2026-06-12 11:12           ` Lancelot SIX

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=jcv62vrdrppyss76yxsdjnxatlhpaf3srcgwip7a3pnofqq6xs@5ze4ejackro7 \
    --to=lancelot.six@amd.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tdevries@suse.de \
    --cc=tom@tromey.com \
    /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