/* Allocate input grammar variables for Bison.
- Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003, 2005 Free
+ Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003, 2005, 2006 Free
Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
bool
rule_useless_p (rule *r)
{
- return r->number >= nrules;
+ return !rule_useful_p (r);
}
bool
rule_never_reduced_p (rule *r)
{
- return !r->useful && r->number < nrules;
+ return !r->useful && rule_useful_p (r);
}
if (!rules[r].useful)
{
location_print (stderr, rules[r].location);
- fprintf (stderr, ": %s: %s: ",
- _("warning"), message);
+ fprintf (stderr, ": %s: %s: ", _("warning"), message);
rule_print (&rules[r], stderr);
}
}
void
grammar_free (void)
{
- free (ritem);
+ if (ritem)
+ free (ritem - 1);
free (rules);
free (token_translations);
/* Free the symbol table data structure. */