m4-discuss
[Top][All Lists]
Advanced

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

Re: popdef(undefined), __m4_version__


From: Eric Blake
Subject: Re: popdef(undefined), __m4_version__
Date: Tue, 26 Aug 2008 06:32:11 -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 8/25/2008 7:07 AM:
> 
> Here's what I'm planning on committing to m4; it adds debugmode(d) as a
> new flag that controls whether dereferencing undefined macros warns, then
> enables the flag by default unless an explicit -d specifies other flags or
> if -E is in effect.  Both conditions for disabling the debugmode(d) flag
> were necessary, so that branch-1.6 of m4.git can once again handle
> autoconf 2.62 out of the box.

I've committed the m4 side.

> 
> By committing this series, I now need a followup patch to autoconf;
> m4sugar now needs to explicitly request m4_debugmode([+d]) when it detects
> __m4_version__, before it can rely on native defn/popdef/undefine for speed.

Here's what I'm committing on the autoconf side.

- --
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

iEYEARECAAYFAkiz98oACgkQ84KuGfSFAYCwDACg2DwLJNScZdEMmp+EQLgctGeF
VyAAoJMtlRhKtiNpEsX1mI4TacK7LT/r
=1ChQ
-----END PGP SIGNATURE-----
>From 5391c02b40f89b33fb7e1b309cb61986281a0161 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 25 Aug 2008 16:26:27 -0600
Subject: [PATCH] Adjust to recent m4 1.6 change to support m4_debugmode(d).

* lib/m4sugar/m4sugar.m4 (m4_defn, m4_popdef, m4_undefine): Move
freeze-time decision of using faster 1.6 implementation...
(m4_init): ...to a runtime decision, and add use of new debugmode
flag.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog              |    8 ++++++++
 lib/m4sugar/m4sugar.m4 |   39 +++++++++++++++++++++------------------
 2 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5b45504..51812e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-25  Eric Blake  <address@hidden>
+
+       Adjust to recent m4 1.6 change to support m4_debugmode(d).
+       * lib/m4sugar/m4sugar.m4 (m4_defn, m4_popdef, m4_undefine): Move
+       freeze-time decision of using faster 1.6 implementation...
+       (m4_init): ...to a runtime decision, and add use of new debugmode
+       flag.
+
 2008-08-22  Peter O'Gorman  <address@hidden>
 
        Limit AC_C_BIGENDIAN univeral checks to Mac OS X.
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 6ee157c..3607e45 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -529,19 +529,18 @@ m4_define([m4_default],
 #
 # This macro is called frequently, so minimize the amount of additional
 # expansions by skipping m4_ifndef.  Better yet, if __m4_version__ exists,
-# (added in M4 1.6), then let m4 do the job for us.
+# (added in M4 1.6), then let m4 do the job for us (see m4_init).
 #
 # _m4_defn is for internal use only - it bypasses the wrapper, so it
 # must only be used on one argument at a time, and only on macros
 # known to be defined.  Make sure this still works if the user renames
 # m4_defn but not _m4_defn.
 m4_copy([m4_defn], [_m4_defn])
-m4_ifdef([__m4_version__], [],
-[m4_define([m4_defn],
+m4_define([m4_defn],
 [m4_if([$#], [0], [[$0]],
        [$#], [1], [m4_ifdef([$1], [_m4_defn([$1])],
                            [m4_fatal([$0: undefined macro: $1])])],
-       [m4_foreach([_m4_macro], address@hidden, 
[$0(_m4_defn([_m4_macro]))])])])])
+       [m4_foreach([_m4_macro], address@hidden, 
[$0(_m4_defn([_m4_macro]))])])])
 
 
 # _m4_dumpdefs_up(NAME)
@@ -579,18 +578,17 @@ _m4_dumpdefs_down([$1])])
 #
 # This macro is called frequently, so minimize the amount of additional
 # expansions by skipping m4_ifndef.  Better yet, if __m4_version__ exists,
-# (added in M4 1.6), then let m4 do the job for us.
+# (added in M4 1.6), then let m4 do the job for us (see m4_init).
 #
 # _m4_popdef is for internal use only - it bypasses the wrapper, so it
 # must only be used on macros known to be defined.  Make sure this
 # still works if the user renames m4_popdef but not _m4_popdef.
 m4_copy([m4_popdef], [_m4_popdef])
-m4_ifdef([__m4_version__], [],
-[m4_define([m4_popdef],
+m4_define([m4_popdef],
 [m4_if([$#], [0], [[$0]],
        [$#], [1], [m4_ifdef([$1], [_m4_popdef([$1])],
                            [m4_fatal([$0: undefined macro: $1])])],
-       [m4_foreach([_m4_macro], address@hidden, 
[$0(_m4_defn([_m4_macro]))])])])])
+       [m4_foreach([_m4_macro], address@hidden, 
[$0(_m4_defn([_m4_macro]))])])])
 
 
 # m4_shiftn(N, ...)
@@ -646,18 +644,17 @@ m4_define([_m4_shift3],
 #
 # This macro is called frequently, so minimize the amount of additional
 # expansions by skipping m4_ifndef.  Better yet, if __m4_version__ exists,
-# (added in M4 1.6), then let m4 do the job for us.
+# (added in M4 1.6), then let m4 do the job for us (see m4_init).
 #
 # _m4_undefine is for internal use only - it bypasses the wrapper, so
 # it must only be used on macros known to be defined.  Make sure this
 # still works if the user renames m4_undefine but not _m4_undefine.
 m4_copy([m4_undefine], [_m4_undefine])
-m4_ifdef([__m4_version__], [],
-[m4_define([m4_undefine],
+m4_define([m4_undefine],
 [m4_if([$#], [0], [[$0]],
        [$#], [1], [m4_ifdef([$1], [_m4_undefine([$1])],
                            [m4_fatal([$0: undefined macro: $1])])],
-       [m4_foreach([_m4_macro], address@hidden, 
[$0(_m4_defn([_m4_macro]))])])])])
+       [m4_foreach([_m4_macro], address@hidden, 
[$0(_m4_defn([_m4_macro]))])])])
 
 # _m4_wrap(PRE, POST)
 # -------------------
@@ -2771,12 +2768,18 @@ 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.  Use the raw builtin to avoid
-# tripping up include tracing.
-m4_ifndef([__m4_version__], [m4_builtin([include], [m4sugar/foreach.m4])])
+# 1.6 or newer, and thus that $@ recursion is linear and debugmode(d)
+# is available for faster checks of dereferencing undefined macros.
+# 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.  Use the raw builtin to avoid tripping up
+# include tracing.
+m4_ifdef([__m4_version__],
+[m4_debugmode([+d])
+m4_copy([_m4_defn], [m4_defn])
+m4_copy([_m4_popdef], [m4_popdef])
+m4_copy([_m4_undefine], [m4_undefine])],
+[m4_builtin([include], [m4sugar/foreach.m4])])
 
 # _m4_divert_diversion should be defined:
 m4_divert_push([KILL])
-- 
1.6.0


reply via email to

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