X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/520144aadc34f57ac0572ded66ab62fc32cb3069..9fd33c2b6ef5d98ac14ac7d83bc453b148fda768:/src/reduce.c

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);
       }