Skip to content

Commit 81e3347

Browse files
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.
1 parent fa895ed commit 81e3347

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/common/tusb_compiler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
#endif
5252

5353
// Compile-time Assert
54-
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
55-
#define TU_VERIFY_STATIC _Static_assert
56-
#elif defined (__cplusplus) && __cplusplus >= 201103L
54+
#if defined (__cplusplus) && __cplusplus >= 201103L
5755
#define TU_VERIFY_STATIC static_assert
56+
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
57+
#define TU_VERIFY_STATIC _Static_assert
5858
#elif defined(__CCRX__)
5959
#define TU_VERIFY_STATIC(const_expr, _mess) typedef char TU_XSTRCAT(Line, __LINE__)[(const_expr) ? 1 : 0];
6060
#else

0 commit comments

Comments
 (0)