bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] use the regular warning interface for s/r and r/r conflicts


From: Akim Demaille
Subject: [PATCH 3/3] use the regular warning interface for s/r and r/r conflicts
Date: Fri, 21 Sep 2012 18:00:24 +0200

The current routines used to display s/r and r/r conflicts are both
inconvenient from the programmer point of view (they do not use the
warning infrastructure) and for the user (the messages are rather
terse, not necessarily pleasant to read, and because they don't use
the same routines, they look different).

This due because at some point, POSIX Yacc have mandated the format
for these messages.  Yet, today, the Open Group's manual page for
Yacc, <http://pubs.opengroup.org/onlinepubs/009695399/utilities/yacc.html>,
explicitly states that the format of these messages is unspecified.

See commit be7280480c175bed203883f524c7dcd6cf37c13d and
<http://lists.gnu.org/archive/html/bison-patches/2002-12/msg00027.html>.

In an effort to factor the handling of errors and warnings, use a more
Bison system to report these messages.

* src/conflicts.c (conflicts_print): Rewrite with clearer sections
about S/R and then R/R conflicts.
(conflict_report): Remove, inlined in its sole
caller...
(conflicts_output): here.
* tests/conflicts.at, tests/existing.at, tests/glr-regression.at,
* tests/reduce.at, tests/regression.at: Adjust the expected results.
* NEWS: Update.
---
 NEWS                    |  47 ++++++++++++++++++
 src/conflicts.c         | 128 ++++++++++++++++++++++--------------------------
 tests/conflicts.at      |  98 +++++++++++++++++++-----------------
 tests/existing.at       |  10 ++--
 tests/glr-regression.at |  70 +++++++++++++-------------
 tests/reduce.at         |   2 +-
 tests/regression.at     |   4 +-
 7 files changed, 203 insertions(+), 156 deletions(-)

diff --git a/NEWS b/NEWS
index 9cabf05..1327290 100644
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,53 @@ GNU Bison NEWS
     %printer    {} token1 <type1> <type3>
     %destructor {} token2 <type2> <type4>
 
+*** Conflicts
+
+  The warnings and error messages about shift/reduce and reduce/reduce
+  conflicts have been normalized.  For instance on the following foo.y file:
+
+    %glr-parser
+    %%
+    exp: exp '+' exp | '0' | '0';
+
+  compare the previous version of bison:
+
+    $ bison foo.y
+    foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
+    $ bison -Werror foo.y
+    bison: warnings being treated as errors
+    foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
+
+  with the new behavior:
+
+    $ bison foo.y
+    foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+    foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
+    $ bison -Werror foo.y
+    bison: warnings being treated as errors
+    foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+    foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
+
+  When %expect or %expect-rr is used, such as with bar.y:
+
+    %expect 0
+    %glr-parser
+    %%
+    exp: exp '+' exp | '0' | '0';
+
+  Former behavior:
+
+    $ bison bar.y
+    bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
+    bar.y: expected 0 shift/reduce conflicts
+    bar.y: expected 0 reduce/reduce conflicts
+
+  New one:
+
+    $ bison bar.y
+    bar.y: 1 shift/reduce conflict, expected 0
+    bar.y: 2 reduce/reduce conflicts, expected 0
+
 ** Additional yylex/yyparse arguments
 
   The new directive %param declares additional arguments to both yylex and
diff --git a/src/conflicts.c b/src/conflicts.c
index 6ab47d4..cd1da89 100644
--- a/src/conflicts.c
+++ b/src/conflicts.c
@@ -505,22 +505,6 @@ count_rr_conflicts (bool one_per_token)
   return res;
 }
 
