A strict reading of the GLSL specification would have this be an
error, but we've received reports from users who expect the
preprocessor to interepret undefined macros as 0. This is the standard
behavior of the rpeprocessor for C, and according to these user
reports is also the behavior of other OpenGL implementations.
So here's one of those cases where we can make our users happier by
ignoring the specification. And it's hard to imagine users who really,
really want to see an error for this case.
The two affected tests cases are updated to reflect the new behavior.
Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
expression:
integer_constant
+| IDENTIFIER {
+ $$ = 0;
+ }
| expression OR expression {
$$ = $1 || $3;
}
#if UNDEFINED_MACRO
+Failure
+#else
+Success
#endif
-0:1(21): preprocessor error: syntax error, unexpected IDENTIFIER
+
+
+
+Success
+
#if 0
+Not this
#elif UNDEFINED_MACRO
+Nor this
+#else
+Yes, this.
#endif
-0:2(22): preprocessor error: syntax error, unexpected IDENTIFIER
-0:1(7): preprocessor error: Unterminated #if
+
+
+Yes, this.
+
+