summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/glcpp/glcpp-parse.y3
-rw-r--r--src/glsl/glcpp/tests/070-undefined-macro-in-expression.c3
-rw-r--r--src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected6
-rw-r--r--src/glsl/glcpp/tests/098-elif-undefined.c4
-rw-r--r--src/glsl/glcpp/tests/098-elif-undefined.c.expected7
5 files changed, 20 insertions, 3 deletions
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 9e8f9b2d653..78ff8fa9c59 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -341,6 +341,9 @@ integer_constant:
expression:
integer_constant
+| IDENTIFIER {
+ $$ = 0;
+ }
| expression OR expression {
$$ = $1 || $3;
}
diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c
index b6dc2ba075f..d15a4840b01 100644
--- a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c
+++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c
@@ -1,2 +1,5 @@
#if UNDEFINED_MACRO
+Failure
+#else
+Success
#endif
diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected
index 2bb38a1411e..d5a84525579 100644
--- a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected
+++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected
@@ -1,2 +1,6 @@
-0:1(21): preprocessor error: syntax error, unexpected IDENTIFIER
+
+
+
+Success
+
diff --git a/src/glsl/glcpp/tests/098-elif-undefined.c b/src/glsl/glcpp/tests/098-elif-undefined.c
index 52a331cc414..1f520d4d432 100644
--- a/src/glsl/glcpp/tests/098-elif-undefined.c
+++ b/src/glsl/glcpp/tests/098-elif-undefined.c
@@ -1,3 +1,7 @@
#if 0
+Not this
#elif UNDEFINED_MACRO
+Nor this
+#else
+Yes, this.
#endif
diff --git a/src/glsl/glcpp/tests/098-elif-undefined.c.expected b/src/glsl/glcpp/tests/098-elif-undefined.c.expected
index de967eac438..2af0a12690a 100644
--- a/src/glsl/glcpp/tests/098-elif-undefined.c.expected
+++ b/src/glsl/glcpp/tests/098-elif-undefined.c.expected
@@ -1,5 +1,8 @@
-0:2(22): preprocessor error: syntax error, unexpected IDENTIFIER
-0:1(7): preprocessor error: Unterminated #if
+
+
+Yes, this.
+
+