glsl/glcpp: Fix NULL directives when followed by a single-line comment
authorCarl Worth <cworth@cworth.org>
Wed, 2 Jul 2014 00:58:37 +0000 (17:58 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 7 Aug 2014 23:08:29 +0000 (16:08 -0700)
This is the fix for the following line:

#  // comment to ignore here

According to the translation-phase rules, the comment should be removed before
the preprocessor looks to interpret the null directive.

So in our implementation we must explicitly look for single-line comments in
the <HASH> start condition as well.

This commit fixes the following Khronos GLES3 CTS tests:

null_directive_vertex
null_directive_fragment

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/glcpp/glcpp-lex.l

index 2cfe203dacfa367d3ccbd60be4f7874b1b30ea8e..2b92fd37e2b6df47d1a71adfc5ecc2d57c017323 100644 (file)
@@ -250,7 +250,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
        }
 
        /* Single-line comments */
-<INITIAL,DEFINE>"//"[^\r\n]* {
+<INITIAL,DEFINE,HASH>"//"[^\r\n]* {
 }
 
        /* Multi-line comments */