]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Use using in compat_x32_clock_t typedef
authorTom de Vries <tdevries@suse.de>
Mon, 13 Jul 2026 13:06:35 +0000 (15:06 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 13 Jul 2026 13:06:35 +0000 (15:06 +0200)
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 = long __attribute__ ((__aligned__ (4)));
...
which I had to revert because clang ignores the attribute in this variant.

Pedro suggested instead using:
...
using compat_x32_clock_t [[gnu::aligned (4)]] = long;
...
which does work with both clang and gcc.

[ Note that it's not a question of how the attribute is worded, this also works:
...
using compat_x32_clock_t __attribute__ ((__aligned__ (4))) = long;
...
It's just a question of where the attribute is placed. ]

Fix this by using Pedro's suggestion.

Suggested-By: Pedro Alves <pedro@palves.net>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/nat/amd64-linux-siginfo.c

index 99faccabf37aaf5a66ecfad1573ffc175b94f03c..d524cb9f80a7f880c519cc66bfb36ade2caca44a 100644 (file)
@@ -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 [[gnu::aligned (4)]] = long;
 
 struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t
 {