autoconf-patches
[Top][All Lists]
Advanced

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

Re: [RFC] improve autotest syntax checks


From: Eric Blake
Subject: Re: [RFC] improve autotest syntax checks
Date: Tue, 11 Mar 2008 20:16:51 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 3/11/2008 7:07 PM:
| The problem is that m4wrap stores the $1 literally, leaving it for the
| definition of foo, but _m4_wrap_text is m4_define'd to contain a $1 then
| expanded later, meaning the $1 is expanded as an (empty) argument and foo
| is defined to the empty string.  However, the M4 manual suffers from the
| same bug, so I'll have to think of a way to patch it later and fix it in
| both projects.

Like so.  Applying.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkfXPRMACgkQ84KuGfSFAYAyXwCg1KSlfYlCTJTZyPMX+b6WcH1H
uJcAn3d44SB/KZmwiBrcI4ZdGklBenXp
=s8qj
-----END PGP SIGNATURE-----
>From 3c108e5e9d4eeff6faebc3107dfd11e3b238227e Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 11 Mar 2008 20:05:49 -0600
Subject: [PATCH] Fix yesterday's regression in m4_wrap([$1]).

* lib/m4sugar/m4sugar.m4 (_m4_wrap): Don't directly invoke wrapped
text, since it may contain text that looks like parameters.
* tests/m4sh.at (AS@&address@hidden cleanup): Enhance test.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog              |    7 +++++++
 lib/m4sugar/m4sugar.m4 |    5 +++--
 tests/m4sh.at          |    4 +++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c6cc1e7..2892f57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-12  Eric Blake  <address@hidden>
+
+       Fix yesterday's regression in m4_wrap([$1]).
+       * lib/m4sugar/m4sugar.m4 (_m4_wrap): Don't directly invoke wrapped
+       text, since it may contain text that looks like parameters.
+       * tests/m4sh.at (AS@&address@hidden cleanup): Enhance test.
+
 2008-03-11  Eric Blake  <address@hidden>
 
        Improve error messages for common testsuite bugs.
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 9fc7227..e755f98 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -611,11 +611,12 @@ m4_define([m4_undefine],
 # -------------------
 # Helper macro for m4_wrap and m4_wrap_lifo.  Allows nested calls to
 # m4_wrap within wrapped text.
+# Skip m4_defn and m4_popdef for speed.
 m4_define([_m4_wrap],
 [m4_ifdef([$0_text],
          [m4_define([$0_text], [$1]m4_builtin([defn], [$0_text])[$2])],
-         [m4_builtin([m4wrap], [$0_text(m4_builtin([popdef],
-  [$0_text]))])m4_define([$0_text], [$1$2])])])
+         [m4_builtin([m4wrap], [m4_unquote(m4_builtin([defn],
+  [$0_text])m4_builtin([popdef], [$0_text]))])m4_define([$0_text], [$1$2])])])
 
 # m4_wrap(TEXT)
 # -------------
diff --git a/tests/m4sh.at b/tests/m4sh.at
index dc50942..726a23e 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -776,8 +776,10 @@ AS_INIT
 dnl Registered after AS_INIT's cleanups, thus goes to KILL diversion
 m4_wrap([echo cleanup 2
 dnl However, nested wraps and diversions can still be used
+dnl Also, test wrapping text that looks like parameter reference
 m4_wrap([echo cleanup 3
-m4_divert_text([M4SH-INIT], [echo prep 4
+m4_divert_text([M4SH-INIT], [m4_define([foo], [$1])dnl
+echo prep foo([4])
 ])])])
 dnl Registered before AS_INIT's cleanups
 m4_wrap_lifo([echo cleanup 5
-- 
1.5.4


reply via email to

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