help-bison
[Top][All Lists]
Advanced

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

Re: warning: unused value: $3


From: henrik . sorensen
Subject: Re: warning: unused value: $3
Date: Thu, 26 Oct 2006 22:06:50 +0200
User-agent: KMail/1.9.1

On Thursday 26 October 2006 21:35, Joel E. Denny wrote:
> 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?  
I use this construct all the time, and the problem will arise whenever an 
option can be preceeded by anything than blanks.

> That is, do you believe this warning is too much trouble to be 
> worthwhile?  
The warning would be ok, if it was only true.
> 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?
the best thing would to detect that the $3 in rule procoptionlist is 
referenced as $0 in procoption


Henrik




reply via email to

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