Make _Static_assert() work with GCC in older C++ standards.
GCC only activates C11 keywords in C mode, not C++ mode. This means that when targeting an older C++ standard, we cannot fall back to using _Static_assert(). In this case, do define _Static_assert() as a macro that uses a typedef'ed array. Discussed in: r322875 commit thread Reported by: Mark MIllard MFC after: 1 month
This commit is contained in:
parent
0e5f252bc7
commit
84e294dc69
|
@ -314,7 +314,7 @@
|
||||||
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
|
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
|
||||||
__has_extension(cxx_static_assert)
|
__has_extension(cxx_static_assert)
|
||||||
#define _Static_assert(x, y) static_assert(x, y)
|
#define _Static_assert(x, y) static_assert(x, y)
|
||||||
#elif __GNUC_PREREQ__(4,6)
|
#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
|
||||||
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
|
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
|
||||||
#elif defined(__COUNTER__)
|
#elif defined(__COUNTER__)
|
||||||
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
|
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
|
||||||
|
|
Loading…
Reference in New Issue