osdep: add portable C11-like alignof() macro

This commit is contained in:
wm4 2018-05-20 20:47:43 +02:00
parent af4fe28af7
commit 707b404820
1 changed files with 5 additions and 0 deletions

View File

@ -17,5 +17,10 @@
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (gnu_printf, a1, a2)))
#endif
#if __STDC_VERSION__ >= 201112L
#include <stdalign.h>
#else
#define alignof(x) (offsetof(struct {char unalign_; x u;}, u))
#endif
#endif