mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
* src/conflicts.c (conflicts_print): Don't complain at all when
there are no reduce/reduce conflicts, and as many shift/reduce conflicts as expected. * tests/regression.at (%expect right): Adjust.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2001-11-26 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/conflicts.c (conflicts_print): Don't complain at all when
|
||||||
|
there are no reduce/reduce conflicts, and as many shift/reduce
|
||||||
|
conflicts as expected.
|
||||||
|
* tests/regression.at (%expect right): Adjust.
|
||||||
|
|
||||||
2001-11-25 Marc Autret <autret_m@epita.fr>
|
2001-11-25 Marc Autret <autret_m@epita.fr>
|
||||||
|
|
||||||
* doc/bison.texinfo (Mystery Conflicts): Hint '-v' use.
|
* doc/bison.texinfo (Mystery Conflicts): Hint '-v' use.
|
||||||
|
|||||||
@@ -439,6 +439,11 @@ conflicts_print (void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is
|
||||||
|
not set, and then we want 0 SR, or else it is specified, in which
|
||||||
|
case we want equality. */
|
||||||
|
int src_ok = 0;
|
||||||
|
|
||||||
int src_total = 0;
|
int src_total = 0;
|
||||||
int rrc_total = 0;
|
int rrc_total = 0;
|
||||||
|
|
||||||
@@ -450,31 +455,34 @@ conflicts_print (void)
|
|||||||
rrc_total += count_rr_conflicts (i);
|
rrc_total += count_rr_conflicts (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
src_ok = src_total == (expected_conflicts == -1 ? 0 : expected_conflicts);
|
||||||
|
|
||||||
|
/* If there are no RR conflicts, and as many SR conflicts as
|
||||||
|
expected, then there is nothing to report. */
|
||||||
|
if (!rrc_total && src_ok)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Report the total number of conflicts on STDERR. */
|
/* Report the total number of conflicts on STDERR. */
|
||||||
if (src_total || rrc_total)
|
if (yacc_flag)
|
||||||
{
|
{
|
||||||
if (yacc_flag)
|
/* If invoked with `--yacc', use the output format specified by
|
||||||
{
|
POSIX. */
|
||||||
/* If invoked with `--yacc', use the output format specified by
|
fprintf (stderr, _("conflicts: "));
|
||||||
POSIX. */
|
if (src_total > 0)
|
||||||
fprintf (stderr, _("conflicts: "));
|
fprintf (stderr, _(" %d shift/reduce"), src_total);
|
||||||
if (src_total > 0)
|
if (src_total > 0 && rrc_total > 0)
|
||||||
fprintf (stderr, _(" %d shift/reduce"), src_total);
|
fprintf (stderr, ",");
|
||||||
if (src_total > 0 && rrc_total > 0)
|
if (rrc_total > 0)
|
||||||
fprintf (stderr, ",");
|
fprintf (stderr, _(" %d reduce/reduce"), rrc_total);
|
||||||
if (rrc_total > 0)
|
putc ('\n', stderr);
|
||||||
fprintf (stderr, _(" %d reduce/reduce"), rrc_total);
|
}
|
||||||
putc ('\n', stderr);
|
else
|
||||||
}
|
{
|
||||||
else
|
fprintf (stderr, _("%s contains "), infile);
|
||||||
{
|
fputs (conflict_report (src_total, rrc_total), stderr);
|
||||||
fprintf (stderr, _("%s contains "), infile);
|
|
||||||
fputs (conflict_report (src_total, rrc_total), stderr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expected_conflicts != -1
|
if (expected_conflicts != -1 && !src_ok)
|
||||||
&& src_total != expected_conflicts)
|
|
||||||
{
|
{
|
||||||
complain_message_count++;
|
complain_message_count++;
|
||||||
fprintf (stderr, ngettext ("expected %d shift/reduce conflict\n",
|
fprintf (stderr, ngettext ("expected %d shift/reduce conflict\n",
|
||||||
|
|||||||
@@ -275,9 +275,7 @@ AT_DATA([input.y],
|
|||||||
exp: exp OP exp | NUM;
|
exp: exp OP exp | NUM;
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison input.y -o input.c], 0, [],
|
AT_CHECK([bison input.y -o input.c], 0)
|
||||||
[input.y contains 1 shift/reduce conflict.
|
|
||||||
])
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user