Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/ext/flexary.h @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// 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); } #else // In C++ 11 and beyond, use static_assert. # define ASSERT(expr) static_assert (expr, #expr) #endif // 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;