[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automake/491: yacc rule .yy.cc needs to substitute #include "y.tab.h
From: |
Ralf Wildenhues |
Subject: |
Re: automake/491: yacc rule .yy.cc needs to substitute #include "y.tab.h" with %BASE%.h in y.tab.c |
Date: |
Mon, 15 May 2006 20:25:29 +0200 |
User-agent: |
Mutt/1.5.9i |
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=automake&pr=491
Hello Hsiu-Khuern, everyone,
Thanks for the example. Here's a suggested patch with a reduced test
case, against CVS HEAD Automake. Note that in your test case the two
lines
AM_YFLAGS = -y
BUILT_SOURCES = zardoz.h
which are mentioned in the CVS Automake manual, at
info Automake "Yacc and Lex"
were missing. I wonder, the BUILT_SOURCES line does not seem necessary
for proper operation. Am I missing something, or does the documentation
need an update?
Furthermore, the bison version I tested this with (1.875c) generated
some more files: stack.hh, position.hh, location.hh. These are not
accounted for at the moment, and I don't know how to get at these names,
or even rename them in any way. Also, this version uses different C++
class and member names, so your example did not work out of the box with
it. Since the bison-generated files are shipped in a tarball, I guess
that doesn't matter so much; and the test below doesn't attempt a
compile.
Anyway, OK to apply this patch?
Cheers, and thanks for the bug report!
Ralf
2006-05-15 Hsiu-Khuern Tang <address@hidden> (tiny change)
Ralf Wildenhues <address@hidden>
* lib/am/yacc.am: Replace `y.tab.h' with renamed header file.
Fixes PR automake/491. Report by Hsiu-Khuern Tang.
* tests/yaccpp2.test: New test, reduced from report and
yaccpp.test.
* tests/Makefile.am: Adjust.
* THANKS: Update.
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.283
diff -u -r1.283 THANKS
--- THANKS 10 May 2006 20:55:34 -0000 1.283
+++ THANKS 15 May 2006 18:19:28 -0000
@@ -96,6 +96,7 @@
Harlan Stenn address@hidden
He Li address@hidden
Henrik Frystyk Nielsen address@hidden
+Hsiu-Khuern Tang address@hidden
Ian Lance Taylor address@hidden
Imacat address@hidden
Inoue address@hidden
Index: lib/am/yacc.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/yacc.am,v
retrieving revision 1.21
diff -u -r1.21 yacc.am
--- lib/am/yacc.am 14 May 2005 20:28:53 -0000 1.21
+++ lib/am/yacc.am 15 May 2006 18:19:28 -0000
@@ -79,6 +79,6 @@
?GENERIC? $(am__skipyacc) \
?!GENERIC??DIST_SOURCE? $(am__skipyacc) \
## Edit out `#line' or `#' directives.
- { sed '/^#/ s|y\.tab\.c|%OBJ%|' y.tab.c >%OBJ%t && mv %OBJ%t %OBJ% && \
- rm -f y.tab.c; }
+ { sed '/^#/ s|y\.tab\.c|%OBJ%|; /^#/ s|y\.tab\.h|%BASE%.h|' y.tab.c
>%OBJ%t \
+ && mv %OBJ%t %OBJ% && rm -f y.tab.c; }
endif !%?MORE-THAN-ONE%
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.604
diff -u -r1.604 Makefile.am
--- tests/Makefile.am 10 May 2006 20:47:36 -0000 1.604
+++ tests/Makefile.am 15 May 2006 18:19:29 -0000
@@ -594,6 +594,7 @@
yacc7.test \
yacc8.test \
yaccpp.test \
+yaccpp2.test \
yaccvpath.test
EXTRA_DIST = ChangeLog-old $(TESTS)
--- /dev/null 2005-03-20 10:56:50.000000000 +0100
+++ tests/yaccpp2.test 2006-05-15 20:23:26.492320346 +0200
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 1997, 2001, 2002, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# PR/491: Make sure the C++ include header is substituted from y.tab.h.
+
+required=bison
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.yy
+AM_YFLAGS = -d
+BUILT_SOURCES = zardoz.h
+END
+
+cat > zardoz.yy << 'END'
+%skeleton "lalr1.cc"
+%defines
+%{
+#define YYSTYPE int
+int yylex(YYSTYPE*);
+%}
+%%
+start : /* empty */
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+./configure
+$MAKE zardoz.cc
+test -f zardoz.h
+grep 'y\.tab\.h' zardoz.cc && exit 1
+grep '#[ ]*include.*zardoz.h' zardoz.cc
+$MAKE maintainer-clean
+test ! -f zardoz.cc
+test ! -f zardoz.h
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: automake/491: yacc rule .yy.cc needs to substitute #include "y.tab.h" with %BASE%.h in y.tab.c,
Ralf Wildenhues <=