help-make
[Top][All Lists]
Advanced

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

Re: Bug in $(call ...) ?


From: Boris Kolpackov
Subject: Re: Bug in $(call ...) ?
Date: Mon, 20 Dec 2004 17:47:56 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Alexey Neyman <address@hidden> writes:

> X = echo
> A = $($(1)) $$(1) $$(2)
>
> B := $(call A,X)
>
> C = echo $(1) $(2)
>
> all:
>         @echo '[$(call B,hi,lo)]'
>         @echo '[$(call C,hi,lo)]'

It appears that non-recursive variables don't work well with $(call ).
If you look around function.c:func_call() you will see that at the end
func_call() delegates all the work to expand.c:variable_expand_string()
which has the following code around line 312 (cvs head):

char *value = (v->recursive
               ? recursively_expand (v)
               : v->value);

In other words for non-recursive variables variable_expand_string()
just copies the value without expanding it.

Note than changing

B := $(call A,X)

to

B = $(call A,X)

won't work because now if you insert

$(warning $(value B))

you will see "$(call A,X)", not "echo $(1) $(2)".

A fix could be to just make variables temporarily-recursive in the
context of $(call ) and restore the original mode after $(call ) is
completed. Of course, the following will be possible then

a = $$b

b := $(call a)

c := $(call b)

Not that it is not possible with recursive variables now (segfaults
on cvs head):

b = $b

$(warning $(call b))

Paul, any thoughts?


thanks,
-boris





reply via email to

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