summaryrefslogtreecommitdiffstats
path: root/include/c11_compat.h
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-07-23 13:44:33 +0100
committerEric Engestrom <[email protected]>2019-08-04 11:14:25 +0100
commit9668d7f5393dcc95f3d447a7dfb1c28265a2c9fd (patch)
treeb9009638ccb9dbfafc5517eb644ce98c7ca7e959 /include/c11_compat.h
parent64ffc289be897d25a2e6038c2bcf17dc0608fcea (diff)
introduce c11_compat.h to provide C11 things in C99
Right now, all it does is provide the new standard `static_assert()` name. Fixes: fbf7c38da35afe7f1de0 ("egl/wayland: use bitset.h for `formats` bit set") Signed-off-by: Eric Engestrom <[email protected]> Tested-by: Bhushan Shah <[email protected]>
Diffstat (limited to 'include/c11_compat.h')
-rw-r--r--include/c11_compat.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/c11_compat.h b/include/c11_compat.h
new file mode 100644
index 00000000000..d35740f47a4
--- /dev/null
+++ b/include/c11_compat.h
@@ -0,0 +1,27 @@
+/* Copyright 2019 Intel Corporation */
+/* SPDX-License-Identifier: MIT */
+
+#include "no_extern_c.h"
+
+#ifndef _C11_COMPAT_H_
+#define _C11_COMPAT_H_
+
+#if defined(__cplusplus)
+ /* This is C++ code, not C */
+#elif (__STDC_VERSION__ >= 201112L)
+ /* Already C11 */
+#else
+
+
+/*
+ * C11 static_assert() macro
+ * assert.h only defines that name for C11 and above
+ */
+#ifndef static_assert
+#define static_assert _Static_assert
+#endif
+
+
+#endif /* !C++ && !C11 */
+
+#endif /* _C11_COMPAT_H_ */