- src_expected = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts;
- rrc_expected = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts;
- src_ok = src_total == src_expected;
- rrc_ok = rrc_total == rrc_expected;
-
- /* If there are as many RR conflicts and SR conflicts as
- expected, then there is nothing to report. */
- if (rrc_ok & src_ok)
- return;
-
- /* Report the total number of conflicts on STDERR. */
- if (src_total | rrc_total)
- {
- if (! yacc_flag)
- fprintf (stderr, "%s: ", current_file);
- conflict_report (stderr, src_total, rrc_total);
- }
+ /* Screams for factoring, but almost useless because of the
+ different strings to translate. */
+ {
+ int total = count_sr_conflicts ();
+ /* If %expect is not used, but %expect-rr is, then expect 0 sr. */
+ int expected =
+ (expected_sr_conflicts == -1 && expected_rr_conflicts != -1)
+ ? 0
+ : expected_sr_conflicts;
+ if (expected != -1)
+ {
+ if (expected != total)
+ complain (NULL, complaint,
+ _("shift/reduce conflicts: %d found, %d expected"),
+ total, expected);
+ }
+ else if (total)
+ complain (NULL, Wconflicts_sr,
+ ngettext ("%d shift/reduce conflict",
+ "%d shift/reduce conflicts",
+ total),
+ total);
+ }