-/*--------------------------------------------------------.
-| Report the number of conflicts, using the Yacc format.  |
-`--------------------------------------------------------*/
-
-static void
-conflict_report (FILE *out, size_t src_num, size_t rrc_num)
-{
-  if (src_num && rrc_num)
-    fprintf (out, _("conflicts: %zd shift/reduce, %zd reduce/reduce\n"),
-             src_num, rrc_num);
-  else if (src_num)
-    fprintf (out, _("conflicts: %zd shift/reduce\n"), src_num);
-  else if (rrc_num)
-    fprintf (out, _("conflicts: %zd reduce/reduce\n"), rrc_num);
-}
-
 
 /*-----------------------------------------------------------.
 | Output the detailed description of states with conflicts.  |
@@ -536,10 +520,17 @@ conflicts_output (FILE *out)
       state *s = states[i];
       if (conflicts[i])
         {
+          int src = count_state_sr_conflicts (s);
+          int rrc = count_state_rr_conflicts (s, true);
           fprintf (out, _("State %d "), i);
-          conflict_report (out,
-                           count_state_sr_conflicts (s),
-                           count_state_rr_conflicts (s, true));
+          if (src && rrc)
+            fprintf (out,
+                     _("conflicts: %d shift/reduce, %d reduce/reduce\n"),
+                     src, rrc);
+          else if (src)
+            fprintf (out, _("conflicts: %d shift/reduce\n"), src);
+          else if (rrc)
+            fprintf (out, _("conflicts: %d reduce/reduce\n"), rrc);
           printed_sth = true;
         }
     }
@@ -568,64 +559,61 @@ conflicts_total_count (void)
 void
 conflicts_print (void)
 {
-  /* 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.  */
-  bool src_ok;
-  bool rrc_ok;
-
-  int src_expected;
-  int rrc_expected;
-
-  int src_total = count_sr_conflicts ();
-  int rrc_total = count_rr_conflicts (true);
-
   if (! glr_parser && expected_rr_conflicts != -1)
     {
       complain (Wother, _("%%expect-rr applies only to GLR parsers"));
       expected_rr_conflicts = -1;
     }
 
-  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 (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
-    {
-      if (!(warnings_flag & Wconflicts_sr))
-        src_total = 0;
-      if (!(warnings_flag & Wconflicts_rr))
-        rrc_total = 0;
-    }
-  if (src_total | rrc_total)
-    {
-      if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
-        set_warning_issued ();
-      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 (complaint,
+                    ngettext ("%d shift/reduce conflict, expected %d",
+                              "%d shift/reduce conflicts, expected %d",
+                              total),
+                    total, expected);
+      }
+    else if (total)
+      complain (Wconflicts_sr,
+                ngettext ("%d shift/reduce conflict",
+                          "%d shift/reduce conflicts",
+                          total),
+                total);
+  }
 
-  if (expected_sr_conflicts != -1 || expected_rr_conflicts != -1)
-    {
-      if (! src_ok)
-        complain (complaint, ngettext ("expected %d shift/reduce conflict",
-                                       "expected %d shift/reduce conflicts",
-                                       src_expected),
-                  src_expected);
-      if (! rrc_ok)
-        complain (complaint, ngettext ("expected %d reduce/reduce conflict",
-                                       "expected %d reduce/reduce conflicts",
-                                       rrc_expected),
-                  rrc_expected);
-    }
+  {
+    int total = count_rr_conflicts (true);
+    // If %expect-rr is not used, but %expect is, then expect 0 rr.
+    int expected =
+      (expected_rr_conflicts == -1 && expected_sr_conflicts != -1)
+      ? 0
+      : expected_rr_conflicts;
+    if (expected != -1)
+      {
+        if (expected != total)
+          complain (complaint,
+                    ngettext ("%d reduce/reduce conflict, expected %d",
+                              "%d reduce/reduce conflicts, expected %d",
+                              total),
+                    total, expected);
+      }
+    else if (total)
+      complain (Wconflicts_rr,
+                ngettext ("%d reduce/reduce conflict",
+                          "%d reduce/reduce conflicts",
+                          total),
+                total);
+  }
 }
 
 
