mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 14:53:03 +00:00
warnings: factoring: complaints
* src/complain.c (error_message): Accept warning categories (an integer) as argument. Location is a 'const location *' instead of 'location *'. (ERROR_MESSAGE): Delete it. * src/complain.c, src/complain.h (complains): New function. (complain, complain_at, complain_at_indent): Generic functions for complaints. Call 'complains'. (warn_at, warn_at_indent, warn, yacc_at, midrule_value_at) (fatal_at, fatal): Delete them. Adjust dependencies. * src/complain.h (enum warnings): New fields 'complaint' and 'fatal'. * bootstrap.conf (XGETTEXT_OPTIONS): Adjust.
This commit is contained in:
committed by
Akim Demaille
parent
d0f11c1b62
commit
6fb8b25619
28
src/reduce.c
28
src/reduce.c
@@ -299,9 +299,9 @@ nonterminals_reduce (void)
|
||||
{
|
||||
nontermmap[i - ntokens] = n++;
|
||||
if (symbols[i]->status != used)
|
||||
warn_at (symbols[i]->location,
|
||||
_("nonterminal useless in grammar: %s"),
|
||||
symbols[i]->tag);
|
||||
complain_at (symbols[i]->location, Wother,
|
||||
_("nonterminal useless in grammar: %s"),
|
||||
symbols[i]->tag);
|
||||
}
|
||||
|
||||
|
||||
@@ -383,15 +383,15 @@ static void
|
||||
reduce_print (void)
|
||||
{
|
||||
if (nuseless_nonterminals > 0)
|
||||
warn (ngettext ("%d nonterminal useless in grammar",
|
||||
"%d nonterminals useless in grammar",
|
||||
nuseless_nonterminals),
|
||||
nuseless_nonterminals);
|
||||
complain (Wother, ngettext ("%d nonterminal useless in grammar",
|
||||
"%d nonterminals useless in grammar",
|
||||
nuseless_nonterminals),
|
||||
nuseless_nonterminals);
|
||||
if (nuseless_productions > 0)
|
||||
warn (ngettext ("%d rule useless in grammar",
|
||||
"%d rules useless in grammar",
|
||||
nuseless_productions),
|
||||
nuseless_productions);
|
||||
complain (Wother, ngettext ("%d rule useless in grammar",
|
||||
"%d rules useless in grammar",
|
||||
nuseless_productions),
|
||||
nuseless_productions);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -416,9 +416,9 @@ reduce_grammar (void)
|
||||
reduce_print ();
|
||||
|
||||
if (!bitset_test (N, accept->number - ntokens))
|
||||
fatal_at (startsymbol_location,
|
||||
_("start symbol %s does not derive any sentence"),
|
||||
startsymbol->tag);
|
||||
complain_at (startsymbol_location, fatal,
|
||||
_("start symbol %s does not derive any sentence"),
|
||||
startsymbol->tag);
|
||||
|
||||
/* First reduce the nonterminals, as they renumber themselves in the
|
||||
whole grammar. If you change the order, nonterms would be
|
||||
|
||||
Reference in New Issue
Block a user