[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: toolchain/46750: make oddity expanding variables assigned to with +=
The following reply was made to PR toolchain/46750; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
Subject: Re: toolchain/46750: make oddity expanding variables assigned to
Date: Mon, 30 Jul 2012 07:30:21 +0000
On Sun, Jul 29, 2012 at 02:25:02PM +0000, Edgar Fu? wrote:
> > This is the way make works.
> Then either the first element (e.g. :) should be empty or start with =
> a space.
: gives the first word; since words are delimited by whitespace,
any leading whitespace is not part of the first word.
> You currently get different results from
> - asking for the whole value, which should be a space-separated list =
> (you get " foo bar")
> - asking explicitly for a space-separated list (you get "foo bar")
> - asking for the individual elements and space-joining them (you get =
> "foo bar")
> > Whitespace after =3D (or :=3D) can be removed, but whitespace
> > after +=3D must be kept - otherwise you can't build strings.
> The manpage says (for all variants of assignments):
> Any white-space before the assigned value is removed=
What it's doing is inserting a space between the old value of the
variable and the appended material. This is what it's supposed to do;
otherwise, if you did
you'd get "barbaz" instead of "bar baz".
The problem is that it's doing this even if the old value is the empty
string, so you get a leading space. Relatedly, if you do
which is also wrong.
David A. Holland
Main Index |
Thread Index |