Require C11 in MSVC too
BoringSSL can currently be built in C11 or pre-C11 mode in MSVC. They're
broadly the same, but do use completely different implementations of
alignas and alignof. Now that every build configuration I'm aware of has
been moved to the C11 mode, we don't even test the pre-C11 mode anymore.
Start requiring it.
Update-Note: If building with MSVC, BoringSSL now requires building with
/std:c11 or later. (On non-MSVC compilers, we have required C11 for a
Commit-Queue: Adam Langley <email@example.com>
Auto-Submit: David Benjamin <firstname.lastname@example.org>
Reviewed-by: Adam Langley <email@example.com>
diff --git a/BUILDING.md b/BUILDING.md
index f915d85..742d454 100644
@@ -30,11 +30,11 @@
by CMake, it may be configured explicitly by setting
- * C and C++ compilers with C++14 support are required. If using a C compiler
- other than MSVC, C11 support is also requried. On Windows, MSVC from
- Visual Studio 2019 or later with Windows 10 SDK 2104 or later are supported,
- but using the latest versions is recommended. Recent versions of GCC (6.1+)
- and Clang should work on non-Windows platforms, and maybe on Windows too.
+ * Compilers for C11 and C++14, or later, are required. On Windows, MSVC from
+ Visual Studio 2019 or later with Windows 10 SDK 2104 or later are
+ supported, but using the latest versions is recommended. Recent versions of
+ GCC (6.1+) and Clang should work on non-Windows platforms, and maybe on
+ Windows too.
* The most recent stable version of [Go](https://golang.org/dl/) is required.
Note Go is exempt from the five year support window. If not found by CMake,
diff --git a/crypto/internal.h b/crypto/internal.h
index a2c49d6..4de4597 100644
@@ -127,24 +127,13 @@
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
-#elif defined(_MSC_VER) && !defined(__clang__)
-#define alignas(x) __declspec(align(x))
-#define alignof __alignof
-// With the exception of MSVC, we require C11 to build the library. C11 is a
-// prerequisite for improved refcounting performance. All our supported C
-// 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.
-// 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?
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
+// BoringSSL requires C11 to build the library. 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 building with MSVC, build with /std:c11.
#error "BoringSSL must be built in C11 mode or higher."
#if defined(OPENSSL_THREADS) && \
@@ -160,9 +149,8 @@
// Determine the atomics implementation to use with C.
-#if !defined(OPENSSL_C11_ATOMIC) && defined(OPENSSL_THREADS) && \
- !defined(__STDC_NO_ATOMICS__) && defined(__STDC_VERSION__) && \
- __STDC_VERSION__ >= 201112L
+#if !defined(OPENSSL_C11_ATOMIC) && defined(OPENSSL_THREADS) && \