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 { \
124124 * };
125125 * @endcode
126126 */
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
129135
130136#endif
131137
Original file line number Diff line number Diff line change 7272 * @endcode
7373 */
7474#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__)
7680#define MBED_ALIGN (N ) _Pragma (MBED_STRINGIFY(data_alignment=N))
7781#else
7882#define MBED_ALIGN (N ) __attribute__((aligned(N)))
298302 * @endcode
299303 */
300304#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)
302310#define MBED_NORETURN __attribute__ ((noreturn))
303311#elif defined(__ICCARM__)
304312#define MBED_NORETURN __noreturn
You can’t perform that action at this time.
0 commit comments