help-bison
[Top][All Lists]
Advanced

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

Re: warning: unused value: $3


From: Hans Aberg
Subject: Re: warning: unused value: $3
Date: Wed, 25 Oct 2006 21:22:35 +0200

On 25 Oct 2006, at 17:05, address@hidden wrote:

Hi Bison list,

using bison version 2.2.
Message from bison:
pl1-parser.y:873.17-63: warning: unused value: $3

This warning I find a bit confusing...


Line 873 contains: |    procoptionlist ',' {$$=$1;} procoption {$$=$1;}
$3 refers to the embedded action after the comma.

My grammar set a number of attributes in an allocated structure using $0 to
reference the structure on the stack. The full rules are as follow

procoptionlist:
  { $<pol>$ = newProcOptionList(); }
          procoption
  { $$ = $<pol>1; }
|       procoptionlist procoption {$$=$1;}
|       procoptionlist ',' {$$=$1;} procoption {$$=$1;}
        ;

procoption:
MAIN { if(setTristateAttribute(&($<pol>0)->main,1)<0) YYERROR; }
;


unless I am missing something $3 in line 873 is by the rule procoption.
Is there anyway to supress this IMO, unnecessary warning.

I think you should take away the use of $0, because it may no longer be guaranteed, in view of that Bison is switching to other types of containers than an underlying array. Then you mid-rule action becomes unnecessary.

  Hans Aberg






reply via email to

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