error_message (loc, flags, _("warning"), message, args);
}
}
- else
+ else if (warnings_flag & flags)
{
- if (! (warnings_flag & flags))
- return;
set_warning_issued ();
error_message (loc, flags, _("warning"), message, args);
}
void
grammar_rules_useless_report (const char *message)
{
- rule_number r;
- for (r = 0; r < nrules ; ++r)
- if (!rules[r].useful)
- {
- complain_at (rules[r].location, Wother, "%s: ", message);
- if (warnings_flag & Wother)
+ warnings w = Wother;
+ if (warnings_flag & w)
+ {
+ rule_number r;
+ for (r = 0; r < nrules ; ++r)
+ if (!rules[r].useful)
{
+ complain_at (rules[r].location, w, "%s: ", message);
rule_print (&rules[r], stderr);
fflush (stderr);
}
tables_generate ();
timevar_pop (TV_ACTIONS);
- grammar_rules_useless_report
- (_("rule useless in parser due to conflicts"));
+ grammar_rules_useless_report (_("rule useless in parser due to conflicts"));
/* Output file names. */
compute_output_file_names ();
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
{
complain_at (declaration_loc, complaint,
- _("result type clash on merge function %s: <%s> != <%s>"),
- quote (merge_function->name), type, merge_function->type);
+ _("result type clash on merge function %s: <%s> != <%s>"),
+ quote (merge_function->name), type, merge_function->type);
complain_at (merge_function->type_declaration_location, complaint,
- _("previous declaration"));
+ _("previous declaration"));
}
merge_function->type = uniqstr_new (type);
merge_function->type_declaration_location = declaration_loc;
/* The default action, $$ = $1, `uses' both. */
&& (r->action_props.code || (n != 0 && n != 1)))
{
- int warn_flag =
- midrule_warning ? Wmidrule_values : Wother;
+ warnings warn_flag = midrule_warning ? Wmidrule_values : Wother;
if (n)
complain_at (r->location, warn_flag, _("unused value: $%d"), n);
else
{
if (nuseless_nonterminals > 0)
complain (Wother, ngettext ("%d nonterminal useless in grammar",
- "%d nonterminals useless in grammar",
- nuseless_nonterminals),
+ "%d nonterminals useless in grammar",
+ nuseless_nonterminals),
nuseless_nonterminals);
if (nuseless_productions > 0)
complain (Wother, ngettext ("%d rule useless in grammar",
- "%d rules useless in grammar",
- nuseless_productions),
+ "%d rules useless in grammar",
+ nuseless_productions),
nuseless_productions);
}
\f
{
grammar_dump (stderr, "Reduced Grammar");
- fprintf (stderr, "reduced %s defines %d terminals, %d nonterminals\
-, and %d productions.\n",
+ fprintf (stderr, "reduced %s defines %d terminals, %d nonterminals"
+ ", and %d productions.\n",
grammar_file, ntokens, nvars, nrules);
}
}