glsl/glcpp: Swallow empty #pragma directives.

Previously, we were passing these through, just like any other pragma. But the
downstream compiler was tripping up on them. It seems easier to swallow these
in the preprocessor and not pass them on at all rather than fixing the
downstream compiler.

This fixes the following Khronos GLES3 CTS tests:

	preprocessor.pragmas.pragma_vertex
	preprocessor.pragmas.pragma_fragment

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Carl Worth 2014-07-02 10:32:46 -07:00 committed by Ian Romanick
parent bf9bce5bea
commit a48ff781c1
2 changed files with 7 additions and 1 deletions

View file

@ -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]* {

View file

@ -1,3 +1,3 @@
#pragma