ylwrap: fix C++ support for Bison
authorAkim Demaille <akim@lrde.epita.fr>
Sat, 14 Jul 2012 14:57:02 +0000 (16:57 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Sat, 14 Jul 2012 14:58:45 +0000 (16:58 +0200)
Fixes automake bug#7648.

The current logic of ylwrap is to call yacc in a sub directory, and
pull out of it all the files that were requested on its command line.
Reverse this approach: export *all* the files created in the
subdirectory, but rename them according to what the command says.
This way, extra files, such as position.hh, location.hh and stack.hh
for C++ parsers, but also parser.xml or parser.dot if XML or Dot
output is enabled, will be preserved.

* lib/ylwrap (pairlist): Remove.
(main loop): Don't loop over pairlist, but over the files in the
temporary directory.
* t/list-of-tests.mk (XFAIL_TESTS): Fixes t/yacc-bison-skeleton-cxx.sh.
* THANKS (James Bostock): Add, he reported bug#7648.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
THANKS
lib/ylwrap
t/list-of-tests.mk

diff --git a/THANKS b/THANKS
index afdd33a..ca95db8 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -150,6 +150,7 @@ Imacat                          imacat@mail.imacat.idv.tw
 Inoue                           inoue@ainet.or.jp
 Jack Kelly                      jack@jackkelly.name
 James Amundson                  amundson@users.sourceforge.net
+James Bostock                   james.bostock@gmail.com
 James Henstridge                james@daa.com.au
 James R. Van Zandt              jrv@vanzandt.mv.com
 James Youngman                  jay@gnu.org
index 30e8a6c..49116e5 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 # ylwrap - wrapper for lex/yacc invocations.
 
-scriptversion=2012-07-13.14; # UTC
+scriptversion=2012-07-14.08; # UTC
 
 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
 #
@@ -121,8 +121,6 @@ fi
 # The parser itself, the first file, is the destination of the .y.c
 # rule in the Makefile.
 parser=$1
-# The list of file to rename: FROM TO...
-pairlist=
 # A sed program to s/FROM/TO/g for all the FROM/TO so that, for
 # instance, we rename #include "y.tab.h" into #include "parse.h"
 # during the conversion from y.tab.c to parse.c.
@@ -143,7 +141,6 @@ while test "$#" -ne 0; do
   shift
   to=$1
   shift
-  pairlist="$pairlist $from $to"
   rename_sed="${rename_sed}s|"`quote_for_sed "$from"`"|$to|g;"
 done
 
@@ -175,11 +172,9 @@ esac
 ret=$?
 
 if test $ret -eq 0; then
-  set X $pairlist
-  shift
-  while test "$#" -ne 0; do
-    from=$1
-    to=$2
+  for from in *
+  do
+    to=`printf '%s\n' "$from" | sed "$rename_sed"`
     if test -f "$from"; then
       # If $2 is an absolute path name, then just use that,
       # otherwise prepend '../'.
@@ -225,8 +220,6 @@ if test $ret -eq 0; then
         ret=1
       fi
     fi
-    shift
-    shift
   done
 else
   ret=$?
index 9f0e123..a0209d4 100644 (file)
@@ -30,7 +30,6 @@ t/pm/Version3.pl
 
 XFAIL_TESTS = \
 t/all.sh \
-t/yacc-bison-skeleton-cxx.sh \
 t/cond17.sh \
 t/gcj6.sh \
 t/override-conditional-2.sh \