diff --git a/src/crypto/internal.h b/src/crypto/internal.h index 2e94399c2..63e6a662f 100644 --- a/src/crypto/internal.h +++ b/src/crypto/internal.h @@ -126,7 +126,9 @@ #endif #if !defined(__cplusplus) -#if defined(_MSC_VER) && !defined(__clang__) +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#elif defined(_MSC_VER) && !defined(__clang__) #define alignas(x) __declspec(align(x)) #define alignof __alignof #else @@ -135,11 +137,13 @@ // compilers have long implemented C11 and made it default. The most likely // cause of pre-C11 modes is stale -std=c99 or -std=gnu99 flags in build // configuration. Such flags can be removed. -#if __STDC_VERSION__ < 201112L +// +// TODO(davidben): In MSVC 2019 16.8 or higher (_MSC_VER >= 1928), +// |__STDC_VERSION__| will be 201112 when passed /std:c11 and unset otherwise. +// C11 alignas and alignof are only implemented in C11 mode. Can we mandate C11 +// mode for those versions? #error "BoringSSL must be built in C11 mode or higher." #endif -#include -#endif #endif #if defined(OPENSSL_THREADS) && \