bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] b4_args is more general than only C++.


From: Eric Blake
Subject: Re: [PATCH] b4_args is more general than only C++.
Date: Tue, 25 Nov 2008 14:42:11 -0800 (PST)

> +2008-11-25  Akim Demaille  <address@hidden>
> +
> +     b4_args is more general than only C++.
> +     * data/lalr1.cc (b4_args, _b4_args): Move to...
> +     * data/bison.m4: here.

> +m4_define([b4_args],
> +[m4_if([$#$1],
> +       [1], [],
> +       [m4_ifval([$1],
> +                 [$1[]_$0(m4_shift($@))],
> +                 [$0(m4_shift($@))])])])

This implementation is quadratic on M4 1.4.x.  Wouldn't you rather
use a linear implementation?  Recently, there has been a lot of
churn in autoconf.git's copy of m4sugar making it even faster;
it is probably time for me to post a resync patch again.  But one
of those improvements is the addition of m4_map_args_sep; the
following is a linear implementation (with less text, to boot):

m4_define([b4_args],
[m4_shift(m4_map_args_sep([_$0(], [)], [], $@))])

m4_define([_b4_args], [m4_ifval([$1], [, $1])])

-- 
Eric Blake

-- 
View this message in context: 
http://www.nabble.com/-PATCH--b4_args-is-more-general-than-only-C%2B%2B.-tp20689659p20691102.html
Sent from the Gnu - Bison - Patches mailing list archive at Nabble.com.





reply via email to

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