From: Paul Eggert Date: Sat, 9 Jul 2005 07:14:18 +0000 (+0000) Subject: * data/yacc.c (yyparse): In the initial action, set X-Git-Tag: BISON-2_1~110 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/34160ec4ec58f5ece2ef980201aee2fb20cfab46?ds=sidebyside * data/yacc.c (yyparse): In the initial action, set yylsp[0] and yyvsp[0] rather than yylloc and yylval. This avoids the use of undefined variables if the initial action does not set yylloc and/or yylval. --- diff --git a/ChangeLog b/ChangeLog index 1ec5667d..b5f44ada 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-09 Paul Eggert + + * data/yacc.c (yyparse): In the initial action, set + yylsp[0] and yyvsp[0] rather than yylloc and yylval. + This avoids the use of undefined variables if the initial + action does not set yylloc and/or yylval. + 2005-07-07 Paul Eggert * examples/calc++/calc++-driver.cc, examples/calc++/calc++-driver.hh: diff --git a/data/yacc.c b/data/yacc.c index 6bf06d50..ebb0c9be 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -859,8 +859,8 @@ b4_c_function_def([yyparse], [int], b4_parse_param) #endif ]]) m4_ifdef([b4_initial_action], [ -m4_pushdef([b4_at_dollar], [yylloc])dnl -m4_pushdef([b4_dollar_dollar], [yylval])dnl +m4_pushdef([b4_at_dollar], [[yylsp[0]]])dnl +m4_pushdef([b4_dollar_dollar], [[yyvsp[0]]])dnl /* User initialization code. */ b4_initial_action m4_popdef([b4_dollar_dollar])dnl @@ -868,10 +868,7 @@ m4_popdef([b4_at_dollar])dnl /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@])])dnl [ - yyvsp[0] = yylval; -]b4_location_if([[ yylsp[0] = yylloc; -]]) -[ goto yysetstate; + goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. |