summaryrefslogtreecommitdiff
path: root/t/yacc-d-basic.sh
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2012-07-13 14:32:22 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-07-14 12:10:22 +0200
commitbe2bb639757a723d44809678d0c21cd429a321cd (patch)
tree547b9152638a074a3fe2871a28febfedbda8e373 /t/yacc-d-basic.sh
parent1a871ca02705c1225a75bb024119efbf56ab19c4 (diff)
downloadautomake-be2bb639757a723d44809678d0c21cd429a321cd.tar.gz
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.
Diffstat (limited to 't/yacc-d-basic.sh')
-rwxr-xr-xt/yacc-d-basic.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/t/yacc-d-basic.sh b/t/yacc-d-basic.sh
index 91fbc62d8..72872f24f 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"