bug-bison
[Top][All Lists]
Advanced

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

Re: bison-2.4 breaks gcc-4.3.2 build


From: Joel E. Denny
Subject: Re: bison-2.4 breaks gcc-4.3.2 build
Date: Tue, 4 Nov 2008 14:47:55 -0500 (EST)

On Mon, 3 Nov 2008, Sergei Steshenko wrote:

> > And bison-2.3a does _not_ break the build, i.e. the
> > 'treelang' broken by
> > bison-2.4, bison-2.3b is not broken by bison-2.3a, but the

Either you did something wrong or something else strange is happening.  
2.3a has the same bug as 2.3b and 2.4:

  % echo '%% start: {asdf} ;' > tmp.y
  % ~/installs/bison/2.3/bin/bison tmp.y && grep asdf tmp.tab.c
      {asdf;}
  % ~/installs/bison/2.3a/bin/bison tmp.y && grep asdf tmp.tab.c
      {asdf}
  % ~/installs/bison/2.3b/bin/bison tmp.y && grep asdf tmp.tab.c
      {asdf}
  % ~/installs/bison/2.4/bin/bison tmp.y && grep asdf tmp.tab.c
      {asdf}

As far as I can tell (and according to Bison's source comments), this 
strange little feature is undocumented, and I don't know why the gcc 
maintainers would depend on it.  It's not that hard to type a semicolon.  
In general, I don't understand why people like to make life complicated by 
being so uselessly clever.  I guess this feature was originally introduced 
for compatibility with some other implementation of Yacc.

Anyway, I pushed the following to branch-2.4.1 to fix it.  I'll push to 
master soon.

Thanks for the report.

>From 14da0cdd075600829a4373b97645e75a8b1310ac Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Tue, 4 Nov 2008 13:26:59 -0500
Subject: [PATCH] Fix user actions without a trailing semicolon.

Reported by Sergei Steshenko at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
* THANKS (Sergei Steshenko): Add.
* src/scan-code.l (SC_RULE_ACTION): Fix it.
* tests/regression.at (Fix user actions without a trailing semicolon):
New test case.

diff --git a/THANKS b/THANKS
index 6785e2a..5f88c6c 100644
--- a/THANKS
+++ b/THANKS
@@ -79,6 +79,7 @@ Robert Anisko             address@hidden
 Satya Kiran Popuri        address@hidden
 Sebastien Fricker         address@hidden
 Sebastian Setzer          address@hidden
+Sergei Steshenko          address@hidden
 Shura                     address@hidden
 Steve Murphy              address@hidden
 Tim Josling               address@hidden
diff --git a/src/scan-code.l b/src/scan-code.l
index 630d45d..71c9076 100644
--- a/src/scan-code.l
+++ b/src/scan-code.l
@@ -1,6 +1,6 @@
 /* Bison Action Scanner                             -*- C -*-
 
-   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -170,7 +170,7 @@ splice       (\\[ \f\t\v]*\n)*
 
   "{"  STRING_GROW; ++braces_level;
   "}"  {
-    bool outer_brace = --braces_level < 0;
+    bool outer_brace = --braces_level == 0;
 
     /* As an undocumented Bison extension, append `;' before the last
        brace in braced code, so that the user code can omit trailing
diff --git a/tests/regression.at b/tests/regression.at
index 51bf3f3..6bfc8d0 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -1201,7 +1201,7 @@ AT_CLEANUP
 ## Token number in precedence declaration.  ##
 ## ---------------------------------------- ##
 
-AT_SETUP([[Token number in precedence declaration.]])
+AT_SETUP([[Token number in precedence declaration]])
 
 # POSIX says token numbers can be declared in %left, %right, and %nonassoc, but
 # we lost this in Bison 1.50.
@@ -1255,3 +1255,27 @@ AT_COMPILE([[input]])
 AT_PARSER_CHECK([[./input]])
 
 AT_CLEANUP
+
+
+
+## ----------------------------------------------- ##
+## Fix user actions without a trailing semicolon.  ##
+## ----------------------------------------------- ##
+
+AT_SETUP([[Fix user actions without a trailing semicolon]])
+
+# This feature is undocumented, but we accidentally broke it in 2.3a, and there
+# was a complaint at:
+# <http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
+
+AT_DATA([input.y],
+[[%%
+start: {asdffdsa} ;
+]])
+
+AT_BISON_CHECK([[-o input.c input.y]])
+AT_CHECK([[sed -n '/asdffdsa/s/^ *//p' input.c]], [[0]],
+[[{asdffdsa;}
+]])
+
+AT_CLEANUP
-- 
1.5.4.3








reply via email to

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