From 707b404820a56ca3dfa22fc5f18e68186dbae51d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 20 May 2018 20:47:43 +0200 Subject: osdep: add portable C11-like alignof() macro --- osdep/compiler.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osdep/compiler.h b/osdep/compiler.h index d25f0cd1e4..7c9f859f3a 100644 --- a/osdep/compiler.h +++ b/osdep/compiler.h @@ -17,5 +17,10 @@ #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (gnu_printf, a1, a2))) #endif +#if __STDC_VERSION__ >= 201112L +#include +#else +#define alignof(x) (offsetof(struct {char unalign_; x u;}, u)) +#endif #endif -- cgit v1.2.3