forked from wolfSSL/wolfssl
wolfssl/wolfcrypt/types.h: dial in the __static_assert() gating+definitions, and add static_assert2().
This commit is contained in:
@ -1696,20 +1696,32 @@ typedef struct w64wrapper {
|
|||||||
|
|
||||||
#define WC_CPP_CAT_(a, b) a ## b
|
#define WC_CPP_CAT_(a, b) a ## b
|
||||||
#define WC_CPP_CAT(a, b) WC_CPP_CAT_(a, b)
|
#define WC_CPP_CAT(a, b) WC_CPP_CAT_(a, b)
|
||||||
#ifndef static_assert
|
#if defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||||
#if !defined(__cplusplus) && !defined(__STRICT_ANSI__) && \
|
#ifndef static_assert2
|
||||||
!defined(WOLF_C89) && ((defined(__GNUC__) && \
|
#define static_assert2 static_assert
|
||||||
__GNUC__ >= 5) || defined(__clang__))
|
|
||||||
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
|
|
||||||
#define static_assert(expr, ...) \
|
|
||||||
__static_assert(expr, ##__VA_ARGS__, #expr)
|
|
||||||
#elif defined(__STRICT_ANSI__) || defined(WOLF_C89)
|
|
||||||
#define static_assert(expr) \
|
|
||||||
struct WC_CPP_CAT(dummy_struct_, __LINE__)
|
|
||||||
#else
|
|
||||||
#define static_assert(...) \
|
|
||||||
struct WC_CPP_CAT(wc_dummy_struct_L, __LINE__)
|
|
||||||
#endif
|
#endif
|
||||||
|
#elif !defined(static_assert)
|
||||||
|
#if !defined(__cplusplus) && \
|
||||||
|
!defined(__STRICT_ANSI__) && \
|
||||||
|
!defined(WOLF_C89) && \
|
||||||
|
defined(__STDC_VERSION__) && \
|
||||||
|
(__STDC_VERSION__ >= 201112L) && \
|
||||||
|
((defined(__GNUC__) && \
|
||||||
|
(__GNUC__ >= 5)) || \
|
||||||
|
defined(__clang__))
|
||||||
|
#define static_assert(expr) _Static_assert(expr, #expr)
|
||||||
|
#ifndef static_assert2
|
||||||
|
#define static_assert2(expr, msg) _Static_assert(expr, msg)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define static_assert(expr) \
|
||||||
|
struct WC_CPP_CAT(wc_dummy_struct_L, __LINE__)
|
||||||
|
#ifndef static_assert2
|
||||||
|
#define static_assert2(expr, msg) static_assert(expr)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#elif !defined(static_assert2)
|
||||||
|
#define static_assert2(expr, msg) static_assert(expr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SAVE_VECTOR_REGISTERS
|
#ifndef SAVE_VECTOR_REGISTERS
|
||||||
|
Reference in New Issue
Block a user