File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -124,8 +124,14 @@ do { \
124
124
* };
125
125
* @endcode
126
126
*/
127
- #define MBED_STRUCT_STATIC_ASSERT (expr, msg ) int : (expr) ? 0 : -1
128
-
127
+ #if defined(__cplusplus) && (__cplusplus >= 201103L || __cpp_static_assert >= 200410L)
128
+ #define MBED_STRUCT_STATIC_ASSERT (expr, msg ) static_assert (expr, msg)
129
+ #elif !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
130
+ #define MBED_STRUCT_STATIC_ASSERT (expr, msg ) _Static_assert(expr, msg)
131
+ #else
132
+ #include < stdbool.h>
133
+ #define MBED_STRUCT_STATIC_ASSERT (expr, msg ) bool : (expr) ? 0 : -1
134
+ #endif
129
135
130
136
#endif
131
137
Original file line number Diff line number Diff line change 72
72
* @endcode
73
73
*/
74
74
#ifndef MBED_ALIGN
75
- #if defined(__ICCARM__ )
75
+ #if __cplusplus >= 201103 && !defined __CC_ARM
76
+ #define MBED_ALIGN (N ) alignas (N)
77
+ #elif __STDC_VERSION__ >= 201112 && !defined __CC_ARM
78
+ #define MBED_ALIGN (N ) _Alignas(N)
79
+ #elif defined(__ICCARM__)
76
80
#define MBED_ALIGN (N ) _Pragma (MBED_STRINGIFY(data_alignment=N))
77
81
#else
78
82
#define MBED_ALIGN (N ) __attribute__((aligned(N)))
298
302
* @endcode
299
303
*/
300
304
#ifndef MBED_NORETURN
301
- #if defined(__GNUC__ ) || defined(__clang__ ) || defined(__CC_ARM )
305
+ #if __cplusplus >= 201103
306
+ #define MBED_NORETURN [[noreturn]]
307
+ #elif __STDC_VERSION__ >= 201112
308
+ #define MBED_NORETURN _Noreturn
309
+ #elif defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
302
310
#define MBED_NORETURN __attribute__ ((noreturn))
303
311
#elif defined(__ICCARM__)
304
312
#define MBED_NORETURN __noreturn
You can’t perform that action at this time.
0 commit comments