summaryrefslogtreecommitdiff
path: root/src/glsl/glsl_parser.ypp
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-08-10 16:52:54 -0700
committerCarl Worth <cworth@cworth.org>2010-08-10 16:52:54 -0700
commit60d8c46995aa9cf3f80592b9c9bb8e5be6e87502 (patch)
treeb8ade9be50cd80d499e9f49f3ca002022017bed0 /src/glsl/glsl_parser.ypp
parent0ff3b2b344b21ae4a7b62ebba22d7358755c8dfe (diff)
glsl2: Initialize location structure at beginning of parse.
Since we have a custom structure for YYLTYPE locations, we need to use an %initial-action directive to avoid triggering use of uninitialized memory when, for example, printing error messages. Thanks to valgrind for noticing this bug.
Diffstat (limited to 'src/glsl/glsl_parser.ypp')
-rw-r--r--src/glsl/glsl_parser.ypp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp
index 493b74fb69..3e60454bb2 100644
--- a/src/glsl/glsl_parser.ypp
+++ b/src/glsl/glsl_parser.ypp
@@ -35,9 +35,17 @@
%}
%pure-parser
-%locations
%error-verbose
+%locations
+%initial-action {
+ @$.first_line = 1;
+ @$.first_column = 1;
+ @$.last_line = 1;
+ @$.last_column = 1;
+ @$.source = 0;
+}
+
%lex-param {void *scanner}
%parse-param {struct _mesa_glsl_parse_state *state}
%name-prefix "_mesa_glsl_"