aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILDING.md3
-rw-r--r--crypto/internal.h10
-rw-r--r--include/openssl/type_check.h7
3 files changed, 17 insertions, 3 deletions
diff --git a/BUILDING.md b/BUILDING.md
index d3446f3..e7dfd6e 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -30,7 +30,8 @@ most recent stable version of each tool.
by CMake, it may be configured explicitly by setting
`CMAKE_ASM_NASM_COMPILER`.
- * C and C++ compilers with C++14 support are required. On Windows, MSVC from
+ * 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 2017 or later with Platform SDK 8.1 or later are supported,
but newer versions are recommended. Recent versions of GCC (6.1+) and Clang
should work on non-Windows platforms, and maybe on Windows too.
diff --git a/crypto/internal.h b/crypto/internal.h
index 78dbbbf..3fb9124 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -126,10 +126,18 @@
#endif
#if !defined(__cplusplus)
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
#define alignas(x) __declspec(align(x))
#define alignof __alignof
#else
+// 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.
+#if __STDC_VERSION__ < 201112L
+#error "BoringSSL must be built in C11 mode or higher."
+#endif
#include <stdalign.h>
#endif
#endif
diff --git a/include/openssl/type_check.h b/include/openssl/type_check.h
index c267938..41de895 100644
--- a/include/openssl/type_check.h
+++ b/include/openssl/type_check.h
@@ -71,7 +71,12 @@ extern "C" {
// C11 defines the |_Static_assert| keyword and the |static_assert| macro in
// assert.h. While the former is available at all versions in Clang and GCC, the
// later depends on libc and, in glibc, depends on being built in C11 mode. We
-// do not require this, for now, so use |_Static_assert| directly.
+// require C11 mode to build the library but, for now, do not require it in
+// public headers. Use |_Static_assert| directly.
+//
+// TODO(davidben): In July 2022, if the C11 change has not been reverted, switch
+// all uses of this macro within the library to C11 |static_assert|. This macro
+// will only be necessary in public headers.
#define OPENSSL_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
#endif