diff --git a/tests/conflicts.at b/tests/conflicts.at
index 169509f..0a64538 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -498,7 +498,7 @@ AT_BISON_OPTION_POPDEFS
 # Show canonical LR's failure.
 AT_BISON_CHECK([[-Dlr.type=canonical-lr -o input.c input.y]],
                [[0]], [[]],
-[[input.y: conflicts: 2 shift/reduce
+[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
 ]])
 AT_COMPILE([[input]])
 AT_PARSER_CHECK([[./input]], [[1]], [[]],
@@ -508,7 +508,7 @@ AT_PARSER_CHECK([[./input]], [[1]], [[]],
 # It's corrected by LAC.
 AT_BISON_CHECK([[-Dlr.type=canonical-lr -Dparse.lac=full \
                  -o input.c input.y]], [[0]], [[]],
-[[input.y: conflicts: 2 shift/reduce
+[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
 ]])
 AT_COMPILE([[input]])
 AT_PARSER_CHECK([[./input]], [[1]], [[]],
@@ -518,7 +518,7 @@ AT_PARSER_CHECK([[./input]], [[1]], [[]],
 # IELR is sufficient when LAC is used.
 AT_BISON_CHECK([[-Dlr.type=ielr -Dparse.lac=full -o input.c input.y]],
                [[0]], [[]],
-[[input.y: conflicts: 2 shift/reduce
+[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
 ]])
 AT_COMPILE([[input]])
 AT_PARSER_CHECK([[./input]], [[1]], [[]],
@@ -542,8 +542,8 @@ exp: exp OP exp | NUM;
 ]])
 
 AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
-[input.y: conflicts: 1 shift/reduce
-])
+[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+]])
 
 # Check the contents of the report.
 AT_CHECK([cat input.output], [],
@@ -784,7 +784,7 @@ cond:
 ]])
 
 AT_BISON_CHECK([-o input.c input.y], 0, [],
-[[input.y: conflicts: 1 shift/reduce
+[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 input.y:12.3-18: warning: rule useless in parser due to conflicts: cond: cond 
"then" cond [-Wother]
 ]])
 
@@ -828,7 +828,7 @@ id : '0';
 ]])
 
 AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
-[[input.y: conflicts: 1 reduce/reduce
+[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 input.y:4.6-8: warning: rule useless in parser due to conflicts: id: '0' 
[-Wother]
 ]])
 
@@ -945,9 +945,8 @@ exp: exp OP exp | NUM;
 ]])
 
 AT_BISON_CHECK([-o input.c input.y], 1, [],
-[input.y: conflicts: 1 shift/reduce
-input.y: expected 0 shift/reduce conflicts
-])
+[[input.y: 1 shift/reduce conflict, expected 0
+]])
 AT_CLEANUP
 
 
@@ -982,9 +981,8 @@ exp: exp OP exp | NUM;
 ]])
 
 AT_BISON_CHECK([-o input.c input.y], 1, [],
-[input.y: conflicts: 1 shift/reduce
-input.y: expected 2 shift/reduce conflicts
-])
+[[input.y: 1 shift/reduce conflict, expected 2
+]])
 AT_CLEANUP
 
 
@@ -1002,9 +1000,8 @@ a: 'a';
 ]])
 
 AT_BISON_CHECK([-o input.c input.y], 1, [],
-[input.y: conflicts: 1 reduce/reduce
-input.y: expected 0 reduce/reduce conflicts
-])
+[[input.y: 1 reduce/reduce conflict, expected 0
+]])
 AT_CLEANUP
 
 
