summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandre Perrin <[email protected]>2022-02-23 18:27:52 +0100
committerAlexandre Perrin <[email protected]>2022-02-23 18:27:52 +0100
commit81e33477ea2d2a4f056d8d9c4cacfbbd7a4bc8e8 (patch)
treed317b0d487d21c7c8876d72b886e877f16840143 /src
parentfa895ed3dc46d5aa5e11b19ff07beb6fcfc62655 (diff)
Fix CPP compilation with IAR
IAR defines __STDC_VERSION__ in cpp as well. Which causes TU_VERIFY_STATIC to be defined as _Static_assert instead of cpp's static_assert. This reorders __cplusplus__ to be first, then to fallback to __STDC_VERSION__ if not CPP.
Diffstat (limited to 'src')
-rw-r--r--src/common/tusb_compiler.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/tusb_compiler.h b/src/common/tusb_compiler.h
index 38e6a16d0..93af44115 100644
--- a/src/common/tusb_compiler.h
+++ b/src/common/tusb_compiler.h
@@ -51,10 +51,10 @@
#endif
// Compile-time Assert
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
- #define TU_VERIFY_STATIC _Static_assert
-#elif defined (__cplusplus) && __cplusplus >= 201103L
+#if defined (__cplusplus) && __cplusplus >= 201103L
#define TU_VERIFY_STATIC static_assert
+#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+ #define TU_VERIFY_STATIC _Static_assert
#elif defined(__CCRX__)
#define TU_VERIFY_STATIC(const_expr, _mess) typedef char TU_XSTRCAT(Line, __LINE__)[(const_expr) ? 1 : 0];
#else