fix static assertion problem for gcc (bug 4022)
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 10 Aug 2005 14:42:21 +0000 (14:42 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 10 Aug 2005 14:42:21 +0000 (14:42 +0000)
src/mesa/shader/slang/slang_utility.h

index 0240385..2b040a4 100644 (file)
 extern "C" {\r
 #endif\r
 \r
-#define static_assert(expr) do { int _array[(expr) ? 1 : 0]; _array[0]; } while (0)\r
+/* Compile-time assertions.  If the expression is zero, try to declare an\r
+ * array of size [-1] to cause compilation error.\r
+ */\r
+#define static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0)\r
 \r
 void slang_alloc_free (void *);\r
 void *slang_alloc_malloc (unsigned int);\r