summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/mesa/include/c11_compat.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/mesa/include/c11_compat.h b/lib/mesa/include/c11_compat.h
index 7f4a6ac60..88711ee8d 100644
--- a/lib/mesa/include/c11_compat.h
+++ b/lib/mesa/include/c11_compat.h
@@ -12,16 +12,22 @@
/* Already C11 */
#else
+#ifndef __has_extension
+#define __has_extension(x) 0
+#endif
/*
* C11 static_assert() macro
* assert.h only defines that name for C11 and above
*/
#ifndef static_assert
-#ifdef __clang__
+#if defined(__clang__) && __has_extension(c_static_assert)
+#define static_assert _Static_assert
+#elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4))
+#warning
#define static_assert _Static_assert
#else
-#define static_assert(...) ((void)0)
+#define static_assert(cond, mesg) struct _C11_COMPAT_H_static_assert_unused
#endif
#endif