X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/3e75a2c92b12766add442d00a86d5ec1c67ce560..22b081deb7ab1d0ec7a279e5213fa7fdc2c85207:/src/reduce.c?ds=sidebyside diff --git a/src/reduce.c b/src/reduce.c index de046ddb..736cbb6a 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -285,13 +285,12 @@ reduce_grammar_tables (void) static void nonterminals_reduce (void) { - symbol_number i, n; - /* Map the nonterminals to their new index: useful first, useless afterwards. Kept for later report. */ symbol_number *nontermmap = xnmalloc (nvars, sizeof *nontermmap); - n = ntokens; + symbol_number n = ntokens; + symbol_number i; for (i = ntokens; i < nsyms; i++) if (bitset_test (V, i)) nontermmap[i - ntokens] = n++; @@ -299,8 +298,10 @@ nonterminals_reduce (void) if (!bitset_test (V, i)) { nontermmap[i - ntokens] = n++; - warn_at (symbols[i]->location, _("nonterminal useless in grammar: %s"), - symbols[i]->tag); + if (symbols[i]->status != used) + warn_at (symbols[i]->location, + _("nonterminal useless in grammar: %s"), + symbols[i]->tag); }