]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Clarify m4_copy semantics.
authorEric Blake <ebb9@byu.net>
Thu, 11 Jun 2009 12:43:39 +0000 (06:43 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 11 Jun 2009 12:43:39 +0000 (06:43 -0600)
* doc/autoconf.texi (Redefined M4 Macros) <m4_copy>: Update
documentation.
* tests/m4sugar.at (m4@&t@_defn): Enhance test.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi
tests/m4sugar.at

index 01fdd3d357e89b720709e9d7031da8942afe00b5..df57b305ae77736686e01a1ff5a6a58d674b69a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-11  Eric Blake  <ebb9@byu.net>
+
+       Clarify m4_copy semantics.
+       * doc/autoconf.texi (Redefined M4 Macros) <m4_copy>: Update
+       documentation.
+       * tests/m4sugar.at (m4@&t@_defn): Enhance test.
+
 2009-06-06  Eric Blake  <ebb9@byu.net>
 
        Improve documentation on trap pitfalls.
index 81bce071615ed644bbf93fa21508384b1ff6e954..9e3327e7c4da3e7c9c90ab76e8558ee5c4c80bfa 100644 (file)
@@ -10646,10 +10646,12 @@ released and supports extended regular expression syntax.
 @msindex{copy}
 @msindex{rename}
 These macros aren't directly builtins, but are closely related to
-@code{m4_pushdef} and @code{m4_defn}.  They both ensures that @var{dest}
+@code{m4_pushdef} and @code{m4_defn}.  They both ensure that @var{dest}
 is undefined, then proceed to copy the entire pushdef stack of
-definitions of @var{source}.  @code{m4_copy} preserves the source, while
-@code{m4_rename} undefines the original macro name.
+definitions of @var{source}.  @code{m4_copy} preserves the source
+(including in the special case where @var{source} is undefined), while
+@code{m4_rename} undefines the original macro name (making it an error
+to rename an undefined @var{source}).
 
 Note that attempting to invoke a renamed macro might not work, since the
 macro may have a dependence on helper macros accessed via composition of
index bf56c4dbacd2f42c440c7f5524c6c12e45ee698c..4bc7bd43cdf4a3cb8115e7c04f018339e1d424f7 100644 (file)
@@ -136,6 +136,14 @@ AT_CHECK_M4SUGAR([-o-], 1, [], [stderr])
 AT_CHECK([grep good stderr], [1])
 AT_CHECK([grep 'm4@&t@_undefine: undefined.*oops' stderr], [0], [ignore])
 
+# Cannot rename an undefined macro.
+AT_DATA_M4SUGAR([script.4s],
+[[m4_rename([oops], [good])
+]])
+
+AT_CHECK_M4SUGAR([-o-], 1, [], [stderr])
+AT_CHECK([grep 'm4@&t@_undefine: undefined.*oops' stderr], [0], [ignore])
+
 # Check that pushdef stacks can be renamed.
 AT_CHECK_M4SUGAR_TEXT([[m4_pushdef([a], [1])dnl
 m4_pushdef([a], [2])dnl
@@ -151,6 +159,8 @@ m4_popdef([b], [c])dnl
 a b c
 m4_popdef([b], [c])dnl
 a b c
+dnl m4_copy is intentionally a no-op on undefined source
+m4_copy([oops], [dummy])m4_ifdef([dummy], [[oops]])dnl
 ]], [[0 b c
 a 0 c
 a 0 0