ext/fiddle/fiddle.h in fiddle-1.1.1 vs ext/fiddle/fiddle.h in fiddle-1.1.2

- old
+ new

@@ -116,18 +116,19 @@ #define TYPE_USHORT -TYPE_SHORT #define TYPE_INT 4 #define TYPE_UINT -TYPE_INT #define TYPE_LONG 5 #define TYPE_ULONG -TYPE_LONG -#if HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG #define TYPE_LONG_LONG 6 #define TYPE_ULONG_LONG -TYPE_LONG_LONG #endif #define TYPE_FLOAT 7 #define TYPE_DOUBLE 8 #define TYPE_VARIADIC 9 #define TYPE_CONST_STRING 10 +#define TYPE_BOOL 11 #define TYPE_INT8_T TYPE_CHAR #define TYPE_UINT8_T -TYPE_INT8_T #if SIZEOF_SHORT == 2 @@ -194,10 +195,23 @@ # define TYPE_INTPTR_T TYPE_LONG_LONG # endif #endif #define TYPE_UINTPTR_T (-TYPE_INTPTR_T) -#define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x) +/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. + clang versions < 8.0.0 have the same bug. */ +#if defined(HAVE__ALIGNOF) +# /* Autoconf detected availability of a sane `_Alignof()`. */ +# define ALIGN_OF(type) RB_GNUC_EXTENSION(_Alignof(type)) +#elif (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112 \ + || (defined(__GNUC__) && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ + && !defined(__clang__)) \ + || (defined(__clang__) && __clang_major__ < 8)) +# define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x) +#else +# define ALIGN_OF(type) _Alignof(type) +#endif #define ALIGN_VOIDP ALIGN_OF(void*) #define ALIGN_CHAR ALIGN_OF(char) #define ALIGN_SHORT ALIGN_OF(short) #define ALIGN_INT ALIGN_OF(int)