@@ -1046,7 +1043,7 @@ e:   e '+' e
 ]])
 
 AT_BISON_CHECK([-o input.c input.y], 0, [],
-[[input.y: conflicts: 4 shift/reduce
+[[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
 ]])
 AT_CLEANUP
 
@@ -1148,7 +1145,8 @@ reported_conflicts:
 ]])
 
 AT_BISON_CHECK([[--report=all input.y]], 0, [],
-[[input.y: conflicts: 1 shift/reduce, 1 reduce/reduce
+[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 input.y:12.5-20: warning: rule useless in parser due to conflicts: 
resolved_conflict: 'a' unreachable1 [-Wother]
 input.y:20.5-20: warning: rule useless in parser due to conflicts: 
unreachable1: 'a' unreachable2 [-Wother]
 input.y:21.4: warning: rule useless in parser due to conflicts: unreachable1: 
/* empty */ [-Wother]
@@ -1300,7 +1298,8 @@ AT_DATA([[input-keep.y]],
 AT_CHECK([[cat input.y >> input-keep.y]])
 
 AT_BISON_CHECK([[input-keep.y]], 0, [],
-[[input-keep.y: conflicts: 2 shift/reduce, 2 reduce/reduce
+[[input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
+input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
 input-keep.y:22.4: warning: rule useless in parser due to conflicts: 
unreachable1: /* empty */ [-Wother]
 input-keep.y:26.16: warning: rule useless in parser due to conflicts: 
unreachable2: /* empty */ [-Wother]
 input-keep.y:32.5-7: warning: rule useless in parser due to conflicts: 
reported_conflicts: 'a' [-Wother]
@@ -1483,7 +1482,7 @@ exp: 'a' | 'a';
 
 AT_BISON_CHECK([[2.y]], [[0]], [],
 [[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
-2.y: conflicts: 1 reduce/reduce
+2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 2.y:3.12-14: warning: rule useless in parser due to conflicts: exp: 'a' 
[-Wother]
 ]])
 
@@ -1518,17 +1517,27 @@ B: ;
 ]])
 
 AT_BISON_CHECK([[sr-rr.y]], [[0]], [[]],
-[[sr-rr.y: conflicts: 1 shift/reduce, 1 reduce/reduce
+[[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 ]])
 AT_BISON_CHECK([[-Wno-conflicts-sr sr-rr.y]], [[0]], [[]],
-[[sr-rr.y: conflicts: 1 reduce/reduce
+[[sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 ]])
 AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], [[]],
-[[sr-rr.y: conflicts: 1 shift/reduce
+[[sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 ]])
 
-[for gram in sr-rr sr rr; do
+[
+# This is piece of code is rather complex for a simple task: try every
+# combinaison of (0 or 1 real SR) x (0 or 1 real RR) x (don't %expect
+# or %expect 0, 1, or 2 SR) x (don't %expect-rr or %expect-rr 0, 1, or 2
+# RR).
+
+# Number and types of genuine conflicts in the grammar.
+for gram in sr-rr sr rr; do
+  # Number of expected s/r conflicts.
   for sr_exp_i in '' 0 1 2; do
+    # Number of expected r/r conflicts.
     for rr_exp_i in '' 0 1 2; do
       test -z "$sr_exp_i" && test -z "$rr_exp_i" && continue
 
@@ -1552,19 +1561,23 @@ AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], 
[[]],
       cat $gram.y >> $file
 
       # Count actual conflicts.
-      conflicts=
-      sr_count=0
-      rr_count=0
-      if test $gram = sr || test $gram = sr-rr; then
-        conflicts="1 shift/reduce"
-        sr_count=1
+      case $gram in
+        (sr|sr-rr) sr_count=1 sr_conflicts="1 shift/reduce conflict";;
+        (*)        sr_count=0 sr_conflicts="0 shift/reduce conflicts";;
+      esac
+      if test $sr_count -ne $sr_exp; then
+        sr_conflicts="$sr_conflicts, expected $sr_exp"
+      elif test -n "$sr_exp_i" || test $sr_count -eq 0; then
+        sr_conflicts=
       fi
-      if test $gram = rr || test $gram = sr-rr; then
-        if test -n "$conflicts"; then
-          conflicts="$conflicts, "
-        fi
-        conflicts="${conflicts}1 reduce/reduce"
-        rr_count=1
+      case $gram in
+        (rr|sr-rr) rr_count=1 rr_conflicts="1 reduce/reduce conflict";;
+        (*)        rr_count=0 rr_conflicts="0 reduce/reduce conflicts";;
+      esac
+      if test $rr_count -ne $rr_exp; then
+        rr_conflicts="$rr_conflicts, expected $rr_exp"
+      elif test -n "$rr_exp_i" || test $rr_count -eq 0; then
+        rr_conflicts=
       fi
 
       # Run tests.
@@ -1572,15 +1585,10 @@ AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], 
[[]],
         ]AT_BISON_CHECK([[-Wnone $file]])[
         ]AT_BISON_CHECK([[-Werror $file]])[
       else
-        echo "$file: conflicts: $conflicts" > experr
-        if test $sr_count -ne $sr_exp; then
-          if test $sr_exp -ne 1; then s=s; else s= ; fi
-          echo "$file: expected $sr_exp shift/reduce conflict$s" >> experr
-        fi
-        if test $rr_count -ne $rr_exp; then
-          if test $rr_exp -ne 1; then s=s; else s= ; fi
-          echo "$file: expected $rr_exp reduce/reduce conflict$s" >> experr
-        fi
+        {
+          test -z "$sr_conflicts" || echo "$file: $sr_conflicts"
+          test -z "$rr_conflicts" || echo "$file: $rr_conflicts"
+        } > experr
         ]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[
         ]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[
       fi
diff --git a/tests/existing.at b/tests/existing.at
index f62430c..d5cb39d 100644
--- a/tests/existing.at
+++ b/tests/existing.at
@@ -424,8 +424,8 @@ dnl don't like even `print $!4;'.
 
 dnl BISON-STDERR
 [AT_COND_CASE([[canonical LR]],
-[[input.y: conflicts: 265 shift/reduce]],
-[[input.y: conflicts: 65 shift/reduce]])[
+[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
+[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
 ]],
 
 dnl LAST-STATE
@@ -1365,8 +1365,10 @@ dnl INPUT
 
 dnl BISON-STDERR
 [AT_COND_CASE([[canonical LR]],
-[[input.y: conflicts: 1876 shift/reduce, 144 reduce/reduce]],
-[[input.y: conflicts: 78 shift/reduce, 10 reduce/reduce]])[
+[[input.y: warning: 1876 shift/reduce conflicts [-Wconflicts-sr]
+input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
+[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
+input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
 ]],
 
 dnl LAST-STATE
diff --git a/tests/glr-regression.at b/tests/glr-regression.at
index 07c9fe2..98ebdfa 100644
--- a/tests/glr-regression.at
+++ b/tests/glr-regression.at
@@ -93,8 +93,8 @@ yylex (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr1.c glr-regr1.y]], 0, [],
-[glr-regr1.y: conflicts: 1 shift/reduce
-])
+[[glr-regr1.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+]])
 AT_COMPILE([glr-regr1])
 AT_PARSER_CHECK([[echo BPBPB | ./glr-regr1]], 0,
 [[E -> 'B'
@@ -208,8 +208,8 @@ main (int argc, char **argv)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr2a.c glr-regr2a.y]], 0, [],
-[glr-regr2a.y: conflicts: 2 shift/reduce
-])
+[[glr-regr2a.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
+]])
 AT_COMPILE([glr-regr2a])
 
 AT_PARSER_CHECK([[echo s VARIABLE_1 t v x q | ./glr-regr2a]], 0,
@@ -325,8 +325,9 @@ main(int argc, char* argv[])
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr3.c glr-regr3.y]], 0, [],
-[glr-regr3.y: conflicts: 1 shift/reduce, 1 reduce/reduce
-])
+[[glr-regr3.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+glr-regr3.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr3])
 
 AT_PARSER_CHECK([[echo p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 | ./glr-regr3]],
@@ -417,8 +418,8 @@ merge (YYSTYPE s1, YYSTYPE s2)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr4.c glr-regr4.y]], 0, [],
-[glr-regr4.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr4.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr4])
 
 AT_PARSER_CHECK([[./glr-regr4]], 0,
@@ -477,8 +478,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr5.c glr-regr5.y]], 0, [],
-[glr-regr5.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr5.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr5])
 
 AT_PARSER_CHECK([[./glr-regr5]], 0, [],
@@ -529,8 +530,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr6.c glr-regr6.y]], 0, [],
-[glr-regr6.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr6.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr6])
 
 AT_PARSER_CHECK([[./glr-regr6]], 0,
@@ -618,8 +619,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr7.c glr-regr7.y]], 0, [],
-[glr-regr7.y: conflicts: 2 reduce/reduce
-])
+[[glr-regr7.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr7])
 
 AT_PARSER_CHECK([[./glr-regr7]], 2, [],
@@ -712,8 +713,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr8.c glr-regr8.y]], 0, [],
-[glr-regr8.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr8.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr8])
 
 AT_PARSER_CHECK([[./glr-regr8]], 0,
@@ -792,8 +793,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr9.c glr-regr9.y]], 0, [],
-[glr-regr9.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr9.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr9])
 
 AT_PARSER_CHECK([[./glr-regr9]], 0, [],
@@ -848,8 +849,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr10.c glr-regr10.y]], 0, [],
-[glr-regr10.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr10.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr10])
 
 AT_PARSER_CHECK([[./glr-regr10]], 0, [], [])
