mirror of https://github.com/ARMmbed/mbed-os.git
MBED_STRUCT_STATIC_ASSERT: Use standard C++11/C11
If available, we can use standard static_assert.pull/10837/head
parent
700410049c
commit
56a043cbd1
|
@ -24,7 +24,6 @@
|
|||
#ifndef MBED_ASSERT_H
|
||||
#define MBED_ASSERT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "mbed_preprocessor.h"
|
||||
#include "mbed_toolchain.h"
|
||||
|
||||
|
@ -125,8 +124,14 @@ 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
|
||||
#include <stdbool.h>
|
||||
#define MBED_STRUCT_STATIC_ASSERT(expr, msg) bool : (expr) ? 0 : -1
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue