[Mesa-dev] [PATCH 4/6] glsl/glcpp: Fix null directive when followed by whitespace

Carl Worth cworth at cworth.org
Tue Jul 1 18:03:39 PDT 2014


We accidentally had support for null directives, (that is, a line with "#" and
nothing else) in two places: the lexer and the parser.

The support in the lexer was broken, (expecting the '#' to be followed
immediately by a newline), so it caused failures if the '#' was followed
immediately by whitespace before the newline.

So all we have to do here is to remove the rule from the lexer so that the
parser's correct rule can actuall see and handle the null directive.
---
 src/glsl/glcpp/glcpp-lex.l | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 09dba35..1537694 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -381,11 +381,6 @@ HEXADECIMAL_INTEGER	0[xX][0-9a-fA-F]+[uU]?
 	RETURN_TOKEN (UNDEF);
 }
 
-<HASH>{NEWLINE} {
-	BEGIN INITIAL;
-	RETURN_TOKEN (HASH_TOKEN);
-}
-
 <HASH>{HSPACE}+ {
 	/* Nothing to do here. Importantly, don't leave the <HASH>
 	 * start condition, since it's legal to have space between the
-- 
2.0.0



More information about the mesa-dev mailing list