/* Grammar reduction for Bison.
- Copyright (C) 1988, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
if (ISVAR (*rhsp) && !bitset_test (N0, *rhsp - ntokens))
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
{
rule_number_t r;
for (r = 0; r < nrules; r++)
- {
- rules[r].useful = bitset_test (P, r);
- if (!rules[r].useful)
- {
- LOCATION_PRINT (stderr, rules[r].location);
- fprintf (stderr, ": %s: %s: ", _("warning"), _("useless rule"));
- rule_print (&rules[r], stderr);
- }
- }
+ rules[r].useful = bitset_test (P, r);
+ grammar_rules_never_reduced_report (_("useless rule"));
}
/* Map the nonterminals to their new index: useful first, useless
if (!bitset_test (V, i))
{
nontermmap[i] = n++;
- LOCATION_PRINT (stderr, symbols[i]->location);
- fprintf (stderr, ": %s: %s: %s\n",
- _("warning"), _("useless nonterminal"),
+ warn_at (symbols[i]->location, _("useless nonterminal: %s"),
symbols[i]->tag);
}
if (nuseless_nonterminals > 0)
{
int i;
- fprintf (out, "%s\n\n", _("Useless nonterminals:"));
+ fprintf (out, "%s\n\n", _("Useless nonterminals"));
for (i = 0; i < nuseless_nonterminals; ++i)
fprintf (out, " %s\n", symbols[nsyms + i]->tag);
fputs ("\n\n", out);
}
{
- bool b = FALSE;
+ bool b = false;
int i;
for (i = 0; i < ntokens; i++)
if (!bitset_test (V, i) && !bitset_test (V1, i))
{
if (!b)
- fprintf (out, "%s\n\n", _("Terminals which are not used:"));
- b = TRUE;
+ fprintf (out, "%s\n\n", _("Terminals which are not used"));
+ b = true;
fprintf (out, " %s\n", symbols[i]->tag);
}
if (b)
if (nuseless_productions > 0)
grammar_rules_partial_print (out, _("Useless rules"),
- nrules,
- nrules + nuseless_productions);
+ rule_useless_p);
}
\f
nuseless_productions),
nuseless_productions);
- fprintf (stderr, "%s: %s: ", infile, _("warning"));
+ fprintf (stderr, "%s: %s: ", grammar_file, _("warning"));
if (nuseless_nonterminals > 0)
fprintf (stderr, ngettext ("%d useless nonterminal",
if (nuseless_productions > 0)
reduce_grammar_tables ();
- if (trace_flag)
+ if (trace_flag & trace_grammar)
{
grammar_dump (stderr, "Reduced Grammar");
fprintf (stderr, "reduced %s defines %d terminals, %d nonterminals\
, and %d productions.\n",
- infile, ntokens, nvars, nrules);
+ grammar_file, ntokens, nvars, nrules);
}
}