[Mesa-dev] [PATCH 6/6] glcpp: Add a test for #elif with an undefined macro.
Carl Worth
cworth at cworth.org
Thu Sep 29 23:00:30 PDT 2011
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:
#ifndef MAYBE_UNDEFINED
#elif MAYBE_UNDEFINED < 5
...
#endif
So this test case is working as expected already. We add it here just
to improve test coverage.
---
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(-)
create mode 100644 src/glsl/glcpp/tests/098-elif-undefined.c
create mode 100644 src/glsl/glcpp/tests/098-elif-undefined.c.expected
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
+#elif UNDEFINED_MACRO
+#endif
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
+
+
+
--
1.7.6.3
More information about the mesa-dev
mailing list