[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
m4_map_sep bug (introduced by 2005-06-06 Autoconf patch) breaks Bison
From: |
Paul Eggert |
Subject: |
m4_map_sep bug (introduced by 2005-06-06 Autoconf patch) breaks Bison |
Date: |
Wed, 05 Oct 2005 16:20:10 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
In <http://lists.gnu.org/archive/html/bug-bison/2005-10/msg00004.html>
"John P. Hartmann" <address@hidden> writes:
> http://lists.gnu.org/archive/html/autoconf-patches/2005-06/txtRXb8U1rojj.txt
> ... The change to m4sugar generates a spurious semicolon before the
> function body (opening {) when a function takes no parameters.
>
> This causes bison not to build.
Thanks for reporting this. I have installed the following patch into
both GNU Autoconf and Bison, in an attempt to work around the problem.
Stepan, can you please double-check this patch? It still feels
vaguely wrong. I think that somehow m4_cdr is returning the empty
string rather than an empty list. You can observe the effect of the
original bug by unpacking <ftp://ftp.gnu.org/gnu/bison/bison-2.1.tar.gz>
and looking at line 1235 of bison-2.1/src/parse-gram.c. Thanks.
2005-10-05 Paul Eggert <address@hidden>
* lib/m4sugar/m4sugar.m4 (_m4_map): New macro.
(m4_map, m4_map_sep): Use it. Handle the empty list correctly.
--- lib/m4sugar/m4sugar.m4 25 Jul 2005 17:47:08 -0000 2.94
+++ lib/m4sugar/m4sugar.m4 5 Oct 2005 21:24:03 -0000
@@ -398,8 +398,11 @@ m4_define([m4_cdr],
# of LIST (which can be lists themselves, for multiple arguments MACROs).
m4_define([m4_fst], [$1])
m4_define([m4_map],
+[m4_if([$2], [[]], [],
+ [_m4_map([$1], [$2])])])
+m4_define([_m4_map],
[m4_ifval([$2],
- [$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])])
+ [$1(m4_fst($2))[]_m4_map([$1], m4_cdr($2))])])
# m4_map_sep(MACRO, SEPARATOR, LIST)
@@ -408,8 +411,8 @@ m4_define([m4_map],
# are the elements of LIST (which can be lists themselves, for multiple
# arguments MACROs).
m4_define([m4_map_sep],
-[m4_ifval([$3],
- [$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])])
+[m4_if([$3], [[]], [],
+ [$1(m4_fst($3))[]_m4_map([$2[]$1], m4_cdr($3))])])
## ---------------------------------------- ##
- m4_map_sep bug (introduced by 2005-06-06 Autoconf patch) breaks Bison,
Paul Eggert <=