summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNiklas Hauser <[email protected]>2020-09-26 04:24:30 +0200
committerNiklas Hauser <[email protected]>2020-10-03 20:17:36 +0200
commit78477077b418a25efa58ef0fb426d0cacb24d902 (patch)
tree1f0901bd8b21704a961584f34e86837f6ff60b0d /src/common
parent8b2c82255750488232eae72f3d5dcbacfd6227f3 (diff)
Use C++11 static_assert when available
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_compiler.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/tusb_compiler.h b/src/common/tusb_compiler.h
index 6f6aa3c39..505542078 100644
--- a/src/common/tusb_compiler.h
+++ b/src/common/tusb_compiler.h
@@ -44,8 +44,10 @@
#endif
// Compile-time Assert
-#if __STDC_VERSION__ >= 201112L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define TU_VERIFY_STATIC _Static_assert
+#elif defined (__cplusplus) && __cplusplus >= 201103L
+ #define TU_VERIFY_STATIC static_assert
#else
#define TU_VERIFY_STATIC(const_expr, _mess) enum { TU_XSTRCAT(_verify_static_, _TU_COUNTER_) = 1/(!!(const_expr)) }
#endif