autoconf-patches
[Top][All Lists]
Advanced

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

Re: FYI: loop in libtool m4 macros


From: Stepan Kasal
Subject: Re: FYI: loop in libtool m4 macros
Date: Mon, 27 Jun 2005 12:34:12 +0200
User-agent: Mutt/1.4.1i

Hi,

On Wed, Jun 22, 2005 at 06:45:35PM +0200, Ralf Wildenhues wrote:
> [ Unintentional private reply? ]

yes, sorry.  Thank you for citing it here.

> > m4_quote doesn't do what it should, as it uses [$*].
> > That means that all whitespace after commas is stripped.
> 
> Is this a bug in m4_quote?

Yes, it's a bug in m4_quote.  It cannot be fixed because of the design
of m4.  In the following example:

m4_define([foo], [, ])
...
m4_quote(foo)

m4_quote only knows that it has received two empty parameters; it cannot
find out that the original string was [, ].

But if you want to expand a macro _before_ you pass it as a parameter,
there is nothing better you can do.

My proposed code
> >     m4_ifval([$1], [[$1]], [[, ]])

didn't expand "$1" before passig it.  There are cases when the expansion
is not wanted in fact; but this is not true here.
I appologize.

The following code would work:
> >     m4_ifval([$1], [m4_quote($1)], [[, ]])

But I see no big advantage over the current code:

> > > |         m4_quote(m4_default([$1], [[, ]])

So you can let it be.

But:
There are two cases when the second argument to m4_default is not
double quoted; I think these should be fixed.

So I propose the following patch.

Stepan

Index: m4/ltsugar.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/ltsugar.m4,v
retrieving revision 1.5
diff -u -r1.5 ltsugar.m4
--- m4/ltsugar.m4       17 Jun 2005 12:42:34 -0000      1.5
+++ m4/ltsugar.m4       27 Jun 2005 10:23:09 -0000
@@ -52,12 +52,12 @@
 # has the form PREFIXmINFIXSUFFIXn.
 m4_define([lt_combine],
 [m4_if([$2], [], [],
-       [lt_join(m4_quote(m4_default([$1], [, ])),
+       [lt_join(m4_quote(m4_default([$1], [[, ]])),
                _$0([$1], lt_car($2)[$3], m4_shiftn(3, $@)),
                $0([$1], lt_cdr($2), m4_shiftn(2, $@)))])])
 m4_define([_lt_combine],
 [m4_if([$3], [], [],
-       [lt_join(m4_quote(m4_default([$1], [, ])),
+       [lt_join(m4_quote(m4_default([$1], [[, ]])),
                [$2$3],
                $0([$1], [$2], m4_shiftn(3, $@)))])[]dnl
 ])




reply via email to

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