From 11652ab3dc44bf12d5fa9095d1495b5cd3102ff7 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 7 Apr 2002 15:30:42 +0000 Subject: [PATCH] * src/reduce.c (inaccessable_symbols): Fix a buglet: because of a lacking `+ 1' to nrules, Bison reported as useless a token if it was used solely to set the precedence of the last rule... --- ChangeLog | 7 +++++++ NEWS | 10 ++++++++++ src/reduce.c | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 900c04b2..604e31cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-04-07 Akim Demaille + + * src/reduce.c (inaccessable_symbols): Fix a buglet: because of a + lacking `+ 1' to nrules, Bison reported as useless a token if it + was used solely to set the precedence of the last rule... + + 2002-04-07 Akim Demaille * data/bison.c++, data/bison.simple: Don't output the current file diff --git a/NEWS b/NEWS index 311237fb..6d86faf3 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,16 @@ Bison News Changes in version 1.49a: +* False `Token not used' report fixed. + On a grammar such as + + %token useless useful + %% + exp: '0' %prec useful; + + where a token was used to set the precedence of the last rule, + bison reported both `useful' and `useless' as useless tokens. + * Revert the C++ namespace changes introduced in 1.31, as they caused too many portability hassles. diff --git a/src/reduce.c b/src/reduce.c index c5e9381d..58bf43ea 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -215,7 +215,7 @@ inaccessable_symbols (void) nuseless_nonterminals = nvars - nuseful_nonterminals; /* A token that was used in %prec should not be warned about. */ - for (i = 1; i < nrules; i++) + for (i = 1; i < nrules + 1; i++) if (rules[i].precsym != 0) bitset_set (V1, rules[i].precsym); } -- 2.47.2