summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/glcpp/glcpp-lex.l2
-rw-r--r--src/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c3
-rw-r--r--src/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected4
-rw-r--r--src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c19
-rw-r--r--src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected20
-rw-r--r--src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c24
-rw-r--r--src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected25
7 files changed, 96 insertions, 1 deletions
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 4f0dd34d30d..fd28711d12c 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-digits-after-hash-elif.c b/src/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c
new file mode 100644
index 00000000000..6d7d0f38d9a
--- /dev/null
+++ b/src/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c
@@ -0,0 +1,3 @@
+#if 1
+#elif110
+#endif
diff --git a/src/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected b/src/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected
new file mode 100644
index 00000000000..6d5e9d1a58e
--- /dev/null
+++ b/src/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected
@@ -0,0 +1,4 @@
+0:2(2): preprocessor error: Invalid tokens after #
+
+
+
diff --git a/src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c b/src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c
new file mode 100644
index 00000000000..b3413371ec2
--- /dev/null
+++ b/src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c
@@ -0,0 +1,19 @@
+#if(1)
+success
+#endif
+
+#if+1
+success
+#endif
+
+#if-1
+success
+#endif
+
+#if!1
+success
+#endif
+
+#if~1
+success
+#endif
diff --git a/src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected b/src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected
new file mode 100644
index 00000000000..e083008cd8c
--- /dev/null
+++ b/src/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected
@@ -0,0 +1,20 @@
+
+success
+
+
+
+success
+
+
+
+success
+
+
+
+
+
+
+
+success
+
+
diff --git a/src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c b/src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c
new file mode 100644
index 00000000000..e8221bc49c3
--- /dev/null
+++ b/src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c
@@ -0,0 +1,24 @@
+#if 0
+#elif(1)
+success
+#endif
+
+#if 0
+#elif+1
+success
+#endif
+
+#if 0
+#elif-1
+success
+#endif
+
+#if 0
+#elif!1
+success
+#endif
+
+#if 0
+#elif~1
+success
+#endif
diff --git a/src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected b/src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected
new file mode 100644
index 00000000000..3b5479a2b53
--- /dev/null
+++ b/src/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected
@@ -0,0 +1,25 @@
+
+
+success
+
+
+
+
+success
+
+
+
+
+success
+
+
+
+
+
+
+
+
+
+success
+
+