[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no $$ in %destructor = no unset value warnings?

From: Joel E. Denny
Subject: Re: no $$ in %destructor = no unset value warnings?
Date: Fri, 15 Sep 2006 19:55:18 -0400 (EDT)

On Fri, 15 Sep 2006, Paul Eggert wrote:

> "Joel E. Denny" <address@hidden> writes:
> > shouldn't Bison warn when there's %union or <...> usage in the
> > grammar but a $$ without a type appears in a %destructor/%printer?
> You mean, something like this?
>      %union { char *p; }
>      %token STRING
>      %destructor { free ($$); } STRING


> It would make sense to warn about this, yes, though as the C compiler
> will generate a type error for this sort of thing it doesn't sound
> that urgent.

I agree.  I thought of it because Akim proposed that Bison should warn 
when $$ should be used but isn't used in %destructor/%printer.  I felt 
Bison also should warn when $$ shouldn't be used but is used.  This would 
be more consistent with semantic actions, and that should help the user 
not to get confused.

> (I can't think of an example where the C compiler
> wouldn't warn, but perhaps I'm not thinking outside the box
> enough....)

I think there are cases involving void* and C++ overloaded functions, but 
I'm not worried about that so much.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]