From: Carl Worth Date: Fri, 20 Jun 2014 20:44:51 +0000 (-0700) Subject: glsl/glcpp: Remove some un-needed calls to NEWLINE_CATCHUP X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21dda50549c5f220eff7ec04a72fb02e5eb09e76;p=mesa.git glsl/glcpp: Remove some un-needed calls to NEWLINE_CATCHUP The NEWLINE_CATCHUP code is only intended to be invoked after we lex an actual newline character ('\n'). The two extra calls here were apparently added accidentally because the pattern happened to contain a (negated) '\n', (see commit 6005e9cb283214cd57038c7c5e7758ba72ec6ac2). I don't think either case could have caused any actual bug. (In the first case, the pattern matched right up to the next newline, so the NEWLINE_CATCHUP code was just about to be called. In the second case, I don't think it's possible to actually enter the start condition after commented newlines without any intervening newline.) But, if nothing else, the code is cleaner without these extra calls. Reviewed-by: Jordan Justen --- diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index a9801f4b6a4..5f0bb324990 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -181,8 +181,6 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* glcpp doesn't handle #extension, #version, or #pragma directives. * Simply pass them through to the main compiler's lexer/parser. */ {HASH}(extension|pragma)[^\n]* { - if (parser->commented_newlines) - BEGIN NEWLINE_CATCHUP; yylval->str = ralloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; @@ -230,8 +228,6 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } [^\n] { - if (parser->commented_newlines) - BEGIN NEWLINE_CATCHUP; } {HASH}error.* {