]> git.saurik.com Git - bison.git/commitdiff
* src/conflicts.c (conflicts_print): Don't complain at all when
authorAkim Demaille <akim@epita.fr>
Mon, 26 Nov 2001 09:18:40 +0000 (09:18 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 26 Nov 2001 09:18:40 +0000 (09:18 +0000)
there are no reduce/reduce conflicts, and as many shift/reduce
conflicts as expected.
* tests/regression.at (%expect right): Adjust.

ChangeLog
NEWS
doc/version.texi
src/conflicts.c
tests/regression.at

index 8421bf2b179284a985694e7fb1f3143114d902cb..39ea13d6a8081878e8fba47b1eca991bb6693ebc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * doc/bison.texinfo (Mystery Conflicts): Hint '-v' use.
 2001-11-25  Marc Autret  <autret_m@epita.fr>
 
        * doc/bison.texinfo (Mystery Conflicts): Hint '-v' use.
diff --git a/NEWS b/NEWS
index ca8e807325411cdd753fb67a896c3056362d4da5..b2b9c10f4aa6b2b41a0ac247583d923a811c77ed 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@ Bison News
 
 Changes in version 1.30e:
 
 
 Changes in version 1.30e:
 
+* %expect
+  When the number of shift/reduce conflicts is correct, don't issue
+  any warning.
+
 * The verbose report includes the rule line numbers.
 
 * Rule line numbers are fixed in traces.
 * The verbose report includes the rule line numbers.
 
 * Rule line numbers are fixed in traces.
index 034b932652a3d55b36dfb5cbb0986f6684f2ecef..3bb3d79dcbd9acb5c1a8171a8b6b2db1fa342d60 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 12 November 2001
+@set UPDATED 26 November 2001
 @set UPDATED-MONTH November 2001
 @set EDITION 1.30e
 @set VERSION 1.30e
 @set UPDATED-MONTH November 2001
 @set EDITION 1.30e
 @set VERSION 1.30e
index 6e2671048042d92a69efd660272bc68a30bba762..b6bacb94cde8d4e9444eb43f6e57e49d540e2c92 100644 (file)
@@ -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 rrc_total = 0;
 
   int src_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.  */
-         fprintf (stderr, _("conflicts: "));
-         if (src_total > 0)
-           fprintf (stderr, _(" %d shift/reduce"), src_total);
-         if (src_total > 0 && rrc_total > 0)
-           fprintf (stderr, ",");
-         if (rrc_total > 0)
-           fprintf (stderr, _(" %d reduce/reduce"), rrc_total);
-         putc ('\n', stderr);
-       }
-      else
-       {
-         fprintf (stderr, _("%s contains "), infile);
-         fputs (conflict_report (src_total, rrc_total), stderr);
-       }
+      /* If invoked with `--yacc', use the output format specified by
+        POSIX.  */
+      fprintf (stderr, _("conflicts: "));
+      if (src_total > 0)
+       fprintf (stderr, _(" %d shift/reduce"), src_total);
+      if (src_total > 0 && rrc_total > 0)
+       fprintf (stderr, ",");
+      if (rrc_total > 0)
+       fprintf (stderr, _(" %d reduce/reduce"), rrc_total);
+      putc ('\n', stderr);
+    }
+  else
+    {
+      fprintf (stderr, _("%s contains "), infile);
+      fputs (conflict_report (src_total, rrc_total), stderr);
     }
 
     }
 
-  if (expected_conflicts != -1
-      && src_total != expected_conflicts)
+  if (expected_conflicts != -1 && !src_ok)
     {
       complain_message_count++;
       fprintf (stderr, ngettext ("expected %d shift/reduce conflict\n",
     {
       complain_message_count++;
       fprintf (stderr, ngettext ("expected %d shift/reduce conflict\n",
index 2de592b27052c55125d529008c12678720b97a16..a18bfc451dfed1986eedce79d332c91916e0606a 100644 (file)
@@ -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, [],
-[input.y contains 1 shift/reduce conflict.
-])
+AT_CHECK([bison input.y -o input.c], 0)
 AT_CLEANUP
 
 
 AT_CLEANUP