]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Reduce blank lines in AC_DEFUN_ONCE macros.
authorEric Blake <ebb9@byu.net>
Wed, 28 Jan 2009 23:14:13 +0000 (16:14 -0700)
committerEric Blake <ebb9@byu.net>
Thu, 29 Jan 2009 00:04:43 +0000 (17:04 -0700)
* 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@&t@_require: nested): Adjust test.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/m4sugar/m4sugar.m4
tests/m4sugar.at

index e50376ed46e6b0a21d4338f2a1750c49e463fec2..33cadf89f8b8b3525c1da53d46b810cfb2700d5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-01-28  Eric Blake  <ebb9@byu.net>
 
+       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@&t@_require: 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
index 0af1f56108e486d430bf1b4a702fc3aceb8ead71..55dc6446f79871eb59cb0cae8931ee9c342d9f0f 100644 (file)
@@ -1939,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])
@@ -1978,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:
 #
index 5f3c01f11b662f3f1c171277ff67113181544332..6286af2dce2235931bb95bbf0078d0373ca17d3b 100644 (file)
@@ -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
 ]])