Fix a destructor bug reported by Wolfgang Spraul in

<http://lists.gnu.org/archive/html/bug-bison/2005-05/msg00042.html>.
* data/yacc.c (yyabortlab): Don't call destructor, and
don't set yychar to EMPTY.
(yyoverflowlab): Don't call destructor.
(yyreturn): Call destructor, if yychar is neither YYEOF nor YYEMPTY.
* tests/calc.at (AT_CHECK_CALC): Expect one fewer output lines,
since we no longer output the message "discarding lookahead token
end of input ()".
This commit is contained in:
Paul Eggert
2005-05-22 05:20:01 +00:00
parent 5e6f62f2f1
commit cea1469d47
3 changed files with 19 additions and 9 deletions

View File

@@ -1,3 +1,15 @@
2005-05-21 Paul Eggert <eggert@cs.ucla.edu>
Fix a destructor bug reported by Wolfgang Spraul in
<http://lists.gnu.org/archive/html/bug-bison/2005-05/msg00042.html>.
* data/yacc.c (yyabortlab): Don't call destructor, and
don't set yychar to EMPTY.
(yyoverflowlab): Don't call destructor.
(yyreturn): Call destructor, if yychar is neither YYEOF nor YYEMPTY.
* tests/calc.at (AT_CHECK_CALC): Expect one fewer output lines,
since we no longer output the message "discarding lookahead token
end of input ()".
2005-05-20 Paul Hilfinger <hilfingr@CS.Berkeley.EDU> 2005-05-20 Paul Hilfinger <hilfingr@CS.Berkeley.EDU>
* data/glr.c (YY_SYMBOL_PRINT): Don't print newline at end to * data/glr.c (YY_SYMBOL_PRINT): Don't print newline at end to
@@ -15,7 +27,7 @@
* tests/glr-regression.at: Add test for GLR merging error reported * tests/glr-regression.at: Add test for GLR merging error reported
by M. Rosien. by M. Rosien.
2005-05-13 Paul Eggert <eggert@cs.ucla.edu> 2005-05-13 Paul Eggert <eggert@cs.ucla.edu>
* COPYING, ChangeLog, GNUmakefile, HACKING, Makefile.am, * COPYING, ChangeLog, GNUmakefile, HACKING, Makefile.am,

View File

@@ -135,7 +135,7 @@ m4_changecom()
m4_divert(0)dnl m4_divert(0)dnl
@output @output_parser_name@ @output @output_parser_name@
b4_copyright([Skeleton parser for Yacc-like parsing with Bison], b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])[ [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])[
/* As a special exception, when this file is copied by Bison into a /* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction. Bison output file, you may use that output file without restriction.
@@ -1296,9 +1296,6 @@ yyacceptlab:
| yyabortlab -- YYABORT comes here. | | yyabortlab -- YYABORT comes here. |
`-----------------------------------*/ `-----------------------------------*/
yyabortlab: yyabortlab:
yydestruct (_("Error: discarding lookahead"),
yytoken, &yylval]b4_location_if([, &yylloc])[);
yychar = YYEMPTY;
yyresult = 1; yyresult = 1;
goto yyreturn; goto yyreturn;
@@ -1308,13 +1305,14 @@ yyabortlab:
`----------------------------------------------*/ `----------------------------------------------*/
yyoverflowlab: yyoverflowlab:
yyerror (]b4_yyerror_args[_("parser stack overflow")); yyerror (]b4_yyerror_args[_("parser stack overflow"));
yydestruct (_("Error: discarding lookahead"),
yytoken, &yylval]b4_location_if([, &yylloc])[);
yyresult = 2; yyresult = 2;
/* Fall through. */ /* Fall through. */
#endif #endif
yyreturn: yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct (_("Error: discarding lookahead"),
yytoken, &yylval]b4_location_if([, &yylloc])[);
if (yyssp != yyss) if (yyssp != yyss)
for (;;) for (;;)
{ {
@@ -1337,7 +1335,7 @@ b4_epilogue
m4_if(b4_defines_flag, 0, [], m4_if(b4_defines_flag, 0, [],
[@output @output_header_name@ [@output @output_header_name@
b4_copyright([Skeleton parser for Yacc-like parsing with Bison], b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004]) [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])
/* As a special exception, when this file is copied by Bison into a /* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction. Bison output file, you may use that output file without restriction.

View File

@@ -480,7 +480,7 @@ _AT_CHECK_CALC_ERROR([$1], [1],
[16], [16],
[2.0: syntax error, unexpected '+']) [2.0: syntax error, unexpected '+'])
# Exercise error messages with EOF: work on an empty file. # Exercise error messages with EOF: work on an empty file.
_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [5], _AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4],
[1.0: syntax error, unexpected end of input]) [1.0: syntax error, unexpected end of input])
# Exercise the error token: without it, we die at the first error, # Exercise the error token: without it, we die at the first error,