should take precedence over the same-named automake-provided macro
(defined in '/usr/local/share/aclocal-1.14/vala.m4').
+* Bugs fixed:
+
+ - ylwrap renames properly header guards in generated header files
+ (*.h), instead of leaving Y_TAB_H.
+
+ - ylwrap now also converts header guards in implementation files
+ (*.c). Because ylwrap failed to rename properly #include in the
+ implementation files, current versions of Bison (e.g., 2.7)
+ duplicate the generated header file in the implementation file.
+ The header guard then protects the implementation file from
+ duplicate definitions from the header file.
+
* Version requirements:
- Autoconf 2.65 or greater is now required.
- Support for tcc (the Tiny C Compiler) has been improved, and is now
handled through a dedicated 'tcc' mode.
+* The ylwrap script:
+
+ - ylwrap generates header guards with a single '_' for series of non
+ alphabetic characters, instead of several. This is what Bison >=
+ 2.5.1 does.
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bugs fixed in 1.12.6:
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
-scriptversion=2012-07-14.08; # UTC
+scriptversion=2012-12-21.17; # UTC
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
#
# The CPP macro used to guard inclusion of FILE.
guard()
{
- printf '%s\n' "$from" \
- | sed \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
- -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'
+ printf '%s\n' "$1" \
+ | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \
+ -e 's/__*/_/g'
}
# quote_for_sed [STRING]
# The parser itself, the first file, is the destination of the .y.c
# rule in the Makefile.
parser=$1
+
# 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=
+sed_fix_filenames=
+
+# Also rename header guards, as Bison 2.7 for instance uses its header
+# guard in its implementation file.
+sed_fix_header_guards=
+
while test "$#" -ne 0; do
if test "$1" = "--"; then
shift
shift
to=$1
shift
- rename_sed="${rename_sed}s|"`quote_for_sed "$from"`"|$to|g;"
+ sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;"
+ sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;"
done
# The program to run.
if test $ret -eq 0; then
for from in *
do
- to=`printf '%s\n' "$from" | sed "$rename_sed"`
+ to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"`
if test -f "$from"; then
# If $2 is an absolute path name, then just use that,
# otherwise prepend '../'.
# debug information point at an absolute srcdir. Use the real
# output file name, not yy.lex.c for instance. Adjust the
# include guards too.
- FROM=`guard "$from"`
- TARGET=`guard "$to"`
- sed -e "/^#/!b" -e "s|$input_rx|$input_sub_rx|" -e "$rename_sed" \
- -e "s|$FROM|$TARGET|" "$from" >"$target" || ret=$?
+ sed -e "/^#/!b" \
+ -e "s|$input_rx|$input_sub_rx|" \
+ -e "$sed_fix_filenames" \
+ -e "$sed_fix_header_guards" \
+ "$from" >"$target" || ret=$?
# Check whether files must be updated.
if test "$from" != "$parser"; then