glsl/glcpp: Swallow empty #pragma directives.
authorCarl Worth <cworth@cworth.org>
Wed, 2 Jul 2014 17:32:46 +0000 (10:32 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 7 Aug 2014 23:08:29 +0000 (16:08 -0700)
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>
src/glsl/glcpp/glcpp-lex.l
src/glsl/glcpp/tests/127-pragma-empty.c.expected

index 430abd4bfa31a269e39c42e2ebf0f5eb85b41e85..aeaf8abdf8a8851a96f9c2410cec0e090de54d1f 100644 (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]* {
index 89fe08e88766d1be10bbddb83ba6caa751d2a0d0..92371a07c32510f56c723b4f98a1f9aee12cc533 100644 (file)
@@ -1,3 +1,3 @@
  
 
-#pragma
+