Skip to content

Commit

Permalink
MBED_STATIC_ASSERT: Use standard C++11/C11
Browse files Browse the repository at this point in the history
If available, we can use standard static_assert.
  • Loading branch information
kjbracey committed Jun 14, 2019
1 parent e1390fa commit 0857ef4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion platform/mbed_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ do { \
* };
* @endcode
*/
#if defined(__cplusplus) && (__cplusplus >= 201103L || __cpp_static_assert >= 200410L)
#define MBED_STRUCT_STATIC_ASSERT(expr, msg) static_assert(expr, msg)
#elif !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
#define MBED_STRUCT_STATIC_ASSERT(expr, msg) _Static_assert(expr, msg)
#else
#define MBED_STRUCT_STATIC_ASSERT(expr, msg) bool : (expr) ? 0 : -1

#endif

#endif

Expand Down

0 comments on commit 0857ef4

Please sign in to comment.