autoconf-patches
[Top][All Lists]
Advanced

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

Re: AS_FOR [was: Faster AC_CHECK_{HEADERS,FUNCS}]


From: Eric Blake
Subject: Re: AS_FOR [was: Faster AC_CHECK_{HEADERS,FUNCS}]
Date: Mon, 17 Nov 2008 06:21:37 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

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

According to Paolo Bonzini on 11/17/2008 3:54 AM:
> Hmmm, won't this:
> 
>> +m4_defun([AS_FOR],
>> +[m4_pushdef([$1], m4_if(m4_translit([$3], ]dnl
>> +m4_dquote(_m4_defn([m4_cr_symbols2]))[[%+=:,./-]), [], [[$3]], [[$$2]]))]dnl
> 
> define $1 to $3 if $3 is empty?

Good catch.  Fixed as follows:

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

iEYEARECAAYFAkkhb+EACgkQ84KuGfSFAYAKOgCeNdQsK/IVhGcNzv0+2goCs3v5
mbEAni3TLfTZwEy2HbDJUdaeTBgrtY5+
=/2Xa
-----END PGP SIGNATURE-----
>From 7ad7019cf702c136869beef91b65bceae7c7dbb3 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 17 Nov 2008 06:20:27 -0700
Subject: [PATCH] Detect empty list in AS_FOR.

* lib/m4sugar/m4sh.m4 (AS_FOR): Handle iteration over $@
properly.
* tests/m4sh.at (AS@&address@hidden): Enhance test to catch it.
Reported by Paolo Bonzini.

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

diff --git a/ChangeLog b/ChangeLog
index bf0e871..41f97d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-17  Eric Blake  <address@hidden>
+
+       Detect empty list in AS_FOR.
+       * lib/m4sugar/m4sh.m4 (AS_FOR): Handle iteration over $@
+       properly.
+       * tests/m4sh.at (AS@&address@hidden): Enhance test to catch it.
+       Reported by Paolo Bonzini.
+
 2008-11-16  Ralf Wildenhues  <address@hidden>
 
        Use a different workaround for an automake quirk.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 2c592c6..4da8f37 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -552,7 +552,7 @@ m4_define([AS_EXIT],
 # substitution, shell quoting, globs, or quadrigraphs).  Inline the
 # m4_defn for speed.
 m4_defun([AS_FOR],
-[m4_pushdef([$1], m4_if(m4_translit([$3], ]dnl
+[m4_pushdef([$1], m4_if([$3], [], [[$$2]], m4_translit([$3], ]dnl
 m4_dquote(_m4_defn([m4_cr_symbols2]))[[%+=:,./-]), [], [[$3]], [[$$2]]))]dnl
 [for $2[]m4_ifval([$3], [ in $3])
 do
diff --git a/tests/m4sh.at b/tests/m4sh.at
index 383d821..96e0452 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -934,7 +934,7 @@ AS_FOR([m4var], [shvar], [\'],
 # Syntax checks: cope with empty arguments.
 set f g
 AS_FOR([], [shvar], [],
-[echo "$shvar"])
+[echo "m4_defn([]) $shvar"])
 rm -f file
 AS_FOR([], [shvar], [`touch file`])
 test -f file || exit 1
@@ -963,8 +963,8 @@ e e
 d e d e
 $list $list
 ' '
-f
-g
+f f
+g g
 h
 j
 ]])
-- 
1.6.0.4


reply via email to

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