Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Akim Demaille


Le 4 nov. 08 à 20:47, Joel E. Denny a écrit :


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.


The problem with this fix is that it is very C/C++/Java based.  That  
is why is was obsoleted and I believed that Paul had agreed to get rid  
of it.  I'm obviously wrong.


The day we add support for languages that are not using ; as these  
languages do, we'll have problems.  If possible, I'd like to add a  
warning so that code that lacks this ';' is reported (I don't know yet  
how feasible this warning is).






Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Akim Demaille


Le 4 nov. 08 à 21:21, Joel E. Denny a écrit :


On Tue, 4 Nov 2008, Akim Demaille wrote:

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

master soon.


The problem with this fix is that it is very C/C++/Java based.   
That is why
is was obsoleted and I believed that Paul had agreed to get rid of  
it.  I'm

obviously wrong.

The day we add support for languages that are not using ; as these  
languages
do, we'll have problems.  If possible, I'd like to add a warning so  
that code
that lacks this ';' is reported (I don't know yet how feasible this  
warning

is).


I thought about the possibility of a warning too.  It seems like
/[};]\s*$/ is the right pattern, but I have this feeling I'm  
forgetting
some special case that will annoy users with correct grammars.   
Actually,

there could be trailing comments or cpp directives.


Yep, definitely.

Alternatively, we could just formally deprecate it in NEWS now and  
then

drop support as soon as it gets in the way of other languages.


NEWS should warn about this now.


I'll wait until we've settled this before pushing this fix to master.


AFAIC, you can do it now.



Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Joel E. Denny
On Tue, 4 Nov 2008, Akim Demaille wrote:

  Alternatively, we could just formally deprecate it in NEWS now and then
  drop support as soon as it gets in the way of other languages.
 
 NEWS should warn about this now.

I didn't find it... except for --yacc.  Maybe I missed it.  Or are you 
agreeing that we should add it?

  I'll wait until we've settled this before pushing this fix to master.
 
 AFAIC, you can do it now.

OK, I pushed it.




Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Akim Demaille


Le 4 nov. 08 à 22:02, Joel E. Denny a écrit :


On Tue, 4 Nov 2008, Akim Demaille wrote:

Alternatively, we could just formally deprecate it in NEWS now and  
then

drop support as soon as it gets in the way of other languages.


NEWS should warn about this now.


I didn't find it... except for --yacc.  Maybe I missed it.  Or are you
agreeing that we should add it?


Yes, sorry, I did not realize that was ambiguous.  I'm doing it now.



Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Joel E. Denny
On Tue, 4 Nov 2008, Akim Demaille wrote:

 I added the following.
 
 ** Temporary hack for adding a semicolon to the user action.

Thanks.

 Looking at the code, I think the simplest solution would be to provide a means
 not to issue the ';'.  It then suffices that one person tries to build with
 the feature disabled.  Currently it is bound to --yacc only, which is not
 good enough (it influences many more features).
 
 Adding an option is a PITA.
 
 I'm tempted by the envvar approach, but that's hacky :)
 
   BISON_NO_ADDED_SEMICOLON=1 bison ...

It seems logical that %language and %skeleton should do it.




Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Sergei Steshenko



--- On Tue, 11/4/08, Akim Demaille [EMAIL PROTECTED] wrote:

 From: Akim Demaille [EMAIL PROTECTED]
 Subject: Re: bison-2.4 breaks gcc-4.3.2 build
 To: Akim Demaille [EMAIL PROTECTED]
 Cc: Joel E. Denny [EMAIL PROTECTED], bug-bison@gnu.org, Sergei 
 Steshenko [EMAIL PROTECTED]
 Date: Tuesday, November 4, 2008, 1:33 PM
 Le 4 nov. 08 à 22:09, Akim Demaille a écrit :
 
[snip]
 Adding an option is a PITA.
 
 I'm tempted by the envvar approach, but that's
 hacky :)
 
   BISON_NO_ADDED_SEMICOLON=1 bison ...

Actually, adding a command line option is better generally speaking.

This is because command line option affects only the tool in question
('bison' in this case) while environment variables can collide since they
are global. At all, I once was forced in a work environment with 400+
environment variables, and awfully strange things were happening in it -
because when environment space is overflown, there is not even a warning.

