diff options
-rw-r--r-- | src/glsl/glcpp/glcpp-lex.l | 6 | ||||
-rw-r--r-- | src/glsl/glcpp/tests/127-pragma-empty.c.expected | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 430abd4bfa..aeaf8abdf8 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -287,6 +287,12 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? RETURN_STRING_TOKEN (VERSION_TOKEN); } + /* Swallow empty #pragma directives, (to avoid confusing the + * downstream compiler). */ +<HASH>pragma{HSPACE}*/[\r\n] { + BEGIN INITIAL; +} + /* glcpp doesn't handle #extension, #version, or #pragma directives. * Simply pass them through to the main compiler's lexer/parser. */ <HASH>(extension|pragma)[^\r\n]* { diff --git a/src/glsl/glcpp/tests/127-pragma-empty.c.expected b/src/glsl/glcpp/tests/127-pragma-empty.c.expected index 89fe08e887..92371a07c3 100644 --- a/src/glsl/glcpp/tests/127-pragma-empty.c.expected +++ b/src/glsl/glcpp/tests/127-pragma-empty.c.expected @@ -1,3 +1,3 @@ -#pragma + |