Chris Robinson 8630e8c7fc Don't try to include stdalign.h if C11 _Alignas isn't available
Some compilers will allow including stdalign.h, and even define alignas to
_Alignas, even if that C11 feature is unavailable (e.g. because it requires a
suitable -std= setting).
2014-08-16 10:17:30 -07:00

22 lines
553 B
C

#ifndef AL_ALIGN_H
#define AL_ALIGN_H
#if defined(HAVE_STDALIGN_H) && defined(HAVE_C11_ALIGNAS)
#include <stdalign.h>
#endif
#ifndef alignas
#ifdef HAVE_C11_ALIGNAS
#define alignas _Alignas
#elif defined(IN_IDE_PARSER)
/* KDevelop has problems with our align macro, so just use nothing for parsing. */
#define alignas(x)
#else
/* NOTE: Our custom ALIGN macro can't take a type name like alignas can. For
* maximum compatibility, only provide constant integer values to alignas. */
#define alignas(_x) ALIGN(_x)
#endif
#endif
#endif /* AL_ALIGN_H */