From a2ab17a7824a77450c07422854974607fe81e44a Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 27 Apr 2017 16:45:22 -0400 Subject: [PATCH] libCom: STATIC_ASSERT use c++11 static_assert when possible --- src/libCom/osi/epicsAssert.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libCom/osi/epicsAssert.h b/src/libCom/osi/epicsAssert.h index e90ec9a7b..1889d642a 100644 --- a/src/libCom/osi/epicsAssert.h +++ b/src/libCom/osi/epicsAssert.h @@ -43,12 +43,15 @@ epicsShareFunc void epicsAssert (const char *pFile, const unsigned line, /* Compile-time checks */ +#if __cplusplus>=201103L +#define STATIC_ASSERT(expr) static_assert(expr, #expr) +#else #define STATIC_JOIN(x, y) STATIC_JOIN2(x, y) #define STATIC_JOIN2(x, y) x ## y #define STATIC_ASSERT(expr) \ typedef int STATIC_JOIN(static_assert_failed_at_line_, __LINE__) \ [ (expr) ? 1 : -1 ] - +#endif #ifdef __cplusplus }