summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/c11_compat.h27
-rw-r--r--src/util/macros.h1
2 files changed, 28 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_ */
diff --git a/src/util/macros.h b/src/util/macros.h
index 86585f609da..f5f099bb594 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -27,6 +27,7 @@
#include <assert.h>
#include "c99_compat.h"
+#include "c11_compat.h"
/* Compute the size of an array */
#ifndef ARRAY_SIZE