[Mesa-dev] [PATCH 2/3] glcpp: Support #elif(expression) with no intervening space.
Matt Turner
mattst88 at gmail.com
Mon Nov 26 14:30:18 PST 2012
And add a test case to ensure that this works.
See 17f9beb6 for #if change.
---
src/glsl/glcpp/glcpp-lex.l | 2 +-
.../glcpp/tests/110-no-space-after-hash-elif.c | 3 +++
.../tests/110-no-space-after-hash-elif.c.expected | 4 ++++
3 files changed, 8 insertions(+), 1 deletions(-)
create mode 100644 src/glsl/glcpp/tests/110-no-space-after-hash-elif.c
create mode 100644 src/glsl/glcpp/tests/110-no-space-after-hash-elif.c.expected
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 4f0dd34..fd28711 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -158,7 +158,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
return HASH_IF;
}
-{HASH}elif {
+{HASH}elif/[^_a-zA-Z0-9] {
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
return HASH_ELIF;
diff --git a/src/glsl/glcpp/tests/110-no-space-after-hash-elif.c b/src/glsl/glcpp/tests/110-no-space-after-hash-elif.c
new file mode 100644
index 0000000..6d7d0f3
--- /dev/null
+++ b/src/glsl/glcpp/tests/110-no-space-after-hash-elif.c
@@ -0,0 +1,3 @@
+#if 1
+#elif110
+#endif
diff --git a/src/glsl/glcpp/tests/110-no-space-after-hash-elif.c.expected b/src/glsl/glcpp/tests/110-no-space-after-hash-elif.c.expected
new file mode 100644
index 0000000..6d5e9d1
--- /dev/null
+++ b/src/glsl/glcpp/tests/110-no-space-after-hash-elif.c.expected
@@ -0,0 +1,4 @@
+0:2(2): preprocessor error: Invalid tokens after #
+
+
+
--
1.7.8.6
More information about the mesa-dev
mailing list