[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Avoid O(n^2) recursion in m4sugar
From: |
Eric Blake |
Subject: |
Re: Avoid O(n^2) recursion in m4sugar |
Date: |
Fri, 25 Jul 2008 21:16:59 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 7/25/2008 5:56 PM:
| The patch
| makes a runtime decision during m4_init on which version to use, so that
| m4 1.6 users automatically benefit from the faster of two available linear
| methods, while m4 1.4.x users get the only linear method.
| @@ -2293,6 +2311,13 @@ m4_define([m4_init],
| m4_pattern_forbid([^_?m4_])
| m4_pattern_forbid([^dnl$])
|
| +# If __m4_version__ is defined, we assume that we are being run by M4
| +# 1.6 or newer, and thus that $@ recursion is linear; nothing further
| +# needs to be done. But if it is missing, we assume we are being run
| +# by M4 1.4.x, that $@ recursion is quadratic, and that we need
| +# foreach-based replacement macros.
| +m4_ifndef([__m4_version__], [m4_include([m4sugar/foreach.m4])])
| +
This portion of the patch caused an infinite loop in aclocal - aclocal
recognized that the creation of aclocal.m4 now has an optional dependency
on an m4_include'd file, and triggered another round of autoreconf to try
to pick it up. Fixed as follows, by hiding the file from aclocal via
m4_builtin.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkiKlysACgkQ84KuGfSFAYDmEACfQvEUrNjCyFOk8u9Qr30IgpgI
K9MAoMy0pWvFd/Jwh3idyYbrkpsyfkS1
=Urkq
-----END PGP SIGNATURE-----
>From e48d698fdc54635576c491b1ed2c66fa289d80f9 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 25 Jul 2008 21:13:23 -0600
Subject: [PATCH] Avoid infinite aclocal loop.
* lib/m4sugar/m4sugar.m4 (m4_init): Bypass m4_include tracing, so
that aclocal doesn't insist on finding m4sugar/foreach.m4.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 4 ++++
lib/m4sugar/m4sugar.m4 | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1cc7cd6..c2147d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2008-07-25 Eric Blake <address@hidden>
+ Avoid infinite aclocal loop.
+ * lib/m4sugar/m4sugar.m4 (m4_init): Bypass m4_include tracing, so
+ that aclocal doesn't insist on finding m4sugar/foreach.m4.
+
Provide O(n) replacement macros for M4 1.4.x.
* lib/m4sugar/foreach.m4: New file.
(m4_foreach, m4_case, _m4_shiftn, m4_do, m4_dquote_elt, _m4_map)
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 1480953..3e201b9 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -2315,8 +2315,9 @@ m4_pattern_forbid([^dnl$])
# 1.6 or newer, and thus that $@ recursion is linear; nothing further
# needs to be done. But if it is missing, we assume we are being run
# by M4 1.4.x, that $@ recursion is quadratic, and that we need
-# foreach-based replacement macros.
-m4_ifndef([__m4_version__], [m4_include([m4sugar/foreach.m4])])
+# foreach-based replacement macros. Use the raw builtin to avoid
+# tripping up include tracing.
+m4_ifndef([__m4_version__], [m4_builtin([include], [m4sugar/foreach.m4])])
# _m4_divert_diversion should be defined:
m4_divert_push([KILL])
--
1.5.6.4