@@ -906,8 +907,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr11.c glr-regr11.y]], 0, [],
-[glr-regr11.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr11.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr11])
 
 AT_PARSER_CHECK([[./glr-regr11]], 0, [], [])
@@ -1027,8 +1028,9 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr12.c glr-regr12.y]], 0, [],
-[glr-regr12.y: conflicts: 1 shift/reduce, 1 reduce/reduce
-])
+[[glr-regr12.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
+glr-regr12.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr12])
 
 AT_PARSER_CHECK([[./glr-regr12]], 0, [], [])
@@ -1357,8 +1359,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr14.c glr-regr14.y]], 0, [],
-[glr-regr14.y: conflicts: 3 reduce/reduce
-])
+[[glr-regr14.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr14])
 
 AT_PARSER_CHECK([[./glr-regr14]], 0,
@@ -1450,8 +1452,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr15.c glr-regr15.y]], 0, [],
-[glr-regr15.y: conflicts: 2 reduce/reduce
-])
+[[glr-regr15.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr15])
 
 AT_PARSER_CHECK([[./glr-regr15]], 0, [],
@@ -1510,8 +1512,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr16.c glr-regr16.y]], 0, [],
-[glr-regr16.y: conflicts: 1 reduce/reduce
-])
+[[glr-regr16.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr16])
 
 AT_PARSER_CHECK([[./glr-regr16]], 0, [],
@@ -1595,8 +1597,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o glr-regr17.c glr-regr17.y]], 0, [],
-[glr-regr17.y: conflicts: 3 reduce/reduce
-])
+[[glr-regr17.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
+]])
 AT_COMPILE([glr-regr17])
 
 AT_PARSER_CHECK([[./glr-regr17]], 0, [],
@@ -1698,8 +1700,8 @@ main (void)
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([[-o input.c input.y]], 0, [],
-[input.y: conflicts: 1 reduce/reduce
-])
+[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
+]])
 AT_COMPILE([input])
 
 AT_PARSER_CHECK([[./input]], 1, [],
diff --git a/tests/reduce.at b/tests/reduce.at
index a30e688..25ce83f 100644
--- a/tests/reduce.at
+++ b/tests/reduce.at
@@ -1191,7 +1191,7 @@ dnl INPUT
 
 dnl BISON-STDERR
 [AT_COND_CASE([[LALR]],
-[[input.y: conflicts: 1 reduce/reduce
+[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 ]], [])],
 
 dnl TABLES
diff --git a/tests/regression.at b/tests/regression.at
index cdc1572..5911c53 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -1461,7 +1461,7 @@ main (void)
 AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
                  -Dparse.lac.memory-trace=full \
                  -t -o input.c input.y]], [[0]], [],
-[[input.y: conflicts: 21 shift/reduce
+[[input.y: warning: 21 shift/reduce conflicts [-Wconflicts-sr]
 ]])
 AT_COMPILE([[input]])
 AT_PARSER_CHECK([[./input > stdout.txt 2> stderr.txt]], [[1]])
@@ -1537,7 +1537,7 @@ main (void)
 
 AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
                  -t -o input.c input.y]], [[0]], [],
-[[input.y: conflicts: 8 shift/reduce
+[[input.y: warning: 8 shift/reduce conflicts [-Wconflicts-sr]
 ]])
 AT_COMPILE([[input]])
 AT_BISON_OPTION_POPDEFS
-- 
1.7.12.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]