So for the rest of my life I'm against environment variables :-).

Thanks,
  Sergei.







Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Joel E. Denny
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 [EMAIL PROTECTED]
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/msg1.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 [EMAIL PROTECTED]
 Satya Kiran Popuri[EMAIL PROTECTED]
 Sebastien Fricker [EMAIL PROTECTED]
 Sebastian Setzer  [EMAIL PROTECTED]
+Sergei Steshenko  [EMAIL PROTECTED]
 Shura [EMAIL PROTECTED]
 Steve Murphy  [EMAIL PROTECTED]
 Tim Josling   [EMAIL PROTECTED]
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/msg1.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








Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-04 Thread Joel E. Denny
On Tue, 4 Nov 2008, Akim Demaille wrote:

  I thought about the possibility of a warning too.  It seems like
  /[};]\s*$/ is the right pattern, but I have this feeling I'm forgetting
  some special case that will annoy users with correct grammars.  Actually,
  there could be trailing comments or cpp directives.

Oh wait, I apparently didn't think of any of this.  It seems I had read 
about it in the source code comments. :)




Re: bison-2.4 breaks gcc-4.3.2 build

2008-11-03 Thread Joel E. Denny
On Mon, 3 Nov 2008, Sergei Steshenko wrote:

 I've been routinely building various gcc version with bison-2.3 with no 
 problems.

