[Top][All Lists]

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

Re: [PATCH 1/5] add a separate diversion for shell functions

From: Eric Blake
Subject: Re: [PATCH 1/5] add a separate diversion for shell functions
Date: Mon, 06 Oct 2008 21:44:47 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080914 Thunderbird/ Mnenhy/

Hash: SHA1

According to Paolo Bonzini on 9/20/2008 11:08 AM:
>> Nice - as long as we guarantee that shell initialization finds a shell
>> that supports functions, then this is the right way to ensure functions
>> are declared first.  However, for languages with more diversions (think
>> autoconf and autotest), it still makes sense to have as many macros
>> deferred until after --help/--version is processed, to avoid time lost in
>> parsing shell functions that are otherwise unused, so we need to remember
>> to not make the new diversion the catchall location for all functions.
> Then it'd be better to also add the diversion argument to
> AS_REQUIRE_SHELL_FN.  This means applying this patch 1bis/5 which is
> folded into this one in my push to the mob branch.

And on top of that, I'm squashing in this.  The modified 1/5 is now
pushed, and I'll start reviewing 2/5.  I've rebased the rest of your
series on;h=refs/heads/m4sh-func
(although at this point, you may want to double check or ack my rebase).

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

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -

diff --git a/ChangeLog b/ChangeLog
index 2cc526b..7e73e22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2008-09-18  Paolo Bonzini  <address@hidden>
+       and Eric Blake  <address@hidden>
+       Add a separate diversion for shell functions.
        * lib/m4sugar/m4sh.m4 (M4SH-INIT-FN): New diversion.
        (AS_REQUIRE): Accept diversion parameter.
        (AS_REQUIRE_SHELL_FN): Use it.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 09a667f..5fa2ef7 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -107,7 +107,7 @@ m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
 #            [DIVERSION = M4SH-INIT])
 # -----------------------------------------------------------
 # BODY-TO-EXPAND is some initialization which must be expanded in the
-# given diversion when expanded (required or not).  This is very different
+# given diversion when expanded (required or not).  This is very
 # different from m4_require.  For instance:
 #      m4_defun([_FOO_PREPARE], [foo=foo])
@@ -144,12 +144,13 @@ m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
 [m4_provide_if([$1], [],
-              [m4_divert_text(m4_default([$3], [M4SH-INIT]),
+              [m4_divert_text(m4_default_quoted([$3], [M4SH-INIT]),
                               [m4_default([$2], [$1])])])])
+#                     [DIVERSION = M4SH-INIT-FN])
+# --------------------------------------------------
 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
 # given diversion when expanded (required or not).  Unlike other
 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
@@ -158,7 +159,7 @@ m4_define([AS_REQUIRE_SHELL_FN],
 AS_REQUIRE([AS_SHELL_FN_$1], [m4_provide([AS_SHELL_FN_$1])$1() {
-}], [m4_default([$3], [M4SH-INIT-FN])])])
+}], [m4_default_quoted([$3], [M4SH-INIT-FN])])])

reply via email to

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