projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6aed626
)
gallium: add STATIC_ASSERT macro
author
Brian Paul
<brianp@vmware.com>
Wed, 4 Jan 2012 15:40:04 +0000
(08:40 -0700)
committer
Brian Paul
<brianp@vmware.com>
Thu, 5 Jan 2012 15:19:23 +0000
(08:19 -0700)
src/gallium/include/pipe/p_compiler.h
patch
|
blob
|
history
diff --git
a/src/gallium/include/pipe/p_compiler.h
b/src/gallium/include/pipe/p_compiler.h
index 6ac364476386c4fc998c36eeb364a3be03df3295..1daa5abdb85c365cec5dc29daa69fc52cab56714 100644
(file)
--- a/
src/gallium/include/pipe/p_compiler.h
+++ b/
src/gallium/include/pipe/p_compiler.h
@@
-308,6
+308,17
@@
void _ReadWriteBarrier(void);
#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 defined(__cplusplus)
}
#endif