Clean up recent patches a little.

Reported by Akim Demaille.
* doc/bison.texinfo (Understanding): Fix typos.
* src/print.c (print_reductions): Don't use negated variable.
(cherry picked from commit 379261b3fd)
This commit is contained in:
Joel E. Denny
2009-04-24 02:13:26 -04:00
parent f49097730e
commit 8f0d265e9d
3 changed files with 14 additions and 7 deletions

View File

@@ -1,3 +1,10 @@
2009-04-24 Joel E. Denny <jdenny@ces.clemson.edu>
Clean up recent patches a little.
Reported by Akim Demaille.
* doc/bison.texinfo (Understanding): Fix typos.
* src/print.c (print_reductions): Don't use negated variable.
2009-04-24 Joel E. Denny <jdenny@ces.clemson.edu> 2009-04-24 Joel E. Denny <jdenny@ces.clemson.edu>
List accepted values for a %define enum variable with an invalid value. List accepted values for a %define enum variable with an invalid value.

View File

@@ -7473,8 +7473,8 @@ useless: STR;
@command{bison} reports: @command{bison} reports:
@example @example
tmp.y: warning: 1 nonterminal useless in grammar calc.y: warning: 1 nonterminal useless in grammar
tmp.y: warning: 1 rule useless in grammar calc.y: warning: 1 rule useless in grammar
calc.y:11.1-7: warning: nonterminal useless in grammar: useless calc.y:11.1-7: warning: nonterminal useless in grammar: useless
calc.y:11.10-12: warning: rule useless in grammar: useless: STR calc.y:11.10-12: warning: rule useless in grammar: useless: STR
calc.y: conflicts: 7 shift/reduce calc.y: conflicts: 7 shift/reduce

View File

@@ -245,7 +245,7 @@ print_reductions (FILE *out, state *s)
rule *default_reduction = NULL; rule *default_reduction = NULL;
size_t width = 0; size_t width = 0;
int i, j; int i, j;
bool non_default_action = false; bool default_reduction_only = true;
if (reds->num == 0) if (reds->num == 0)
return; return;
@@ -299,7 +299,7 @@ print_reductions (FILE *out, state *s)
bool defaulted = false; bool defaulted = false;
bool count = bitset_test (no_reduce_set, i); bool count = bitset_test (no_reduce_set, i);
if (count) if (count)
non_default_action = true; default_reduction_only = false;
for (j = 0; j < reds->num; ++j) for (j = 0; j < reds->num; ++j)
if (bitset_test (reds->lookahead_tokens[j], i)) if (bitset_test (reds->lookahead_tokens[j], i))
@@ -308,7 +308,7 @@ print_reductions (FILE *out, state *s)
{ {
if (reds->rules[j] != default_reduction) if (reds->rules[j] != default_reduction)
{ {
non_default_action = true; default_reduction_only = false;
print_reduction (out, width, print_reduction (out, width,
symbols[i]->tag, symbols[i]->tag,
reds->rules[j], true); reds->rules[j], true);
@@ -319,7 +319,7 @@ print_reductions (FILE *out, state *s)
} }
else else
{ {
non_default_action = true; default_reduction_only = false;
if (defaulted) if (defaulted)
print_reduction (out, width, print_reduction (out, width,
symbols[i]->tag, symbols[i]->tag,
@@ -339,7 +339,7 @@ print_reductions (FILE *out, state *s)
print_reduction (out, width, _("$default"), default_reduction, true); print_reduction (out, width, _("$default"), default_reduction, true);
aver (0 == strcmp (default_reductions, "all") aver (0 == strcmp (default_reductions, "all")
|| (0 == strcmp (default_reductions, "consistent") || (0 == strcmp (default_reductions, "consistent")
&& !non_default_action) && default_reduction_only)
|| (reds->num == 1 && reds->rules[0]->number == 0)); || (reds->num == 1 && reds->rules[0]->number == 0));
free (default_reductions); free (default_reductions);
} }