yacc.c: initialize yylval and yylloc.
authorAkim Demaille <akim@lrde.epita.fr>
Fri, 26 Oct 2012 09:25:41 +0000 (11:25 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Sun, 28 Oct 2012 15:53:18 +0000 (16:53 +0100)
commita68b1f237e63c96ee905916424013f79d01908ba
tree8965f0c67ff6489b6c2ad6ee73d5a8ff541b6a88
parent0fb7b95c5fd7812b0700dd1a088513626129252f
yacc.c: initialize yylval and yylloc.

When generating a pure push parser, the initialization of yylval and
yylloc may not be visible to the compiler.  With warnings enabled, GCC
4.3.6, 4.4.7, 4.5.4, and 4.6.3 report uninitialized uses of
yylval/yylloc.  Using local pragmas to disable these warnings is not
supported before 4.6, and 4.6 does not support it properly.  So
initialize yylval and yylloc at their definition.  Reported by Peter
Simons.  See
http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00133.html

* data/c.m4 (b4_yyloc_default_define): New.
* data/yacc.c: Use it when locations are requested.
(YYLVAL_INITIALIZE): Replace by...
(YY_INITIAL_VALUE): this.
(yyparse): Initialize yylloc and yylval.
Therefore, remove the initialization of yylloc's field.
* data/glr.c: Likewise.
NEWS
data/c.m4
data/glr.c
data/yacc.c