There's really only two patches in this series, not five.

-Brian

On 11/28/2011 06:15 PM, Brian Paul wrote:
This can be used to check that tables have the right number of entries,
etc. at compile-time.  This will hopefully catch things that are missed
if particular drivers aren't tested, for example.
---
  src/mesa/main/compiler.h |   11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 921e302..96e24e4 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -310,6 +310,17 @@ 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 JOIN(x, y) x##y
+#define STATIC_ASSERT_LINE(COND, LINE) do { typedef int 
JOIN(static_assertion_failed_at_line_,LINE)[(!!(COND))*2-1]; } while (0)
+#define STATIC_ASSERT(COND)  STATIC_ASSERT_LINE(COND, __LINE__)
+
+
  #if (__GNUC__>= 3)
  #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
  #else

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to