Destructor cleanups and regularization among the three skeletons.

* NEWS: Document the behavior changes.
* data/glr.c (yyrecoverSyntaxError): Don't bother to pop the
stack before failing, as the cleanup code will do it for us now.
* data/lalr1.cc (yyerrlab): Likewise.
* data/glr.c (yyparse): Pop everything off the stack before
freeing it, so that destructors get called properly.
* data/lalr1.cc (yyreturn): Likewise.
* data/yacc.c (yyreturn): Pop and destroy the start symbol, too.
This is more consistent.
* doc/bison.texinfo (Destructor Decl): Mention more reasons
why destructors might be called.  1.875 -> 2.1.
(Destructor Decl, Decl Summary, Table of Symbols):
Some English-language cleanups for %destructor.
* tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR):
Add output line for destructor of start symbol.
* tests/calc.at (AT_CHECK_CALC): Add one to line counts,
because of that same extra output line.
This commit is contained in:
Paul Eggert
2005-07-19 06:56:44 +00:00
parent 6088a2a04d
commit 258b75caaa
8 changed files with 90 additions and 67 deletions

View File

@@ -1220,8 +1220,7 @@ yyerrlab:
if (yychar <= YYEOF)
{
/* If at end of input, pop the error token,
then the rest of the stack, then return failure. */
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
@@ -1333,16 +1332,12 @@ yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct ("Error: discarding lookahead",
yytoken, &yylval]b4_location_if([, &yylloc])[);
if (yyssp != yyss)
for (;;)
{
]b4_location_if([[ yyerror_range[0] = *yylsp;]])[
YYPOPSTACK;
if (yyssp == yyss)
break;
yydestruct ("Error: popping",
yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);
}
while (yyssp != yyss)
{
yydestruct ("Error: popping",
yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);
YYPOPSTACK;
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);