From: Dmitry V. Levin Date: Thu, 10 Nov 2016 10:29:46 +0000 (+0000) Subject: Introduce ALIGNOF macro X-Git-Tag: v4.15~149 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98b944bb66dbdb093770f7f304f7fb72d3ce8be7;p=strace Introduce ALIGNOF macro * gcc_compat.h (ALIGNOF): New macro. --- diff --git a/gcc_compat.h b/gcc_compat.h index 9e6c233f..eb5242f7 100644 --- a/gcc_compat.h +++ b/gcc_compat.h @@ -80,6 +80,12 @@ # 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