#include <config.h>
#include "system.h"
-#include <quotearg.h>
-
#include "complain.h"
#include "getargs.h"
#include "gram.h"
item_number *rp;
for (rp = r->rhs; *rp >= 0; rp++)
fprintf (out, " %s", symbols[*rp]->tag);
- fputc ('\n', out);
}
else
{
- fprintf (out, " /* %s */\n", _("empty"));
+ fprintf (out, " /* %s */", _("empty"));
}
}
}
}
-void
+static void
rule_print (rule *r, FILE *out)
{
fprintf (out, "%s:", r->lhs->tag);
first = false;
rule_lhs_print (&rules[r], previous_lhs, out);
rule_rhs_print (&rules[r], out);
+ fprintf (out, "\n");
previous_lhs = rules[r].lhs;
}
if (!first)
{
fprintf (out, "%-5d ", r);
rule_print (&rules[r], out);
+ fprintf (out, "\n");
}
}
fprintf (out, "\n\n");
void
grammar_rules_useless_report (const char *message)
{
- rule_number r;
- for (r = 0; r < nrules ; ++r)
- if (!rules[r].useful)
- {
- warn_at (rules[r].location, "%s: ", message);
- if (warnings_flag & warnings_other)
+ warnings w = Wother;
+ if (warnings_flag & w)
+ {
+ rule_number r;
+ for (r = 0; r < nrules ; ++r)
+ if (!rules[r].useful)
{
+ complain (&rules[r].location, w | silent, "%s: ", message);
rule_print (&rules[r], stderr);
- fflush (stderr);
+ warnings_print_categories (w);
+ fprintf (stderr, "\n");
}
- }
+ }
}
void