From e278f8b7d9456cb7d051da06a4b011b9568831dc Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sun, 4 Nov 2012 19:56:34 +0100 Subject: score: Support static_assert and _Static_assert --- cpukit/score/include/rtems/score/basedefs.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h index 1f8660cb9b..8239994c03 100644 --- a/cpukit/score/include/rtems/score/basedefs.h +++ b/cpukit/score/include/rtems/score/basedefs.h @@ -163,8 +163,16 @@ #define RTEMS_COMPILER_DEPRECATED_ATTRIBUTE #endif -#define RTEMS_STATIC_ASSERT(cond, msg) \ - typedef int rtems_static_assert_ ## msg [(cond) ? 1 : -1] +#if __cplusplus >= 201103L + #define RTEMS_STATIC_ASSERT(cond, msg) \ + static_assert(cond, # msg) +#elif __STDC_VERSION__ >= 201112L + #define RTEMS_STATIC_ASSERT(cond, msg) \ + _Static_assert(cond, # msg) +#else + #define RTEMS_STATIC_ASSERT(cond, msg) \ + typedef int rtems_static_assert_ ## msg [(cond) ? 1 : -1] +#endif #ifndef ASM #ifdef RTEMS_DEPRECATED_TYPES -- cgit v1.2.3