Mesa (master): glcpp: Add a test for #elif with an undefined macro.

Carl Worth cworth at
Fri Sep 30 11:44:35 PDT 2011

Module: Mesa
Branch: master
Commit: 201485bae0fcba4db61ceb1e9d9916778b5bba74

Author: Carl Worth <cworth at>
Date:   Thu Sep 29 22:24:18 2011 -0700

glcpp: Add a test for #elif with an undefined macro.

As written, this test correctly raises an error for #elif being used
with an undefined macro (and not as an argument to "defined"). If the
preceding #if were '#if 1' then this diagnositc would correctly be
hidden. That allows code such as the following to not raise an error:


So this test case is working as expected already. We add it here just
to improve test coverage.

Reviewed-by: Kenneth Graunke <kenneth at>
Signed-off-by: Carl Worth <cworth at>


 src/glsl/glcpp/tests/098-elif-undefined.c          |    3 +++
 src/glsl/glcpp/tests/098-elif-undefined.c.expected |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/glsl/glcpp/tests/098-elif-undefined.c b/src/glsl/glcpp/tests/098-elif-undefined.c
new file mode 100644
index 0000000..52a331c
--- /dev/null
+++ b/src/glsl/glcpp/tests/098-elif-undefined.c
@@ -0,0 +1,3 @@
+#if 0
diff --git a/src/glsl/glcpp/tests/098-elif-undefined.c.expected b/src/glsl/glcpp/tests/098-elif-undefined.c.expected
new file mode 100644
index 0000000..de967ea
--- /dev/null
+++ b/src/glsl/glcpp/tests/098-elif-undefined.c.expected
@@ -0,0 +1,5 @@
+0:2(22): preprocessor error: syntax error, unexpected IDENTIFIER
+0:1(7): preprocessor error: Unterminated #if

More information about the mesa-commit mailing list