automake-patches
[Top][All Lists]
Advanced

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

[PATCH 4/4] ylwrap: fix C++ support


From: Akim Demaille
Subject: [PATCH 4/4] ylwrap: fix C++ support
Date: Sat, 14 Jul 2012 10:32:09 +0200

The current logic of ylwrap is to call yacc in a sub directory, and
pull out of it all the files that were request on its command line.
Reverse this approach: export *all* the files created in the
subdirectory, but rename then 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.
---
 lib/ylwrap         | 25 +++++++++----------------
 t/list-of-tests.mk |  1 -
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/lib/ylwrap b/lib/ylwrap
index 3efa632..49116e5 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -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 '../'.
@@ -189,11 +184,11 @@ if test $ret -eq 0; then
       esac
 
       # Do not overwrite unchanged header files to avoid useless
-      # recompilations.  Always update the parser itself (the first
-      # file): it is the destination of the .y.c rule in the Makefile.
-      # Divert the output of all other files to a temporary file so we
-      # can compare them to existing versions.
-      if test $first = no; then
+      # recompilations.  Always update the parser itself: it is the
+      # destination of the .y.c rule in the Makefile.  Divert the
+      # output of all other files to a temporary file so we can
+      # compare them to existing versions.
+      if test $from != $parser; then
         realtarget="$target"
         target=tmp-`printf '%s\n' "$target" | sed s/.*[\\/]//g`
       fi
@@ -225,8 +220,6 @@ if test $ret -eq 0; then
         ret=1
       fi
     fi
-    shift
-    shift
   done
 else
   ret=$?
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index ee2556e..2a28992 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -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 \
-- 
1.7.11.1




reply via email to

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