Le 13 juil. 2012 à 16:00, Stefano Lattarini a écrit : > Hi Akim. > > The commit 'a4fd5c7c2cd2a2b626c670741313f0a94c38c529' that you've pushed > is broken; it defines '$rename_sed', but do not actually use it, and > thus does not fix the bug it says it fixes. Only the later commit > cd94deae0c8abccbd33e3d03983f4a607fafb4ad (that should be just a cosmetic > or style one according to its commit message) starts using '$rename_sed': > > @@ -207,8 +207,8 @@ if test $ret -eq 0; then > FROM=`guard "$from"` > TARGET=`guard "$to"` > > - sed -e "/^#/!b" -e "s,$input_rx,$input_sub_rx," -e "s,$from,$to," \ > - -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? > + sed -e "/^#/!b" -e "s|$input_rx|$input_sub_rx|" -e "$rename_sed" \ > + -e "s|$FROM|$TARGET|" "$from" >"$target" || ret=$? > > Could you please fix the situation please? Also, because we expect the > commit 'a4fd5c7c2cd2a2b626c670741313f0a94c38c529' to fix the test > 'yacc-bison-skeleton.sh', it should be amended so that XFAIL_TESTS does > not contain the fixed test anymore; in addition to avoiding an XPASS, > that makes clear that the commit is fixing a pre-existing bug as well.
Sorry about these. Updated below, and in the branch too. From ee7e1dd77b5bcd6a41a31030a4f662bca3ad2b39 Mon Sep 17 00:00:00 2001 From: Akim Demaille <a...@lrde.epita.fr> Date: Fri, 13 Jul 2012 14:32:22 +0200 Subject: [PATCH] ylwrap: rename header inclusion in generated parsers Some types of Bison parsers, such as the GLR ones, generate a header file that they include. ylwrap, which renames the generated files, does not rename the included file. Fix this shortcoming, reported for instance here: <http://lists.gnu.org/archive/html/bug-bison/2012-06/msg00033.html>. Fixes t/yacc-bison-skeleton.sh, see Automake bug#7648 and PR automake/491. * lib/ylwrap (quote_for_sed): Accept arguments. Catch more special characters. (rename_sed): New. Improve the previous renaming sed commands using quote_for_sed. Suggested by Stefano Lattarini here: <http://lists.gnu.org/archive/html/automake-patches/2012-07/msg00095.html>. (main loop): Use rename_sed to rename the dependencies to other files. * t/yacc-d-basic.sh: Exercise this case, even if bison/yacc was not issuing such an include. * t/list-of-tests.mk (XFAIL_TESTS): Adjust. --- lib/ylwrap | 19 +++++++++++++++---- t/list-of-tests.mk | 1 - t/yacc-d-basic.sh | 9 ++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/ylwrap b/lib/ylwrap index 8a9f2b0..8e02e9a 100755 --- a/lib/ylwrap +++ b/lib/ylwrap @@ -1,7 +1,7 @@ #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. -scriptversion=2012-07-13.10; # UTC +scriptversion=2012-07-13.14; # UTC # Copyright (C) 1996-2012 Free Software Foundation, Inc. # @@ -48,10 +48,16 @@ guard() -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' } +# quote_for_sed [STRING] +# ---------------------- +# Return STRING (or stdin) quoted to be used as a sed pattern. quote_for_sed () { - # FIXME: really we should care about more than '.' and '\'. - sed -e 's,[\\.],\\&,g' + case $# in + 0) cat;; + 1) printf '%s\n' "$1";; + esac \ + | sed -e 's|[][\\.*]|\\&|g' } case "$1" in @@ -113,6 +119,10 @@ fi # 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. +rename_sed= while test "$#" -ne 0; do if test "$1" = "--"; then shift @@ -130,6 +140,7 @@ while test "$#" -ne 0; do to=$1 shift pairlist="$pairlist $from $to" + rename_sed="${rename_sed}s|"`quote_for_sed "$from"`"|$to|g;" done # The program to run. @@ -196,7 +207,7 @@ if test $ret -eq 0; then FROM=`guard "$from"` TARGET=`guard "$to"` - sed -e "/^#/!b" -e "s,$input_rx,$input_sub_rx," -e "s,$from,$to," \ + sed -e "/^#/!b" -e "s,$input_rx,$input_sub_rx," -e "$rename_sed" \ -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? # Check whether header files must be updated. diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 383be1b..ee2556e 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -31,7 +31,6 @@ t/pm/Version3.pl XFAIL_TESTS = \ t/all.sh \ t/yacc-bison-skeleton-cxx.sh \ -t/yacc-bison-skeleton.sh \ t/cond17.sh \ t/gcj6.sh \ t/override-conditional-2.sh \ diff --git a/t/yacc-d-basic.sh b/t/yacc-d-basic.sh index 91fbc62..72872f2 100755 --- a/t/yacc-d-basic.sh +++ b/t/yacc-d-basic.sh @@ -54,7 +54,14 @@ void yyerror (char *s) {} x : 'x' {}; %% END -cp foo/parse.y bar/parse.y +# Using ylwrap, we actually generate y.tab.[ch]. Unfortunately, we +# forgot to rename #include "y.tab.h" into #include "parse.h" during +# the conversion from y.tab.c to parse.c. This was OK when Bison was +# not issuing such an #include (up to 2.6). +# +# To make sure that we perform this conversion, in bar/parse.y, use +# y.tab.h instead of parse.c. +sed -e 's/parse\.h/y.tab.h/' <foo/parse.y >bar/parse.y cat > foo/main.c << 'END' #include "parse.h" -- 1.7.11.2