|
|
|
|
@ -754,6 +754,7 @@ typedef NameData *Name; |
|
|
|
|
* about a negative width for a struct bit-field. This will not include a |
|
|
|
|
* helpful error message, but it beats not getting an error at all. |
|
|
|
|
*/ |
|
|
|
|
#ifndef __cplusplus |
|
|
|
|
#ifdef HAVE__STATIC_ASSERT |
|
|
|
|
#define StaticAssertStmt(condition, errmessage) \ |
|
|
|
|
do { _Static_assert(condition, errmessage); } while(0) |
|
|
|
|
@ -765,6 +766,19 @@ typedef NameData *Name; |
|
|
|
|
#define StaticAssertExpr(condition, errmessage) \ |
|
|
|
|
StaticAssertStmt(condition, errmessage) |
|
|
|
|
#endif /* HAVE__STATIC_ASSERT */ |
|
|
|
|
#else /* C++ */ |
|
|
|
|
#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410 |
|
|
|
|
#define StaticAssertStmt(condition, errmessage) \ |
|
|
|
|
static_assert(condition, errmessage) |
|
|
|
|
#define StaticAssertExpr(condition, errmessage) \ |
|
|
|
|
StaticAssertStmt(condition, errmessage) |
|
|
|
|
#else |
|
|
|
|
#define StaticAssertStmt(condition, errmessage) \ |
|
|
|
|
do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0) |
|
|
|
|
#define StaticAssertExpr(condition, errmessage) \ |
|
|
|
|
({ StaticAssertStmt(condition, errmessage); }) |
|
|
|
|
#endif |
|
|
|
|
#endif /* C++ */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|