Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Langley <alangley@gmail.com>2015-05-15 21:57:58 +0300
committerAdam Langley <agl@google.com>2015-05-20 22:13:23 +0300
commitdaaff93464f79b9f1f06cac39d56125892280ee9 (patch)
treef3d363250d2d11840241953f1d47692a6c41d067 /include/openssl/type_check.h
parentdc8c739a3b271266edf218b24f467656991a290c (diff)
Use C11 _Static_assert where available.
OPENSSL_COMPILE_ASSERT implements a static assertion, but the error message is a little weird because it's a hack around the fact that C, traditionally, doesn't have static assertions. C11 now does have _Static_assert (a.k.a. static_assert when one includes assert.h) so we can use that when provided to get cleaner error messages. Change-Id: Ia3625dfb2988de11fd95ddba957f118c0d3183ff Reviewed-on: https://boringssl-review.googlesource.com/4770 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'include/openssl/type_check.h')
-rw-r--r--include/openssl/type_check.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/openssl/type_check.h b/include/openssl/type_check.h
index dd59151f..5c0360ad 100644
--- a/include/openssl/type_check.h
+++ b/include/openssl/type_check.h
@@ -76,8 +76,12 @@ extern "C" {
* was a pointer to |type|. */
#define CHECKED_PTR_OF(type, p) CHECKED_CAST(void*, type*, (p))
+#if __STDC_VERSION__ >= 201112L
+#define OPENSSL_COMPILE_ASSERT(cond, msg) _Static_assert(cond, #msg)
+#else
#define OPENSSL_COMPILE_ASSERT(cond, msg) \
typedef char OPENSSL_COMPILE_ASSERT_##msg[((cond) ? 1 : -1)]
+#endif
#if defined(__cplusplus)