bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-l


From: Akim Demaille
Subject: Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form
Date: Tue, 25 Sep 2012 20:24:19 +0200

Le 24 sept. 2012 à 21:54, Paul Eggert a écrit :

> On 09/24/2012 12:40 AM, Akim Demaille wrote:
>> #1
>>  foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
>>  foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
>> 
>>  bar.y: 1 shift/reduce conflict, expected 0
>>  bar.y: 2 reduce/reduce conflicts, expected 0
>> 
>> Proposal #2:
>>  foo.y: warning: shift/reduce conflicts: 1 found [-Wconflicts-sr]
>>  foo.y: warning: reduce/reduce conflicts: 2 found [-Wconflicts-rr]
>> 
>>  bar.y: shift/reduce conflicts: 1 found, 2 expected
>>  bar.y: reduce/reduce conflicts: 2 found, 0 expected
> 
> Ignoring the problem of implementation and just thinking
> about nice English, I prefer #1 for the first set of warnings
> and #2 for the second set.  That is:
> 
>   foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
>   foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
> 
>   bar.y: shift/reduce conflicts: 1 found, 2 expected
>   bar.y: reduce/reduce conflicts: 2 found, 0 expected
> 
> Prefixing the second set with "error:" would be fine.

Thanks!  So I installed the appended version of this patch
(together with the others of this series).  Fixing the test-suite,
especially the test "-W versus %expect and %expect-rr"
was a real PITA :(  But it's done :)

commit d87ea54cf6cc98d52356c138bd142d1b450bbc9a
Author: Akim Demaille <address@hidden>
Date:   Fri Sep 21 17:21:01 2012 +0200

    warnings: use the regular interface for s/r and r/r conflicts
    
    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).
    
    It was due to the belief (dating back to the initial checked-in
    version of Bison) that, at some point, POSIX Yacc mandated the format
    for these messages.  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>.
    
    For a discussion on the chosen warning format, see
    http://lists.gnu.org/archive/html/bison-patches/2012-09/msg00039.html
    
    In an effort to factor the handling of errors and warnings, use the
    Bison warning routines 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.

diff --git a/NEWS b/NEWS
index 9cabf05..bc66a4c 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: shift/reduce conflicts: 1 found, 0 expected
+    bar.y: reduce/reduce conflicts: 2 found, 0 expected
+
 ** 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..99f096a 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,57 @@ 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,
+                    _("shift/reduce conflicts: %d found, %d expected"),
+                    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,
+                    _("reduce/reduce conflicts: %d found, %d expected"),
+                    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..83ef128 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: shift/reduce conflicts: 1 found, 0 expected
+]])
 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: shift/reduce conflicts: 1 found, 2 expected
+]])
 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: reduce/reduce conflicts: 1 found, 0 expected
+]])
 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
 
@@ -1551,36 +1560,38 @@ AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], 
[[]],
       echo "$directives" > $file
       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
-      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
-      fi
+      # Number of found conflicts.
+      case $gram in
+        (sr)    sr_count=1; rr_count=0;;
+        (rr)    sr_count=0; rr_count=1;;
+        (sr-rr) sr_count=1; rr_count=1;;
+      esac
+
+      # Update number of expected conflicts: if %expect is given then
+      # %expect-rr defaults to 0, and vice-versa.  Leave empty if
+      # nothing expected.
+      case $sr_exp_i:$rr_exp_i in
+        ?:) rr_exp_i=0;;
+        :?) sr_exp_i=0;;
+      esac
 
       # Run tests.
       if test $sr_count -eq $sr_exp && test $rr_count -eq $rr_exp; then
         ]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
+        {
+          if test -z "$sr_exp_i" && test "$sr_count" -ne 0; then
+            echo "warning: $sr_count shift/reduce conflicts"
+          elif test "$sr_exp_i" -ne "$sr_count"; then
+            echo "shift/reduce conflicts: $sr_count found, $sr_exp_i expected"
+          fi
+          if test -z "$rr_exp_i" && test "$rr_count" -ne 0; then
+            echo "warning: $rr_count reduce/reduce conflicts"
+          elif test "$rr_exp_i" -ne "$rr_count"; then
+            echo "reduce/reduce conflicts: $rr_count found, $rr_exp_i expected"
+          fi
+        } | sed -e "s/^/$file: /" > 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




reply via email to

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