aboutsummaryrefslogtreecommitdiff
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2022-04-18 17:39:00 -0400
committerBoringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-20 17:53:00 +0000
commitf961de5c47ed265c3e758ec70dd15ece20809962 (patch)
treeb1e0960c72ce67f7d52e016280dbfd5fb3fb4f4b /crypto/internal.h
parent493d5cbedda8690d17a323d3532acfb1fb1845ad (diff)
downloadboringssl-f961de5c47ed265c3e758ec70dd15ece20809962.zip
boringssl-f961de5c47ed265c3e758ec70dd15ece20809962.tar.gz
boringssl-f961de5c47ed265c3e758ec70dd15ece20809962.tar.bz2
Try to require C11 (in non-MSVC compilers).
MSVC is a little behind, but otherwise we should be able to assume C11 support in all our compilers. The only C99 builds should just be stale build files. Such consumers are leaving performance on the table, by using the worse refcounting implementation. For now, don't require it in public headers. Android's build is still defaulting to C99, which means requiring C11 will be disruptive. We can try the public headers after that's fixed. Update-Note: If the build fails with an error about C11, remove -std=c99 or -std=gnu99 from your build. Refcounting will get faster. Change-Id: I2ec6f7d7acc026a451851d0c38f60c14bae6b00f Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52247 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/internal.h')
-rw-r--r--crypto/internal.h10
1 files changed, 9 insertions, 1 deletions
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