Mesa (glsl2): glcpp: Remove spurious newline generated by #version handling .

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Aug 16 20:39:57 UTC 2010


Module: Mesa
Branch: glsl2
Commit: 6be3a8b70af4ba4fa4d037d54ecf6d5f055edbc9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6be3a8b70af4ba4fa4d037d54ecf6d5f055edbc9

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Aug 16 13:42:04 2010 -0700

glcpp: Remove spurious newline generated by #version handling.

This was causing line numbering to be off by one.  The newline comes
from the NEWLINE token at the end of the line; there's no need to
insert one.

---

 src/glsl/glcpp/glcpp-lex.l   |    4 +---
 src/glsl/glcpp/glcpp-parse.y |    2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 1cd95b2..9187926 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -88,10 +88,8 @@ HEXADECIMAL_INTEGER	0[xX][0-9a-fA-F]+[uU]?
 		return SPACE;
 }
 
-{HASH}(version) {
+{HASH}version {
 	yylval->str = talloc_strdup (yyextra, yytext);
-	yylineno++;
-	yycolumn = 0;
 	yyextra->space_tokens = 0;
 	return HASH_VERSION;
 }
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 3d08ce6..c91da15 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -309,7 +309,7 @@ control_line:
 			talloc_free (macro);
 		}
 		add_builtin_define (parser, "__VERSION__", $2);
-		glcpp_printf(parser->output, "#version %" PRIiMAX "\n", $2);
+		glcpp_printf(parser->output, "#version %" PRIiMAX, $2);
 	}
 |	HASH NEWLINE
 ;




More information about the mesa-commit mailing list