autoconf-patches
[Top][All Lists]
Advanced

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

Re: Optimize AC_REQUIRE


From: Eric Blake
Subject: Re: Optimize AC_REQUIRE
Date: Wed, 12 Dec 2007 23:33:02 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> 
> To avoid dnl in the m4_define calls, I went with:
> 
> m4_join([],
>         [a],
>         [b])
> 
> rather than the equivalent:
> 
> m4_do([[a]],
>       [[b]])

Apologies for my stupidity.  I tested with m4_do, then swapped to m4_join at 
the last minute, without realizing that in m4sugar.m4, m4_do is defined but 
m4_join was not at the point where I was using it.  The two constructs above 
are only equivalent when both macros are defined :(

I'm reverting back to what I tested, rather than trying to rearrange the file 
to define m4_join earlier.

From: Eric Blake <address@hidden>
Date: Wed, 12 Dec 2007 16:31:21 -0700
Subject: [PATCH] Fix thinko in earlier patch - m4_join isn't defined yet.

* lib/m4sugar/m4sugar.m4 (m4_expansion_stack_push, _m4_defun_pro)
(_m4_defun_pro_outer, _m4_defun_epi, _m4_defun_epi_outer)
(m4_require): Use m4_do, not m4_join.

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

diff --git a/ChangeLog b/ChangeLog
index 47cdf2e..323c135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-12-12  Eric Blake  <address@hidden>
 
+       Fix thinko in earlier patch - m4_join isn't defined yet.
+       * lib/m4sugar/m4sugar.m4 (m4_expansion_stack_push, _m4_defun_pro)
+       (_m4_defun_pro_outer, _m4_defun_epi, _m4_defun_epi_outer)
+       (m4_require): Use m4_do, not m4_join.
+
        Fix some whitespace tests on cygwin.
        * tests/tools.at (autom4te and whitespace in file names): Restore
        font-lock.  Create $TMPDIR before it might be used.
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index bcaeca3..c73a940 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -1369,11 +1369,10 @@ m4_define([_m4_divert(GROW)],       10000)
 # This is called frequently, so minimize the number of macro invocations
 # by avoiding dnl and m4_defn overhead.
 m4_define([_m4_defun_pro],
-m4_join([],
-       [m4_ifdef([m4_expansion_stack], [], [_m4_defun_pro_outer[]])],
-       [m4_expansion_stack_push(m4_builtin([defn],
-               [m4_location($1)])[: $1 is expanded from...])],
-       [m4_pushdef([_m4_expanding($1)])]))
+m4_do([[m4_ifdef([m4_expansion_stack], [], [_m4_defun_pro_outer[]])]],
+      [[m4_expansion_stack_push(m4_builtin([defn],
+         [m4_location($1)])[: $1 is expanded from...])]],
+      [[m4_pushdef([_m4_expanding($1)])]]))
 
 m4_define([_m4_defun_pro_outer],
 [m4_copy([_m4_divert_diversion], [_m4_divert_dump])m4_divert_push([GROW])])
@@ -1386,17 +1385,15 @@ m4_define([_m4_defun_pro_outer],
 # This is called frequently, so minimize the number of macro invocations
 # by avoiding dnl and m4_popdef overhead.
 m4_define([_m4_defun_epi],
-m4_join([],
-       [m4_builtin([popdef], [_m4_expanding($1)])],
-       [m4_expansion_stack_pop()],
-       [m4_ifdef([m4_expansion_stack], [], [_m4_defun_epi_outer[]])],
-       [m4_provide([$1])]))
+m4_do([[m4_builtin([popdef], [_m4_expanding($1)])]],
+      [[m4_expansion_stack_pop()]],
+      [[m4_ifdef([m4_expansion_stack], [], [_m4_defun_epi_outer[]])]],
+      [[m4_provide([$1])]]))
 
 m4_define([_m4_defun_epi_outer],
-m4_join([],
-       [m4_builtin([undefine], [_m4_divert_dump])],
-       [m4_divert_pop([GROW])],
-       [m4_undivert([GROW])]))
+m4_do([[m4_builtin([undefine], [_m4_divert_dump])]],
+      [[m4_divert_pop([GROW])]],
+      [[m4_undivert([GROW])]]))
 
 
 # m4_defun(NAME, EXPANSION)
@@ -1490,15 +1487,14 @@ m4_define([m4_before],
 # This is called frequently, so minimize the number of macro invocations
 # by avoiding dnl and other overhead on the common path.
 m4_define([m4_require],
-m4_join([],
-       [m4_ifdef([_m4_expanding($1)],
-                 [m4_fatal([$0: circular dependency of $1])])],
-       [m4_ifdef([_m4_divert_dump], [],
-                 [m4_fatal([$0($1): cannot be used outside of an ]dnl
-m4_bmatch([$0], [^AC_], [[AC_DEFUN]], [[m4_defun]])['d macro])])],
-       [m4_provide_if([$1],
-                      [],
-                      [_m4_require_call([$1], [$2])])]))
+m4_do([[m4_ifdef([_m4_expanding($1)],
+                [m4_fatal([$0: circular dependency of $1])])]],
+      [[m4_ifdef([_m4_divert_dump], [],
+                [m4_fatal([$0($1): cannot be used outside of an ]dnl
+m4_bmatch([$0], [^AC_], [[AC_DEFUN]], [[m4_defun]])['d macro])])]],
+      [[m4_provide_if([$1],
+                     [],
+                     [_m4_require_call([$1], [$2])])]]))
 
 
 # _m4_require_call(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
@@ -1508,18 +1504,17 @@ m4_bmatch([$0], [^AC_], [[AC_DEFUN]], [[m4_defun]])['d 
macro])])],
 # This is called frequently, so minimize the number of macro invocations
 # by avoiding dnl and other overhead on the common path.
 m4_define([_m4_require_call],
-m4_join([],
-       [m4_define([_m4_divert_grow], m4_decr(_m4_divert_grow))],
-       [m4_divert_push(_m4_divert_grow)],
-       [m4_default([$2], [$1])
+m4_do([[m4_define([_m4_divert_grow], m4_decr(_m4_divert_grow))]],
+      [[m4_divert_push(_m4_divert_grow)]],
+      [[m4_default([$2], [$1])
 m4_provide_if([$1],
              [],
              [m4_warn([syntax],
-                      [$1 is m4_require'd but not m4_defun'd])])],
-       [m4_divert(m4_builtin([defn], [_m4_divert_dump]))],
-       [m4_undivert(_m4_divert_grow)],
-       [m4_divert_pop(_m4_divert_grow)],
-       [m4_define([_m4_divert_grow], m4_incr(_m4_divert_grow))]))
+                      [$1 is m4_require'd but not m4_defun'd])])]],
+      [[m4_divert(m4_builtin([defn], [_m4_divert_dump]))]],
+      [[m4_undivert(_m4_divert_grow)]],
+      [[m4_divert_pop(_m4_divert_grow)]],
+      [[m4_define([_m4_divert_grow], m4_incr(_m4_divert_grow))]]))
 
 
 # _m4_divert_grow
-- 
1.5.3.5







reply via email to

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