autoconf-commit
[Top][All Lists]
Advanced

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

[SCM] GNU Autoconf source repository branch, master, updated. v2.63-272-


From: Eric Blake
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.63-272-gf8fcfad
Date: Thu, 29 Jan 2009 00:19:27 +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 Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=f8fcfad14630930c1877dcc4915c17be8fa46612

The branch, master has been updated
       via  f8fcfad14630930c1877dcc4915c17be8fa46612 (commit)
       via  876b3fbfdda6563e95463775dc9b5ae846919d9b (commit)
       via  9c4c7c5ca4974debb0e8774455b988396ac14c06 (commit)
      from  aa30765d64d4a50ad7ce83e78b5699223571ef36 (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 f8fcfad14630930c1877dcc4915c17be8fa46612
Author: Eric Blake <address@hidden>
Date:   Wed Jan 28 09:11:28 2009 -0700

    Use AC_DEFUN_ONCE for uncontroversial one-shot macros.
    
    * lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Switch to
    AC_DEFUN_ONCE, since this is a one-shot macro.
    * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Likewise.
    * lib/autoconf/general.m4 (AC_CANONICAL_BUILD)
    (AC_CANONICAL_HOST, AC_CANONICAL_TARGET): Likewise.
    
    Signed-off-by: Eric Blake <address@hidden>

commit 876b3fbfdda6563e95463775dc9b5ae846919d9b
Author: Eric Blake <address@hidden>
Date:   Wed Jan 28 16:14:13 2009 -0700

    Reduce blank lines in AC_DEFUN_ONCE macros.
    
    * lib/m4sugar/m4sugar.m4 (m4_defun_once): Avoid redundant blank
    line when a defun_once macro is required.
    (_m4_defun_once): New helper macro, for less memory use.
    * tests/m4sugar.at (m4@&address@hidden: nested): Adjust test.
    
    Signed-off-by: Eric Blake <address@hidden>

commit 9c4c7c5ca4974debb0e8774455b988396ac14c06
Author: Eric Blake <address@hidden>
Date:   Wed Jan 28 11:01:42 2009 -0700

    Silence another false positive expand-before-require.
    
    * lib/m4sugar/m4sugar.m4 (_m4_defun_pro_outer)
    (_m4_defun_epi_outer, _m4_require_call, m4_provide): Track name
    that caused a diversion change, not just diversion number.
    (m4_require): Factor...
    (_m4_require_check): ...into new macro, which also checks whether
    diversion that performed the expansion has been collected.
    * tests/m4sugar.at (m4@&address@hidden: nested): Enhance test.
    Reported by Ralf Wildenhues.
    
    Signed-off-by: Eric Blake <address@hidden>

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

Summary of changes:
 ChangeLog                |   27 +++++++++++++
 lib/autoconf/general.m4  |    6 +-
 lib/autoconf/headers.m4  |    2 +-
 lib/autoconf/specific.m4 |    6 +-
 lib/m4sugar/m4sugar.m4   |   95 ++++++++++++++++++++++++++++++++-------------
 tests/m4sugar.at         |   17 ++++++--
 6 files changed, 114 insertions(+), 39 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 44e147c..a706db2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,32 @@
 2009-01-28  Eric Blake  <address@hidden>
 
+       Use AC_DEFUN_ONCE for uncontroversial one-shot macros.
+       * lib/autoconf/headers.m4 (AC_HEADER_ASSERT): Switch to
+       AC_DEFUN_ONCE, since this is a one-shot macro.
+       * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Likewise.
+       * lib/autoconf/general.m4 (AC_CANONICAL_BUILD)
+       (AC_CANONICAL_HOST, AC_CANONICAL_TARGET): Likewise.
+
+2009-01-28  Eric Blake  <address@hidden>
+
+       Reduce blank lines in AC_DEFUN_ONCE macros.
+       * lib/m4sugar/m4sugar.m4 (m4_defun_once): Avoid redundant blank
+       line when a defun_once macro is required.
+       (_m4_defun_once): New helper macro, for less memory use.
+       * tests/m4sugar.at (m4@&address@hidden: nested): Adjust test.
+
+       Silence another false positive expand-before-require.
+       * lib/m4sugar/m4sugar.m4 (_m4_defun_pro_outer)
+       (_m4_defun_epi_outer, _m4_require_call, m4_provide): Track name
+       that caused a diversion change, not just diversion number.
+       (m4_require): Factor...
+       (_m4_require_check): ...into new macro, which also checks whether
+       diversion that performed the expansion has been collected.
+       * tests/m4sugar.at (m4@&address@hidden: nested): Enhance test.
+       Reported by Ralf Wildenhues.
+
+2009-01-28  Eric Blake  <address@hidden>
+
        Fix AC_C_RESTRICT for Sun Studio 12 C++.
        * lib/autoconf/c.m4 (AC_C_RESTRICT): Newer Sun Studio C provides
        __restrict__ rather than _Restrict, which still trips up Sun
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index cb7e5c2..83254ed 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1791,7 +1791,7 @@ AC_SUBST([$1_os])dnl
 
 # AC_CANONICAL_BUILD
 # ------------------
-AC_DEFUN([AC_CANONICAL_BUILD],
+AC_DEFUN_ONCE([AC_CANONICAL_BUILD],
 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_REQUIRE_AUX_FILE([config.sub])dnl
 AC_REQUIRE_AUX_FILE([config.guess])dnl
@@ -1818,7 +1818,7 @@ _AC_CANONICAL_SPLIT(build)
 
 # AC_CANONICAL_HOST
 # -----------------
-AC_DEFUN([AC_CANONICAL_HOST],
+AC_DEFUN_ONCE([AC_CANONICAL_HOST],
 [AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_divert_once([HELP_CANON],
 [[  --host=HOST       cross-compile to build programs to run on HOST 
[BUILD]]])dnl
@@ -1836,7 +1836,7 @@ _AC_CANONICAL_SPLIT([host])
 
 # AC_CANONICAL_TARGET
 # -------------------
-AC_DEFUN([AC_CANONICAL_TARGET],
+AC_DEFUN_ONCE([AC_CANONICAL_TARGET],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_BEFORE([$0], [AC_ARG_PROGRAM])dnl
 m4_divert_once([HELP_CANON],
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 3702a85..120adc9 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -431,7 +431,7 @@ AN_HEADER([wctype.h],           [AC_CHECK_HEADERS])
 # AC_HEADER_ASSERT
 # ----------------
 # Check whether to enable assertions.
-AC_DEFUN([AC_HEADER_ASSERT],
+AC_DEFUN_ONCE([AC_HEADER_ASSERT],
 [
   AC_MSG_CHECKING([whether to enable assertions])
   AC_ARG_ENABLE([assert],
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 5fcfe37..322364e 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -2,8 +2,8 @@
 # Macros that test for specific, unclassified, features.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
-# Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+# Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -383,7 +383,7 @@ matches *mingw32*])# AC_MINGW32
 # AC_DEFINE.  The goal here is to define all known feature-enabling
 # macros, then, if reports of conflicts are made, disable macros that
 # cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 183c8a6..55dc644 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -1723,19 +1723,36 @@ m4_define([m4_undivert],
 #
 # The problem can only occur if a single defun'd macro first provides,
 # then later indirectly requires, the same macro.  Note that directly
-# expanding then requiring a macro is okay, because the dependency was
-# met, the require phase will be a no-op; the out-of-order expansion
-# problem is only present if the requirement is nested inside a
-# context that will be hoisted in front of the outermost defun'd
-# macro.  In other words, we must be careful not to warn on:
+# expanding then requiring a macro is okay: because the dependency was
+# met, the require phase can be a no-op.  For that matter, the outer
+# macro can even require two helpers, where the first helper expands
+# the macro, and the second helper indirectly requires the macro.
+# Out-of-order expansion is only present if the inner macro is
+# required by something that will be hoisted in front of where the
+# direct expansion occurred.  In other words, we must be careful not
+# to warn on:
 #
 # | m4_defun([TEST4], [4])
-# | m4_defun([TEST5], [TEST4 m4_require([TEST4])])
-#
-# So, to detect whether a require was direct or indirect, m4_provide
-# stores the diversion number at which a macro was provided.  A
-# require call is direct if it occurs within the same diversion that
-# the macro was provided.
+# | m4_defun([TEST5], [5 TEST4 m4_require([TEST4])])
+# | TEST5 => 5 4
+#
+# or even the more complex:
+#
+# | m4_defun([TEST6], [6])
+# | m4_defun([TEST7], [7 TEST6])
+# | m4_defun([TEST8], [8 m4_require([TEST6])])
+# | m4_defun([TEST9], [9 m4_require([TEST8])])
+# | m4_defun([TEST10], [10 m4_require([TEST7]) m4_require([TEST9])])
+# | TEST10 => 7 6 8 9 10
+#
+# So, to detect whether a require was direct or indirect, m4_defun and
+# m4_require track the name of the macro that caused a diversion to be
+# created (using the stack _m4_diverting, coupled with an O(1) lookup
+# _m4_diverting([NAME])), and m4_provide stores the name associated
+# with the diversion at which a macro was provided.  A require call is
+# direct if it occurs within the same diversion where the macro was
+# provided, or if the diversion associated with the providing context
+# has been collected.
 #
 # The implementation of the warning involves tracking the set of
 # macros which have been provided since the start of the outermost
@@ -1750,7 +1767,8 @@ m4_define([m4_undivert],
 # to inform the user that her macros trigger the bug in older autoconf
 # versions, and that her output file now contains redundant contents
 # (and possibly new problems, if the repeated macro was not
-# idempotent).
+# idempotent).  Meanwhile, macros defined by m4_defun_once instead of
+# m4_defun are idempotent, avoiding any warning or duplicate output.
 #
 #
 # 2. Keeping track of the expansion stack
@@ -1824,11 +1842,12 @@ m4_define([_m4_divert(GROW)],       10000)
 # This is called frequently, so minimize the number of macro invocations
 # by avoiding dnl and m4_defn overhead.
 m4_define([_m4_defun_pro],
-[m4_ifdef([_m4_expansion_stack], [], [_m4_defun_pro_outer[]])]dnl
+[m4_ifdef([_m4_expansion_stack], [], [_m4_defun_pro_outer([$1])])]dnl
 [m4_expansion_stack_push([$1])m4_pushdef([_m4_expanding($1)])])
 
 m4_define([_m4_defun_pro_outer],
 [m4_set_delete([_m4_provide])]dnl
+[m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])]dnl
 [m4_pushdef([_m4_divert_dump], m4_divnum)m4_divert_push([GROW])])
 
 # _m4_defun_epi(MACRO-NAME)
@@ -1840,11 +1859,12 @@ m4_define([_m4_defun_pro_outer],
 # by avoiding dnl and m4_popdef overhead.
 m4_define([_m4_defun_epi],
 [_m4_popdef([_m4_expanding($1)], [_m4_expansion_stack])]dnl
-[m4_ifdef([_m4_expansion_stack], [], [_m4_defun_epi_outer[]])]dnl
+[m4_ifdef([_m4_expansion_stack], [], [_m4_defun_epi_outer([$1])])]dnl
 [m4_provide([$1])])
 
 m4_define([_m4_defun_epi_outer],
-[_m4_popdef([_m4_divert_dump])m4_divert_pop([GROW])m4_undivert([GROW])])
+[_m4_popdef([_m4_divert_dump], [_m4_diverting([$1])], [_m4_diverting])]dnl
+[m4_divert_pop([GROW])m4_undivert([GROW])])
 
 
 # _m4_divert_dump
@@ -1919,12 +1939,17 @@ m4_define([m4_defun_init],
 #
 # If _m4_divert_dump is empty, we are called at the top level;
 # otherwise, we must ensure that we are required in front of the
-# current defun'd macro.
+# current defun'd macro.  Use a helper macro so that EXPANSION need
+# only occur once in the definition of NAME, since it might be large.
 m4_define([m4_defun_once],
 [m4_define([m4_location($1)], m4_location)]dnl
-[m4_define([$1], [m4_pushdef([$1])m4_if(_m4_divert_dump, [],
-  [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])],
-  [_m4_require_call([$1], [$2[]m4_provide([$1])], _m4_divert_dump)])])])
+[m4_define([$1], [_m4_defun_once([$1], [$2], m4_if(_m4_divert_dump, [],
+  [[_m4_defun_pro([$1])m4_unquote(], [)_m4_defun_epi([$1])]],
+m4_ifdef([_m4_diverting([$1])], [-]), [-], [[m4_unquote(], [)]],
+  [[_m4_require_call([$1],], [, _m4_divert_dump)]]))])])
+
+m4_define([_m4_defun_once],
+[m4_pushdef([$1])$3[$2[]m4_provide([$1])]$4])
 
 
 # m4_pattern_forbid(ERE, [WHY])
@@ -1958,8 +1983,9 @@ m4_define([m4_before],
 # -----------------------------------------------------------
 # If NAME-TO-CHECK has never been expanded (actually, if it is not
 # m4_provide'd), expand BODY-TO-EXPAND *before* the current macro
-# expansion.  Once expanded, emit it in _m4_divert_dump.  Keep track
-# of the m4_require chain in _m4_expansion_stack.
+# expansion; follow the expansion with a newline.  Once expanded, emit
+# it in _m4_divert_dump.  Keep track of the m4_require chain in
+# _m4_expansion_stack.
 #
 # The normal cases are:
 #
@@ -1995,10 +2021,9 @@ m4_define([m4_require],
 [m4_if(_m4_divert_dump, [],
   [m4_fatal([$0($1): cannot be used outside of an ]dnl
 m4_if([$0], [m4_require], [[m4_defun]], [[AC_DEFUN]])['d macro])])]dnl
-[m4_provide_if([$1], [m4_set_contains([_m4_provide], [$1], [m4_if(m4_divnum,
-      _m4_defn([m4_provide($1)]), [m4_ignore], [m4_warn([syntax],
-      [$0: `$1' was expanded before it was required])_m4_require_call])],
-    [m4_ignore])], [_m4_require_call])([$1], [$2], _m4_divert_dump)])
+[m4_provide_if([$1], [m4_set_contains([_m4_provide], [$1],
+    [_m4_require_check([$1], _m4_defn([m4_provide($1)]), [$0])], [m4_ignore])],
+  [_m4_require_call])([$1], [$2], _m4_divert_dump)])
 
 
 # _m4_require_call(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK],
@@ -2011,13 +2036,26 @@ m4_if([$0], [m4_require], [[m4_defun]], 
[[AC_DEFUN]])['d macro])])]dnl
 # by avoiding dnl and other overhead on the common path.
 m4_define([_m4_require_call],
 [m4_pushdef([_m4_divert_grow], m4_decr(_m4_divert_grow))]dnl
-[m4_pushdef([_m4_require])]dnl
+[m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])]dnl
 [m4_divert_push(_m4_divert_grow)]dnl
 [m4_if([$2], [], [$1], [$2])
 m4_provide_if([$1], [m4_set_remove([_m4_provide], [$1])],
   [m4_warn([syntax], [$1 is m4_require'd but not m4_defun'd])])]dnl
 [_m4_divert_raw($3)_m4_undivert(_m4_divert_grow)]dnl
-[m4_divert_pop(_m4_divert_grow)_m4_popdef([_m4_divert_grow], [_m4_require])])
+[m4_divert_pop(_m4_divert_grow)_m4_popdef([_m4_divert_grow],
+[_m4_diverting([$1])], [_m4_diverting])])
+
+
+# _m4_require_check(NAME-TO-CHECK, OWNER, CALLER)
+# -----------------------------------------------
+# NAME-TO-CHECK has been identified as previously expanded in the
+# diversion owned by OWNER.  If this is a problem, warn on behalf of
+# CALLER and return _m4_require_call; otherwise return m4_ignore.
+m4_define([_m4_require_check],
+[m4_if(_m4_defn([_m4_diverting]), [$2], [m4_ignore],
+       m4_ifdef([_m4_diverting([$2])], [-]), [-], [m4_warn([syntax],
+   [$3: `$1' was expanded before it was required])_m4_require_call],
+       [m4_ignore])])
 
 
 # _m4_divert_grow
@@ -2040,7 +2078,8 @@ m4_define([m4_expand_once],
 # ----------------------
 m4_define([m4_provide],
 [m4_ifdef([m4_provide($1)], [],
-[m4_set_add([_m4_provide], [$1], [m4_define([m4_provide($1)], m4_divnum)])])])
+[m4_set_add([_m4_provide], [$1], [m4_define([m4_provide($1)],
+  m4_ifdef([_m4_diverting], [_m4_defn([_m4_diverting])]))])])])
 
 
 # m4_provide_if(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
diff --git a/tests/m4sugar.at b/tests/m4sugar.at
index 99d8eab..6286af2 100644
--- a/tests/m4sugar.at
+++ b/tests/m4sugar.at
@@ -461,8 +461,7 @@ dnl Check m4_defun_once behavior
 AT_CHECK_M4SUGAR_TEXT([[
 m4_defun_once([a], [[a]])dnl
 m4_defun([b], [[b]m4_require([a])])dnl
-m4_defun([c], [[c]
-a[]m4_require([b])])dnl
+m4_defun([c], [[c]a[]m4_require([b])])dnl
 c
 a
 m4_defun_once([d], [[d]m4_require([a])])dnl
@@ -475,10 +474,8 @@ a
 b
 c
 
-
 d
 e
-
 f
 ]])
 
@@ -618,6 +615,13 @@ e
 f])dnl
 m4_defun([h], [[h]m4_require([g])])dnl
 h
+m4_defun([i], [[i]])dnl
+m4_defun([j], [[j]
+i])dnl
+m4_defun([k], [[k]m4_require([i])])dnl
+m4_defun([l], [[l]m4_require([k])])dnl
+m4_defun([m], [[m]m4_require([j])m4_require([l])])dnl
+m
 ]],
 [[pre1
 a
@@ -635,6 +639,11 @@ g
 e
 f
 h
+j
+i
+k
+l
+m
 ]])
 
 AT_CLEANUP


hooks/post-receive
--
GNU Autoconf source repository




reply via email to

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