automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, maint, updated. v1.12.2-27-


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, maint, updated. v1.12.2-27-gec5cb49
Date: Mon, 16 Jul 2012 09:08:37 +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=ec5cb49bf553a4823bd52bcf012df59b7b4ebb51

The branch, maint has been updated
       via  ec5cb49bf553a4823bd52bcf012df59b7b4ebb51 (commit)
       via  eef78e2c35ec51b607e767d544770d57c587c06d (commit)
       via  b67f8fde3a8052881dfa78b3b04d5b917b750a7f (commit)
       via  aad12dcc668dfdfdb193e4e734ceb7235ea6edfc (commit)
       via  ae387d32c1ae8173cffb5019bf6db12a4de0177c (commit)
       via  fa10457919d195957bae104cce6be8ccebd53347 (commit)
       via  4ce3d13166d90a8be9f00b66c9e3a8275cd0d0ac (commit)
       via  cfda11fb768888fb2802e265ed8d5438cef2f123 (commit)
       via  9a6a600138d30d36e02d186625cc3932d4624aec (commit)
       via  9404f529bc178d75ee8003853e1fa67281cd080d (commit)
       via  7e31ff5cb4b744454774c73032e95bba0a481506 (commit)
       via  0a25f35b5d0a4d2acb5a72f25cf25ecc0d8e84dd (commit)
       via  be2bb639757a723d44809678d0c21cd429a321cd (commit)
       via  1a871ca02705c1225a75bb024119efbf56ab19c4 (commit)
       via  4294cbb03034099f59238eee28accabf790866d0 (commit)
      from  6e3c0b92fdef5119ea2ca508061a9b46ef4c251b (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 ec5cb49bf553a4823bd52bcf012df59b7b4ebb51
Merge: 6e3c0b9 eef78e2
Author: Stefano Lattarini <address@hidden>
Date:   Mon Jul 16 10:57:41 2012 +0200

    Merge branch 'yacc-work' into maint
    
    * yacc-work:
      news: update about recent ylwrap changes and fixes
      yacc tests: fix a spurious failure with parallel make
      ylwrap: use proper quoting inside a `...` substitution
      ylwrap: don't uselessly reset the exit status in case of failure
      ylwrap: fix C++ support for Bison
      ylwrap: refactor: move loop invariant
      ylwrap: refactoring: don't rely on the file order
      tests: upgrade and fix Bison test case
      tests: fix bison input file
      ylwrap: comment changes
      ylwrap: modernize idioms
      ylwrap: rename header inclusion in generated parsers
      ylwrap: simplify the list of renamings
      ylwrap: refactor: less duplication
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit eef78e2c35ec51b607e767d544770d57c587c06d
Author: Akim Demaille <address@hidden>
Date:   Sun Jul 15 11:23:59 2012 +0200

    news: update about recent ylwrap changes and fixes
    
    * NEWS: In ylwrap, renamings are properly propagated, and unknown
    files are preserved.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

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

Summary of changes:
 NEWS                         |   12 +++
 THANKS                       |    1 +
 lib/ylwrap                   |  172 ++++++++++++++++++++++--------------------
 t/list-of-tests.mk           |    2 -
 t/yacc-bison-skeleton-cxx.sh |   20 +++--
 t/yacc-bison-skeleton.sh     |    8 ++-
 t/yacc-d-basic.sh            |    9 ++-
 7 files changed, 129 insertions(+), 95 deletions(-)

diff --git a/NEWS b/NEWS
index 77344f8..f468570 100644
--- a/NEWS
+++ b/NEWS
@@ -76,6 +76,18 @@ New in 1.12.3:
 
   - Some testsuite weaknesses and spurious failures have been fixed.
 
+* Long-standing bugs:
+
+  - Instead of renaming only self-references of files (typically for
+    #lines), ylwrap now also renames references to the other generated
+    files.  This fixes support for GLR and C++ parsers from Bison (PR
+    automake/491 and automake bug#7648): 'parser.c' now properly
+    #includes 'parser.h' instead of 'y.tab.h'.
+
+  - Generated files unknown to ylwrap are now preserved.  This fixes
+    C++ support for Bison (automake bug#7648): location.hh and the
+    like are no longer discarded.
+
 New in 1.12.2:
 
 * Warnings and deprecations:
diff --git a/THANKS b/THANKS
index afdd33a..ca95db8 100644
--- a/THANKS
+++ b/THANKS
@@ -150,6 +150,7 @@ Imacat                          address@hidden
 Inoue                           address@hidden
 Jack Kelly                      address@hidden
 James Amundson                  address@hidden
+James Bostock                   address@hidden
 James Henstridge                address@hidden
 James R. Van Zandt              address@hidden
 James Youngman                  address@hidden
diff --git a/lib/ylwrap b/lib/ylwrap
index 6879d8d..7befa46 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -1,7 +1,7 @@
 #! /bin/sh
 # ylwrap - wrapper for lex/yacc invocations.
 
-scriptversion=2011-08-25.18; # UTC
+scriptversion=2012-07-14.08; # UTC
 
 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
 #
@@ -29,6 +29,37 @@ scriptversion=2011-08-25.18; # UTC
 # bugs to <address@hidden> or send patches to
 # <address@hidden>.
 
+get_dirname ()
+{
+  case $1 in
+    */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';;
+    # Otherwise,  we want the empty string (not ".").
+  esac
+}
+
+# guard FILE
+# ----------
+# The CPP macro used to guard inclusion of FILE.
+guard()
+{
+  printf '%s\n' "$from" \
+    | sed \
+        -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
+        -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'
+}
+
+# quote_for_sed [STRING]
+# ----------------------
+# Return STRING (or stdin) quoted to be used as a sed pattern.
+quote_for_sed ()
+{
+  case $# in
+    0) cat;;
+    1) printf '%s\n' "$1";;
+  esac \
+    | sed -e 's|[][\\.*]|\\&|g'
+}
+
 case "$1" in
   '')
     echo "$0: No files given.  Try '$0 --help' for more information." 1>&2
@@ -62,19 +93,6 @@ EOF
     ;;
 esac
 
-get_dirname ()
-{
-  case $1 in
-    */*|*\\*) printf '%s\n' "$1" | sed -e 's,\([\\/]\)[^\\/]*$,\1,';;
-    # Otherwise,  we want the empty string (not ".").
-  esac
-}
-
-quote_for_sed ()
-{
-  # FIXME: really we should care about more than '.' and '\'.
-  sed -e 's,[\\.],\\&,g'
-}
 
 # The input.
 input="$1"
@@ -90,15 +108,40 @@ case "$input" in
     input="`pwd`/$input"
     ;;
 esac
+input_rx=`get_dirname "$input" | quote_for_sed`
+
+# Since DOS filename conventions don't allow two dots,
+# the DOS version of Bison writes out y_tab.c instead of y.tab.c
+# and y_tab.h instead of y.tab.h. Test to see if this is the case.
+y_tab_nodot=false
+if test -f y_tab.c || test -f y_tab.h; then
+  y_tab_nodot=true
+fi
 
-pairlist=
+# 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=
 while test "$#" -ne 0; do
   if test "$1" = "--"; then
     shift
     break
   fi
-  pairlist="$pairlist $1"
+  from=$1
+  # Handle y_tab.c and y_tab.h output by DOS
+  if $y_tab_nodot; then
+    case $from in
+      "y.tab.c") from=y_tab.c;;
+      "y.tab.h") from=y_tab.h;;
+    esac
+  fi
+  shift
+  to=$1
   shift
+  rename_sed="${rename_sed}s|"`quote_for_sed "$from"`"|$to|g;"
 done
 
 # The program to run.
@@ -129,90 +172,55 @@ esac
 ret=$?
 
 if test $ret -eq 0; then
-  set X $pairlist
-  shift
-  first=yes
-  # Since DOS filename conventions don't allow two dots,
-  # the DOS version of Bison writes out y_tab.c instead of y.tab.c
-  # and y_tab.h instead of y.tab.h. Test to see if this is the case.
-  y_tab_nodot="no"
-  if test -f y_tab.c || test -f y_tab.h; then
-    y_tab_nodot="yes"
-  fi
-
-  input_rx=`get_dirname "$input" | quote_for_sed`
-
-  while test "$#" -ne 0; do
-    from="$1"
-    # Handle y_tab.c and y_tab.h output by DOS
-    if test $y_tab_nodot = "yes"; then
-      if test $from = "y.tab.c"; then
-        from="y_tab.c"
-      else
-        if test $from = "y.tab.h"; then
-          from="y_tab.h"
-        fi
-      fi
-    fi
+  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 '../'.
-      case "$2" in
-        [\\/]* | ?:[\\/]*) target="$2";;
-        *) target="../$2";;
+      case $to in
+        [\\/]* | ?:[\\/]*) target=$to;;
+        *) target="../$to";;
       esac
 
-      # We do not want to overwrite a header file if it hasn't
-      # changed.  This avoid useless recompilations.  However the
-      # parser itself (the first file) should always be updated,
-      # because 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
+      # Do not overwrite unchanged header files to avoid useless
+      # 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-`echo $target | sed s/.*[\\/]//g`"
+        target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'`
       fi
-      # Munge "#line" or "#" directives.
-      # We don't want the resulting debug information to point at
-      # an absolute srcdir.
-      # We want to use the real output file name, not yy.lex.c for
-      # instance.
-      # We want the include guards to be adjusted too.
-      FROM=`echo "$from" | sed \
-            -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-            -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
-      TARGET=`echo "$2" | sed \
-            -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-            -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
-
-      sed -e "/^#/!b" -e "s,$input_rx,$input_sub_rx," -e "s,$from,$2," \
-          -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
-
-      # Check whether header files must be updated.
-      if test $first = no; then
+
+      # Munge "#line" or "#" directives.  Don't let the resulting
+      # 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=$?
+
+      # Check whether files must be updated.
+      if test "$from" != "$parser"; then
         if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
-          echo "$2" is unchanged
+          echo "$to is unchanged"
           rm -f "$target"
         else
-          echo updating "$2"
+          echo "updating $to"
           mv -f "$target" "$realtarget"
         fi
       fi
     else
-      # A missing file is only an error for the first file.  This
-      # is a blatant hack to let us support using "yacc -d".  If -d
-      # is not specified, we don't want an error when the header
-      # file is "missing".
-      if test $first = yes; then
+      # A missing file is only an error for the parser.  This is a
+      # blatant hack to let us support using "yacc -d".  If -d is not
+      # specified, don't fail when the header file is "missing".
+      if test "$from" = "$parser"; then
         ret=1
       fi
     fi
-    shift
-    shift
-    first=no
   done
-else
-  ret=$?
 fi
 
 # Remove the directory.
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 78d7d9b..a0209d4 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -30,8 +30,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-bison-skeleton-cxx.sh b/t/yacc-bison-skeleton-cxx.sh
index 609ebc2..a02a25a 100755
--- a/t/yacc-bison-skeleton-cxx.sh
+++ b/t/yacc-bison-skeleton-cxx.sh
@@ -40,10 +40,15 @@ END
 cat > zardoz.yy << 'END'
 %skeleton "lalr1.cc"
 %defines
+%locations
 
+%union
+{
+  int ival;
+};
 %{
-#define YYSTYPE int
-int yylex(YYSTYPE* yylval_param);
+int yylex (yy::parser::semantic_type *yylval,
+           yy::parser::location_type *yylloc);
 %}
 
 %%
@@ -51,23 +56,22 @@ start :        /* empty */
 %%
 
 int
-yylex(YYSTYPE*)
+yylex (yy::parser::semantic_type *yylval,
+       yy::parser::location_type *yylloc)
 {
-    return 0;
+  return 0;
 }
 
 void
-yy::parser::error(const yy::parser::location_type&, const std::string& m)
+yy::parser::error(const yy::parser::location_type&, const std::string&)
 {
-    return;
+  return;
 }
 END
 
 cat > foo.cc << 'END'
 #include "zardoz.hh"
 
-using namespace std;
-
 int
 main(int argc, char** argv)
 {
diff --git a/t/yacc-bison-skeleton.sh b/t/yacc-bison-skeleton.sh
index 5bf9092..f4fdf32 100755
--- a/t/yacc-bison-skeleton.sh
+++ b/t/yacc-bison-skeleton.sh
@@ -30,16 +30,20 @@ cat > Makefile.am << 'END'
 bin_PROGRAMS = zardoz
 zardoz_SOURCES = zardoz.y foo.c
 AM_YFLAGS = -d --skeleton glr.c
+BUILT_SOURCES = zardoz.h
 END
 
 # Parser.
 cat > zardoz.y << 'END'
 %{
-int yylex () { return 0; }
-void yyerror (const char *s) { return; }
+int yylex ();
+void yyerror (const char *s);
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+%%
+int yylex () { return 0; }
+void yyerror (const char *s) { return; }
 END
 
 cat > foo.c << 'END'
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"


hooks/post-receive
-- 
GNU Automake



reply via email to

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