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

Re: FYI: bison-1.875 lets gcc bootstraps fail



> From: Matthias Klose <doko@cs.tu-berlin.de>
> Date: Fri, 10 Jan 2003 08:56:07 +0100
> 
> objc-parse.y: conflicts: 31 shift/reduce, 1 reduce/reduce
> objc-parse.y: expected 0 reduce/reduce conflicts

Thanks for the bug report.  This failure is due to two recent changes
to Bison.  The first one appeared in Bison test version 1.30b:

	2001-11-12  Akim Demaille  <akim@epita.fr>

		* src/conflicts.c (conflicts_print): Check %expect and make
		its violation an error.

and the 2nd one first appeared in Bison test version 1.75f:

	2002-12-26  Paul Eggert  <eggert@twinsun.com>

		* src/conflicts.c (conflicts_print): If the user specifies
		"%expect N", report an error if there are any reduce/reduce
		conflicts.  This is what the manual says should happen.
		This fixes Debian bug 130890, reported by Anthony DeRobertis.

In the interests of backward compatibility I am inclined to alter the
Bison exit status to be what it was before Bison test version 1.30b.
If we want %expect-count violations to cause Bison to exit, perhaps we
can introduce a new feature (--pedantic-errors or %pedantic-errors,
say?) to do that, after Bison 2.0 comes out.  So I propose the
following Bison patch for now.  However I haven't installed it yet.

2003-01-10  Paul Eggert  <eggert@twinsun.com>

	* NEWS: %expect-violations are now just warnings, reverting
	to older Bison behavior (pre Bison 1.30b).  This problem was
	exposed by the 2002-12-26 change to src/conflicts.c.
	* src/conflicts.c (conflicts_print): Likewise.
	* tests/conflicts.at (%expect not enough, %expect too much,
	%expect with reduce conflicts): Likewise.
	* doc/bison.texinfo (Expect Decl): Document this.  Also mention
	that the warning is enabled if the number of conflicts changes
	(not necessarily increases).


--- old/NEWS	5 Jan 2003 06:32:12 -0000	1.88
+++ new/NEWS	11 Jan 2003 07:56:19 -0000
@@ -3,6 +3,11 @@ Bison News
 
 Changes in version 1.875a:
 
+* %expect-violations are now just warnings, not errors, for
+  compatibility with Bison 1.75 and earlier (when there are
+  reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
+  are too many or too few shift/reduce conflicts).
+
 * New configure option --disable-yacc, to disable installation of the
   yacc command and -ly library introduced in 1.875 for POSIX conformance.
 
--- old/doc/bison.texinfo	7 Jan 2003 06:39:17 -0000	1.99
+++ new/doc/bison.texinfo	11 Jan 2003 07:56:22 -0000
@@ -3558,7 +3558,7 @@ The declaration looks like this:
 
 Here @var{n} is a decimal integer.  The declaration says there should be
 no warning if there are @var{n} shift/reduce conflicts and no
-reduce/reduce conflicts.  An error, instead of the usual warning, is
+reduce/reduce conflicts.  The usual warning is
 given if there are either more or fewer conflicts, or if there are any
 reduce/reduce conflicts.
 
@@ -3580,9 +3580,9 @@ Add an @code{%expect} declaration, copyi
 number which Bison printed.
 @end itemize
 
-Now Bison will stop annoying you about the conflicts you have checked, but
-it will warn you again if changes in the grammar result in additional
-conflicts.
+Now Bison will stop annoying you if you do not change the number of
+conflicts, but it will warn you again if changes in the grammar result
+in more or fewer conflicts.
 
 @node Start Decl
 @subsection The Start-Symbol
--- old/src/conflicts.c	29 Dec 2002 01:58:49 -0000	1.102
+++ new/src/conflicts.c	11 Jan 2003 07:56:23 -0000
@@ -495,12 +495,12 @@ conflicts_print (void)
   if (expected_conflicts != -1)
     {
       if (! src_ok)
-	complain (ngettext ("expected %d shift/reduce conflict",
-			    "expected %d shift/reduce conflicts",
-			    expected_conflicts),
-		  expected_conflicts);
+	warn (ngettext ("expected %d shift/reduce conflict",
+			"expected %d shift/reduce conflicts",
+			expected_conflicts),
+	      expected_conflicts);
       if (rrc_total)
-	complain (_("expected 0 reduce/reduce conflicts"));
+	warn (_("expected 0 reduce/reduce conflicts"));
     }
 }
 
--- old/tests/conflicts.at	29 Dec 2002 01:59:13 -0000	1.24
+++ new/tests/conflicts.at	11 Jan 2003 07:56:23 -0000
@@ -485,9 +485,9 @@ AT_DATA([input.y],
 exp: exp OP exp | NUM;
 ]])
 
-AT_CHECK([bison -o input.c input.y], 1, [],
+AT_CHECK([bison -o input.c input.y], 0, [],
 [input.y: conflicts: 1 shift/reduce
-input.y: expected 0 shift/reduce conflicts
+input.y: warning: expected 0 shift/reduce conflicts
 ])
 AT_CLEANUP
 
@@ -522,9 +522,9 @@ AT_DATA([input.y],
 exp: exp OP exp | NUM;
 ]])
 
-AT_CHECK([bison -o input.c input.y], 1, [],
+AT_CHECK([bison -o input.c input.y], 0, [],
 [input.y: conflicts: 1 shift/reduce
-input.y: expected 2 shift/reduce conflicts
+input.y: warning: expected 2 shift/reduce conflicts
 ])
 AT_CLEANUP
 
@@ -542,8 +542,8 @@ program: a 'a' | a a;
 a: 'a';
 ]])
 
-AT_CHECK([bison -o input.c input.y], 1, [],
+AT_CHECK([bison -o input.c input.y], 0, [],
 [input.y: conflicts: 1 reduce/reduce
-input.y: expected 0 reduce/reduce conflicts
+input.y: warning: expected 0 reduce/reduce conflicts
 ])
 AT_CLEANUP



Reply to: