]> granicus.if.org Git - strace/commitdiff
Introduce ALIGNOF macro
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 10 Nov 2016 10:29:46 +0000 (10:29 +0000)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 10 Nov 2016 19:44:49 +0000 (22:44 +0300)
* gcc_compat.h (ALIGNOF): New macro.

gcc_compat.h

index 9e6c233f099e9611416229170997069f187d4938..eb5242f77e5ee879d7b92e1f1b54004245a9a191 100644 (file)
 # define ATTRIBUTE_SENTINEL    /* empty */
 #endif
 
+#if GNUC_PREREQ(4, 1)
+# define ALIGNOF(t_)   __alignof__(t_)
+#else
+# define ALIGNOF(t_)   (sizeof(struct {char x_; t_ y_;}) - sizeof(t_))
+#endif
+
 #if GNUC_PREREQ(4, 3)
 # define ATTRIBUTE_ALLOC_SIZE(args)    __attribute__((__alloc_size__ args))
 #else