X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/e9690142325711b320ef444768fdd40a087d02f7..7aaaad6c6dc0fae412d608dcf20a3977d8902cd1:/src/reduce.c diff --git a/src/reduce.c b/src/reduce.c index c45ce6ea..736cbb6a 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -1,6 +1,6 @@ /* Grammar reduction for Bison. - Copyright (C) 1988-1989, 2000-2003, 2005-2011 Free Software + Copyright (C) 1988-1989, 2000-2003, 2005-2012 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -29,7 +29,6 @@ #include "system.h" #include -#include #include "complain.h" #include "files.h" @@ -286,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++; @@ -300,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); }