summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/glcpp/glcpp-lex.l2
-rw-r--r--src/glsl/glcpp/tests/127-pragma-empty.c3
-rw-r--r--src/glsl/glcpp/tests/127-pragma-empty.c.expected4
3 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 95638179f28..a1a8e76af0a 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -180,7 +180,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
/* glcpp doesn't handle #extension, #version, or #pragma directives.
* Simply pass them through to the main compiler's lexer/parser. */
-{HASH}(extension|pragma)[^\n]+ {
+{HASH}(extension|pragma)[^\n]* {
if (parser->commented_newlines)
BEGIN NEWLINE_CATCHUP;
yylval->str = ralloc_strdup (yyextra, yytext);
diff --git a/src/glsl/glcpp/tests/127-pragma-empty.c b/src/glsl/glcpp/tests/127-pragma-empty.c
new file mode 100644
index 00000000000..0f9b0b3d38f
--- /dev/null
+++ b/src/glsl/glcpp/tests/127-pragma-empty.c
@@ -0,0 +1,3 @@
+/* It seems an odd (and particularly useless) thing to have an empty pragma,
+ * but we probably shouldn't trigger an error in this case. */
+#pragma
diff --git a/src/glsl/glcpp/tests/127-pragma-empty.c.expected b/src/glsl/glcpp/tests/127-pragma-empty.c.expected
new file mode 100644
index 00000000000..957daff6158
--- /dev/null
+++ b/src/glsl/glcpp/tests/127-pragma-empty.c.expected
@@ -0,0 +1,4 @@
+
+
+#pragma
+