[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers
From: |
Akim Demaille |
Subject: |
Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers |
Date: |
Sat, 14 Jul 2012 09:13:57 +0200 |
Le 13 juil. 2012 à 19:31, Stefano Lattarini a écrit :
> On 07/13/2012 04:20 PM, Akim Demaille wrote:
>>
>> Sorry about these. Updated below, and in the branch too.
>>
> Thanks. I'm still seeing the test case 'yacc-bison-skeleton.sh' failing
> on the Debian 64 bit system gcc10.fsffrance.org. Below is the log:
Hi Stefano,
> Running from installcheck: no
> Using TAP: no
> PATH = ...
> yacc-bison-skeleton: running bison --version
> bison (GNU Bison) 2.3
> Written by Robert Corbett and Richard Stallman.
>
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> +++ pwd
> /home/slattarini/tmp/automake-1.12a/t/yacc-bison-skeleton.dir
> + cat
> + cat
> + cat
> + cat
> + aclocal-1.12a -Werror
> + autoconf
> + automake-1.12a --foreign -Werror -Wall -a
> configure.ac: installing './ylwrap'
> + mkdir build
> + cd build
> + ../configure 'YACC=bison -y'
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether build environment is sane... yes
> checking for a thread-safe mkdir -p... /bin/mkdir -p
> checking for gawk... gawk
> checking whether make sets $(MAKE)... yes
> checking whether make supports nested variables... yes
> checking for gcc... cc
> checking whether the C compiler works... yes
> checking for C compiler default output file name... a.out
> checking for suffix of executables...
> checking whether we are cross compiling... no
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether cc accepts -g... yes
> checking for cc option to accept ISO C89... none needed
> checking for style of include used by make... GNU
> checking dependency style of cc... gcc3
> checking for bison... bison -y
> checking that generated files are newer than configure... done
> configure: creating ./config.status
> config.status: creating Makefile
> config.status: executing depfiles commands
> + make
> /bin/sh ../ylwrap ../zardoz.y y.tab.c zardoz.c y.tab.h `echo zardoz.c | sed
> -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/`
> y.output zardoz.output -- bison -y -d --skeleton glr.c
> updating zardoz.h
> cc -DPACKAGE_NAME=\"yacc-bison-skeleton\"
> -DPACKAGE_TARNAME=\"yacc-bison-skeleton\" -DPACKAGE_VERSION=\"1.0\"
> -DPACKAGE_STRING=\"yacc-bison-skeleton\ 1.0\" -DPACKAGE_BUGREPORT=\"\"
> -DPACKAGE_URL=\"\" -DPACKAGE=\"yacc-bison-skeleton\" -DVERSION=\"1.0\" -I.
> -I.. -g -O2 -MT zardoz.o -MD -MP -MF .deps/zardoz.Tpo -c -o zardoz.o
> zardoz.c
> mv -f .deps/zardoz.Tpo .deps/zardoz.Po
> cc -DPACKAGE_NAME=\"yacc-bison-skeleton\"
> -DPACKAGE_TARNAME=\"yacc-bison-skeleton\" -DPACKAGE_VERSION=\"1.0\"
> -DPACKAGE_STRING=\"yacc-bison-skeleton\ 1.0\" -DPACKAGE_BUGREPORT=\"\"
> -DPACKAGE_URL=\"\" -DPACKAGE=\"yacc-bison-skeleton\" -DVERSION=\"1.0\" -I.
> -I.. -g -O2 -MT foo.o -MD -MP -MF .deps/foo.Tpo -c -o foo.o ../foo.c
> mv -f .deps/foo.Tpo .deps/foo.Po
> cc -g -O2 -o zardoz zardoz.o foo.o
> foo.o: In function `yylex':
>
> /home/slattarini/tmp/automake-1.12a/t/yacc-bison-skeleton.dir/build/../zardoz.y:2:
> multiple definition of `yylex'
>
> zardoz.o:/home/slattarini/tmp/automake-1.12a/t/yacc-bison-skeleton.dir/build/../zardoz.y:2:
> first defined here
> foo.o: In function `yyerror':
>
> /home/slattarini/tmp/automake-1.12a/t/yacc-bison-skeleton.dir/build/../zardoz.y:3:
> multiple definition of `yyerror'
>
> zardoz.o:/home/slattarini/tmp/automake-1.12a/t/yacc-bison-skeleton.dir/build/../zardoz.y:3:
> first defined here
> collect2: ld returned 1 exit status
> make: *** [zardoz] Error 1
It is failing because of something else than the purpose of the
patch. I have this, if I don't apply my patches:
config.status: creating Makefile
config.status: executing depfiles commands
+ make
/bin/sh ../ylwrap ../zardoz.y y.tab.c zardoz.c y.tab.h `echo zardoz.c | sed -e
s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/` y.output
zardoz.output -- bison -y -d --skeleton glr.c
updating zardoz.h
ccache gcc-mp-4.7 -DPACKAGE_NAME=\"yacc-bison-skeleton\"
-DPACKAGE_TARNAME=\"yacc-bison-skeleton\" -DPACKAGE_VERSION=\"1.0\"
-DPACKAGE_STRING=\"yacc-bison-skeleton\ 1.0\" -DPACKAGE_BUGREPORT=\"\"
-DPACKAGE_URL=\"\" -DPACKAGE=\"yacc-bison-skeleton\" -DVERSION=\"1.0\" -I. -I..
-isystem /opt/local/include -g -O2 -MT zardoz.o -MD -MP -MF .deps/zardoz.Tpo
-c -o zardoz.o zardoz.c
zardoz.c:65:19: fatal error: y.tab.h: No such file or directory
compilation terminated.
distcc[4551] ERROR: compile zardoz.c on localhost failed
make: *** [zardoz.o] Error 1
+ exit_status=2
The failure is due to the input:
%{
int yylex () { return 0; }
void yyerror (const char *s) { return; }
%}
%%
foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
%{%} goes into the header when there is one, and it also goes
in the implementation file, so, since glr.c include its header,
you get two definitions. I don't see it since 2.6 has several
improvements in this area.
I suggest the following rewrite. It, and yacc-work, should actually
go into maint, not just master.
From 2bd5207b83ffc27909269985d0437d08a4ef5676 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Sat, 14 Jul 2012 09:07:52 +0200
Subject: [PATCH] tests: fix bison input file
Do not provide implementations in the %{...%} section, since with pre
2.6 versions of Bison it results in this section being read twice,
which ends in a multiple-definitions error.
Reported by Stefano Lattarini,
<http://lists.gnu.org/archive/html/automake-patches/2012-07/msg00126.html>.
* t/yacc-bison-skeleton.sh (zardoz.y): Define yylex and yyerror in the
epilogue.
---
t/yacc-bison-skeleton.sh | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/t/yacc-bison-skeleton.sh b/t/yacc-bison-skeleton.sh
index 5bf9092..9e9f514 100755
--- a/t/yacc-bison-skeleton.sh
+++ b/t/yacc-bison-skeleton.sh
@@ -35,11 +35,14 @@ END
# Parser.
cat > zardoz.y << 'END'
%{
-int yylex () { return 0; }
-void yyerror (const char *s) { return; }
+int yylex ();
+void yyerror (const char *s);
%}
%%
foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+%%
+int yylex () { return 0; }
+void yyerror (const char *s) { return; }
END
cat > foo.c << 'END'
--
1.7.11.1
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, (continued)
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Akim Demaille, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Akim Demaille, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Akim Demaille, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/13
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers,
Akim Demaille <=
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Akim Demaille, 2012/07/14
- Re: [PATCH 3/3] ylwrap: rename header inclusion in generated parsers, Stefano Lattarini, 2012/07/14
- [PATCH 0/4] ylwrap: support C++ and others that generate several files, Akim Demaille, 2012/07/14
- [PATCH 1/4] tests: upgrade and fix Bison test case, Akim Demaille, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Stefano Lattarini, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Akim Demaille, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Stefano Lattarini, 2012/07/14
- Re: [PATCH 1/4] tests: upgrade and fix Bison test case, Akim Demaille, 2012/07/14
- [PATCH 2/4] ylwrap: refactoring: don't rely on the file order, Akim Demaille, 2012/07/14
- [PATCH 3/4] ylwrap: refactor: move loop invariant, Akim Demaille, 2012/07/14