glcpp: Fix source numbers set with "#line LINE_NUMBER SOURCE_NUMBER"
authorCarl Worth <cworth@cworth.org>
Mon, 23 Aug 2010 16:29:49 +0000 (09:29 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 23 Aug 2010 17:48:10 +0000 (10:48 -0700)
Previously, the YY_USER_ACTION was overwriting the yylloc->source value
in every action, (after that value had been carefully set by the handling
of the #line directive). Instead, we want to initialize it once in
YY_USER_INIT and then not touch it at all in YY_USER_ACTION.

src/glsl/glcpp/glcpp-lex.l

index c81bd044a2a30e72731cd429aa14ee9074f4d704..a90430f255b424b62220e9698b5b62fe58b1254e 100644 (file)
@@ -38,12 +38,17 @@ void glcpp_set_column (int  column_no , yyscan_t yyscanner);
 
 #define YY_USER_ACTION                                          \
    do {                                                         \
-      yylloc->source = 0;                                       \
       yylloc->first_column = yycolumn + 1;                      \
       yylloc->first_line = yylineno;                            \
       yycolumn += yyleng;                                       \
    } while(0);
-#define YY_USER_INIT yylineno = 1; yycolumn = 1;
+
+#define YY_USER_INIT                   \
+       do {                            \
+               yylineno = 1;           \
+               yycolumn = 1;           \
+               yylloc->source = 0;     \
+       } while(0)
 %}
 
 %option bison-bridge bison-locations reentrant noyywrap