help-bison
[Top][All Lists]
Advanced

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

Re: warning: unused value: $3


From: Joel E. Denny
Subject: Re: warning: unused value: $3
Date: Fri, 27 Oct 2006 01:59:11 -0400 (EDT)

On Fri, 27 Oct 2006 address@hidden wrote:

> > Then again, I try to 
> > avoid mid-rules, $0, and $-n, so maybe I don't have the right feel for
> > this.  
> maybe disable the check completely if $0 or $-n is used.

That's an interesting possibility.  However, I worry that there are cases 
where that produces unexpected results for the user.  For example, imagine 
a grammar that uses $0 in a single rule that perhaps has absolutely no 
direct or indirect association with any mid-rules.  Bison would then fail 
to warn about mid-rules everywhere even when the user is expecting them.  
The user who has grown accustomed to these warnings would then have a 
false sense of security as he probably would not guess that $0 disabled 
the warnings.

I'd rather choose a global default (mid-rule warnings on or off) and then 
let the user specify otherwise either globally (-W) or case-by-case (USE).

> What is the impact of the unused $n ?

I believe our original motivation to implement all these set/unset value 
warnings was to help users avoid memory leaks.  This can be relevant with 
mid-rule values.  However, in the specific case of mid-rule values, we 
felt that it's usually a mistake anyway when a user sets $$ an doesn't use 
$n.  Is that what you're asking?

> And also since bison are LALR(1) the restriction of checking by looking just 
> one level ahead is not that far off.

I don't see a connection between one level down and one token of 
lookahead.  Did I misunderstand you?




reply via email to

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