[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: Freeing discarded objects
From: |
Cris Bailiff |
Subject: |
Re: RFC: Freeing discarded objects |
Date: |
Tue, 18 Jun 2002 10:05:09 +1000 |
> Subject: RFC: Freeing discarded objects
> From: Akim Demaille <address@hidden>
> Date: 17 Jun 2002 10:43:16 +0200
>
> Nevertheless, I would really appreciate comments on this. In
> particular, I tried to stick to the Yacc traditional order =E0 la %type:
> the important thing is at the beginning, then a list of symbols
> behind. Does it sound right to you?
Akim,
I scanned your patch (esp. to bison.simple), and it's looking useful, but I
think you missed a case (I missed the same spot at first):
Just before here:
> /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
> variables are global, or local to YYPARSE. */
> @@ -1123,6 +1126,7 @@
> YYABORT;
> YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
> yychar, yytname[yychar1]));
> + yydestructor (yychar1, yylval);
> yychar =3D YYEMPTY;
> }
(where the discard is performed) is the case for exiting at EOF. If you're
half way through a production when eof comes, and your not otherwise caught
by an error handler (e.g. "statement: error ';' " doesn't match at eof!),
then bison will return at YYABORT here with leaked data on the stack.
I've attached a small patch which should fix this case - I'm not so informed
about all the internals of the run-time engine, so I hope I picked the right
parameters for yydestructor here...
Cris
bison.simple.free-at-eof.patch
Description: fix EOF case