[binutils-gdb] [gdb] Use using in compat_x32_clock_t typedef

Tom de Vries via Gdb-cvs <[email protected]> Mon, 13 Jul 2026 13:07:44 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db2e06335b120=
ffee7664a65dde859d2bfa4e4358

commit b2e06335b120ffee7664a65dde859d2bfa4e4358
Author: Tom de Vries <[email protected]>
Date:   Mon Jul 13 15:06:35 2026 +0200

    [gdb] Use using in compat_x32_clock_t typedef
   =20
    In commit 6c85ef111b0 ("[gdb] Use using instead of typedef"), I did:
    ...
    -typedef long __attribute__ ((__aligned__ (4))) compat_x32_clock_t;
    +using compat_x32_clock_t =3D long __attribute__ ((__aligned__ (4)));
    ...
    which I had to revert because clang ignores the attribute in this varia=
nt.
   =20
    Pedro suggested instead using:
    ...
    using compat_x32_clock_t [[gnu::aligned (4)]] =3D long;
    ...
    which does work with both clang and gcc.
   =20
    [ Note that it's not a question of how the attribute is worded, this al=
so works:
    ...
    using compat_x32_clock_t __attribute__ ((__aligned__ (4))) =3D long;
    ...
    It's just a question of where the attribute is placed. ]
   =20
    Fix this by using Pedro's suggestion.
   =20
    Suggested-By: Pedro Alves <[email protected]>
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/nat/amd64-linux-siginfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index 99faccabf37..d524cb9f80a 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -203,7 +203,7 @@ struct compat_siginfo_t
 };
=20
 /* 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 [[gnu::aligned (4)]] =3D long;
=20
 struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t
 {