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: Thu, 26 Oct 2006 15:35:22 -0400 (EDT)

On Thu, 26 Oct 2006 address@hidden wrote:

> On Thursday 26 October 2006 20:45, Joel E. Denny wrote:
> > On Thu, 26 Oct 2006 address@hidden wrote:
> > > On Thursday 26 October 2006 02:27, Joel E. Denny wrote:
> 
> > That's nice.  I'm wondering why the grammar doesn't use $-1 and drop the
> > mid-rule entirely, but I haven't test this.  I'm thinking there may always
> > be a solution similar to these to avoid USE for mid-rules.
> The grammar
> 
> procoptionlist:
>   { $<pol>$ = newProcOptionList(); } 
>           procoption 
>   { $$ = $<pol>1; }
> |       procoptionlist procoption {$$=$1;}
> |       procoptionlist ',' {$$=$1;} procoption {$$=$1;}
>         ;
> 
> procoption:
>         MAIN { if(setTristateAttribute(&($<pol>0)->main,1)<0) YYERROR; }
> ;
> 
> so the procoption can be separated by either blanks or comma.

Sorry, I should've looked back at your original post.  Thanks for the 
clarification.

Ok, so pretend you didn't actually need the $$=$1 in the final semantic 
action.  In this case, there would be no opportunity to use $3 
legitimately, and so USE($3) would be necessary to suppress the warning.  
In other words, scratch my above conjecture: there may actually be cases 
where USE is necessary for mid-rule values.

This brings me back to my earlier question.  How often do these issues 
arise?  That is, do you believe this warning is too much trouble to be 
worthwhile?  Surely it's useful in many cases, but could something be 
changed about it to accommodate the troublesome cases?  Or is it ok as is?

reply via email to

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