automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.12b-7-g


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.12b-7-g27eb425
Date: Sat, 22 Dec 2012 08:07:18 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=27eb4254ec9acdd435bbd76a54201955a1b0fa78

The branch, master has been updated
       via  27eb4254ec9acdd435bbd76a54201955a1b0fa78 (commit)
       via  b9951d654abb76c5419f1e2b453f1ca06fdb331b (commit)
      from  31a07e69c1be42d5fc30257d42d5165c76a1d4ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 27eb4254ec9acdd435bbd76a54201955a1b0fa78
Author: Akim Demaille <address@hidden>
Date:   Wed Dec 19 14:51:58 2012 +0100

    ylwrap: various fixes
    
    Rename properly header guards in generated header files, instead of
    leaving Y_TAB_H.
    
    Convert header guards in implementation files.  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.
    
    Generate header guards with a single '_' for series of non alphabetic
    characters, instead of several.  This is what Bison does.
    
    Makes the test t/yacc-d-basic.sh pass again.
    
    * lib/ylwrap (guard): Properly honor $1 to rename properly the
    header guards.
    Keep a single _ instead of several.
    (rename_sed): Rename as...
    (sed_fix_filenames): this.
    Suggested by Stefano Lattarini.
    (sed_fix_header_guards): New.
    Use it.

commit b9951d654abb76c5419f1e2b453f1ca06fdb331b
Author: Akim Demaille <address@hidden>
Date:   Wed Dec 19 14:30:06 2012 +0100

    tests: strengthen the ylwrap tests
    
    * t/yacc-d-basic.sh: Comment changes.
    (generated): New.
    Use it to factor various tests.
    Check that Y_TAB_H is not issued.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 NEWS              |   18 +++++++++++++++++
 lib/ylwrap        |   33 ++++++++++++++++++++-----------
 t/yacc-d-basic.sh |   54 +++++++++++++++++++++++++++-------------------------
 3 files changed, 67 insertions(+), 38 deletions(-)

diff --git a/NEWS b/NEWS
index 5bf4379..b946c2a 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,18 @@ New in 1.13:
     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.
@@ -206,6 +218,12 @@ New in 1.13:
   - 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:
diff --git a/lib/ylwrap b/lib/ylwrap
index 7befa46..b5c673d 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -1,7 +1,7 @@
 #! /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.
 #
@@ -42,10 +42,11 @@ get_dirname ()
 # 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]
@@ -121,10 +122,16 @@ fi
 # 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
@@ -141,7 +148,8 @@ while test "$#" -ne 0; do
   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.
@@ -174,7 +182,7 @@ ret=$?
 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 '../'.
@@ -197,10 +205,11 @@ if test $ret -eq 0; then
       # 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
diff --git a/t/yacc-d-basic.sh b/t/yacc-d-basic.sh
index 1d2fc07..a03065d 100755
--- a/t/yacc-d-basic.sh
+++ b/t/yacc-d-basic.sh
@@ -59,8 +59,10 @@ END
 # 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.
+# To make sure that we perform this conversion even with version of
+# Bison that do not generate this include, in bar/parse.y, use y.tab.h
+# instead of parse.h, and check the ylwrap does replace "y.tab.h" with
+# "parse.h".
 sed -e 's/parse\.h/y.tab.h/' <foo/parse.y >bar/parse.y
 
 cat > foo/main.c << 'END'
@@ -107,12 +109,21 @@ $AUTOMAKE baz/Makefile
 
 $MAKE
 
-test -f foo/parse.c
-test -f foo/parse.h
-test -f bar/parse.c
-test -f bar/parse.h
-test -f baz/zardoz-parse.c
-test -f baz/zardoz-parse.h
+generated="
+  foo/parse.c
+  foo/parse.h
+  bar/parse.c
+  bar/parse.h
+  baz/zardoz-parse.c
+  baz/zardoz-parse.h
+"
+
+for i in $generated; do
+  test -f $i
+done
+
+# There must remain no obsolete header guard.
+grep Y_TAB_H $generated && exit 1
 
 # The generated C source and header files must be shipped.
 for dir in foo bar; do
@@ -130,12 +141,9 @@ cd ..
 
 $MAKE distdir
 ls -l $distdir
-test -f $distdir/foo/parse.c
-test -f $distdir/foo/parse.h
-test -f $distdir/bar/parse.c
-test -f $distdir/bar/parse.h
-test -f $distdir/baz/zardoz-parse.c
-test -f $distdir/baz/zardoz-parse.h
+for i in $generated; do
+  test -f $distdir/$i
+done
 
 # Sanity check the distribution.
 yl_distcheck
@@ -143,19 +151,13 @@ yl_distcheck
 # While we are at it, make sure that 'parse.c' and 'parse.h' are erased
 # by maintainer-clean, and not by distclean.
 $MAKE distclean
-test -f foo/parse.c
-test -f foo/parse.h
-test -f bar/parse.c
-test -f bar/parse.h
-test -f baz/zardoz-parse.c
-test -f baz/zardoz-parse.h
+for i in $generated; do
+  test -f $i
+done
 ./configure # Re-create 'Makefile'.
 $MAKE maintainer-clean
-test ! -e foo/parse.c
-test ! -e foo/parse.h
-test ! -e bar/parse.c
-test ! -e bar/parse.h
-test ! -e baz/zardoz-parse.c
-test ! -e baz/zardoz-parse.h
+for i in $generated; do
+  test ! -e $i
+done
 
 :


hooks/post-receive
-- 
GNU Automake



reply via email to

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