summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/compiler.h')
-rw-r--r--src/mesa/main/compiler.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 921e3022288..25d9810538a 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -310,6 +310,18 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
#endif
#endif
+
+/**
+ * Static (compile-time) assertion.
+ * Basically, use COND to dimension an array. If COND is false/zero the
+ * array size will be -1 and we'll get a compilation error.
+ */
+#define STATIC_ASSERT(COND) \
+ do { \
+ typedef int static_assertion_failed[(!!(COND))*2-1]; \
+ } while (0)
+
+
#if (__GNUC__ >= 3)
#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
#else