blob: a8dff7db0d4bfef3ec7f622775a5ff9f3f6024df [file] [log] [blame]
// Definitions of helper macros for tests of flexible array members.
#if __cplusplus < 201102L
# define _CAT(x, y) x ## y
# define CAT(x, y) _CAT (x, y)
// Generate a struct with a unique name containing a bitfield
// of size that must evaluate to a non-zero value, otherwise
// generate a compiler error.
# define ASSERT(expr) \
struct CAT (FAM_Assert, __LINE__) { unsigned asrt: 0 != (expr); }
// In C++ 11 and beyond, use static_assert.
# define ASSERT(expr) static_assert (expr, #expr)
// Macro to verify that a flexible array member is allocated
// at the very end of the containing struct.
#define ASSERT_AT_END(T, m) \
ASSERT (__builtin_offsetof (T, m) == sizeof (T))
typedef __SIZE_TYPE__ size_t;