help-bison
[Top][All Lists]
Advanced

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

%destructor and unused values


From: John P. Hartmann
Subject: %destructor and unused values
Date: Mon, 28 Jan 2013 12:41:59 +0100

I have a fine grammar, but I get unset value warnings in droves when I add
empty %destructor declartions (the error token is not [yet] referenced).

This applies to Bison 2.5 on Fedora 17 and also 2.4.1 on Fedora13.

%union
{
   struct instruction * inst;
   struct expression * exp;
   struct term term;
   int kwd;
}

/*
%destructor {} <inst>
%destructor {} <exp>
%destructor {} <term>
*/
%destructor {} <kwd>

The offending rule:

               |  PARSE parsehow parsecase parsewhat SEMICOLON
                  {
                     $$=GETINSTXP(@$, parse, $4);
                  }

The messages:

rexxy.y:401.19-404.19: warning: unused value: $2
rexxy.y:401.19-404.19: warning: unused value: $3

It is true that $2 and $3 are not referenced in the action.  In this
particular context they are valid, but have no effect.

If I comment out the destructor, the grammar is processed without errors or
warnings.


reply via email to

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