Thanks for doing that.  It would be helpful if you would do the same for 
Bison test releases, such as 2.3a and 2.3b, before formal releases come 
out.

 bison-2.4 breaks the build, the error messages are:
 
 
 /home/sergei/AFSWD/build/gcc-4.3.2/./prev-gcc/xgcc 
 -B/home/sergei/AFSWD/build/gcc-4.3.2/./prev-gcc/ 
 -B/home/sergei/AFSWD/install/gcc-4.3.2/i686-pc-linux-gnu/bin/ -c   -g -O2 
 -fomit-frame-pointer -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes 
 -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute 
 -pedantic -Wno-long-long -Wno-variadic-macros 
  -Wno-overlength-strings  -Wno-error  -DHAVE_CONFIG_H -I. -Itreelang 
 -I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc 
 -I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang 
 -I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../include 
 -I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../libcpp/include 
 -I/home/sergei/AFSWD/install/gmp-4.2.2/include 
 -I/home/sergei/AFSWD/install/mpfr-2.3.2/include 
 -I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../libdecnumber 
 -I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../libdecnumber/bid 
 -I../libdecnumber
  -I/home/sergei/AFSWD/install/autoconf-2.63/include 
 -I/home/sergei/AFSWD/install/autogen-5.8.7/include 
 -I/home/sergei/AFSWD/install/bash-3.0/include 
 -I/home/sergei/AFSWD/install/bison-2.4/include 
 -I/home/sergei/AFSWD/install/dejagnu-1.4.4/include 
 -I/home/sergei/AFSWD/install/expect-5.44.1/include 
 -I/home/sergei/AFSWD/install/flex-2.5.35/include 
 -I/home/sergei/AFSWD/install/gmp-4.2.2/include 
 -I/home/sergei/AFSWD/install/gperf-3.0.3/include 
 -I/home/sergei/AFSWD/install/guile-1.8.5/include 
 -I/home/sergei/AFSWD/install/libtool-1.5.26/include 
 -I/home/sergei/AFSWD/install/m4-1.4.12/include 
 -I/home/sergei/AFSWD/install/make-3.80/include 
 -I/home/sergei/AFSWD/install/mpfr-2.3.2/include 
 -I/home/sergei/AFSWD/install/ncurses-5.7/include 
 -I/home/sergei/AFSWD/install/readline-5.1/include 
 -I/home/sergei/AFSWD/install/tcl-8.4.19/include 
 -I/home/sergei/AFSWD/install/texinfo-4.13/include 
 -I/home/sergei/AFSWD/install/tk-8.4.19/include   treelang/parse.c -o 
 treelang/parse.o
 /home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang/parse.y: In function 
 ???yyparse???:
 /home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang/parse.y:689: error: 
 expected ???;??? before ???}??? token
 /home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang/parse.y:690: error: 
 expected ???;??? before ???}??? token
 make[3]: *** [treelang/parse.o] Error 1
 make[3]: Leaving directory `/home/sergei/AFSWD/build/gcc-4.3.2/gcc'
 make[2]: *** [all-stage2-gcc] Error 2
 make[2]: Leaving directory `/home/sergei/AFSWD/build/gcc-4.3.2'
 make[1]: *** [stage2-bubble] Error 2
 make[1]: Leaving directory `/home/sergei/AFSWD/build/gcc-4.3.2'
 make: *** [all] Error 2
 
 
 - looks like 'bison' does not put the final ';'.

I haven't seen this happen.  From your report, I can't tell where the 
semicolon is missing.  Please show us that part of the code.  A small test 
grammar would be nice as well.

bison-2.4 breaks gcc-4.3.2 build

2008-11-03 Thread Sergei Steshenko
Hello,

I've been routinely building various gcc version with bison-2.3 with no 
problems.

bison-2.4 breaks the build, the error messages are:


/home/sergei/AFSWD/build/gcc-4.3.2/./prev-gcc/xgcc 
-B/home/sergei/AFSWD/build/gcc-4.3.2/./prev-gcc/ 
-B/home/sergei/AFSWD/install/gcc-4.3.2/i686-pc-linux-gnu/bin/ -c   -g -O2 
-fomit-frame-pointer -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute 
-pedantic -Wno-long-long -Wno-variadic-macros  
-Wno-overlength-strings  -Wno-error  -DHAVE_CONFIG_H -I. -Itreelang 
-I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc 
-I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang 
-I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../include 
-I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../libcpp/include 
-I/home/sergei/AFSWD/install/gmp-4.2.2/include 
-I/home/sergei/AFSWD/install/mpfr-2.3.2/include 
-I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../libdecnumber 
-I/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/../libdecnumber/bid 
-I../libdecnumber
 -I/home/sergei/AFSWD/install/autoconf-2.63/include 
-I/home/sergei/AFSWD/install/autogen-5.8.7/include 
-I/home/sergei/AFSWD/install/bash-3.0/include 
-I/home/sergei/AFSWD/install/bison-2.4/include 
-I/home/sergei/AFSWD/install/dejagnu-1.4.4/include 
-I/home/sergei/AFSWD/install/expect-5.44.1/include 
-I/home/sergei/AFSWD/install/flex-2.5.35/include 
-I/home/sergei/AFSWD/install/gmp-4.2.2/include 
-I/home/sergei/AFSWD/install/gperf-3.0.3/include 
-I/home/sergei/AFSWD/install/guile-1.8.5/include 
-I/home/sergei/AFSWD/install/libtool-1.5.26/include 
-I/home/sergei/AFSWD/install/m4-1.4.12/include 
-I/home/sergei/AFSWD/install/make-3.80/include 
-I/home/sergei/AFSWD/install/mpfr-2.3.2/include 
-I/home/sergei/AFSWD/install/ncurses-5.7/include 
-I/home/sergei/AFSWD/install/readline-5.1/include 
-I/home/sergei/AFSWD/install/tcl-8.4.19/include 
-I/home/sergei/AFSWD/install/texinfo-4.13/include 
-I/home/sergei/AFSWD/install/tk-8.4.19/include   treelang/parse.c -o 
treelang/parse.o
/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang/parse.y: In function 
‘yyparse’:
/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang/parse.y:689: error: 
expected ‘;’ before ‘}’ token
/home/sergei/AFSWD/build/gcc-4.3.2.src/gcc/treelang/parse.y:690: error: 
expected ‘;’ before ‘}’ token
make[3]: *** [treelang/parse.o] Error 1
make[3]: Leaving directory `/home/sergei/AFSWD/build/gcc-4.3.2/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/sergei/AFSWD/build/gcc-4.3.2'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/sergei/AFSWD/build/gcc-4.3.2'
make: *** [all] Error 2


- looks like 'bison' does not put the final ';'.

Regards,
  Sergei.