bug-make
[Top][All Lists]
Advanced

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

Re: [PATCH] pattern-specific variable expansion


From: Boris Kolpackov
Subject: Re: [PATCH] pattern-specific variable expansion
Date: Mon, 19 Apr 2004 17:59:20 -0500
User-agent: Mutt/1.5.4i

Paul D. Smith <address@hidden> writes:
  
>   bk> In contrast the patch fixes the following case:
> 
>   bk> a := A
> 
>   bk> %bar : a_ := $a
> 
>   bk> %bar :; @echo $(a_) 
> 
>   bk> a := B
> 
>   bk> foobar:
> 
>   bk> Which prints (without patch) B.
> 
> I want to point out that I think we already discussed this before on the
> list.  Changing this behavior leads to undesirable behavior in other
> situations.  I think it was related to += in a target-specific variable
> not having the expected semantics.  I think there's even a bug about
> this in Savannah already.

Yeah, I thought so too at the beginning. I had to read that bug report 
about 10 times to understand what's going on there ;-(. My conclusion
is that things that are discussed in that bug report and my patch are
unrelated. To prove it I even ran makefile fragment from your comment
and it prints the "right thing".

 
> IIRC, there is no one behavior in this situation that works "as
> expected" in every case.

Well, for that bug report - perhaps. My case is a bit different. It
all boils down to the point where pattern-specific variable expansion
happens. For example 

b := B

%bar : a := $b  #1

b := A

foobar:         #2

Without the patch real assignment happens at point 2 (it's really funny
to put $(warning) in rhs of pattern-specific variable assignment; learn
a lot of new things about make ;-)).

While this could have it's own reasons (I don't know of any, do you ?)
this makes it impossible to associate any value at pattern definition.


Proposed patch changes this behavior (for simple variables only) to 
expand at point 1. While this change is not backward compatible it
allows both behaviors:


b := B

%bar : a := $b $$b

b := A

foobar:        
  
Now $a will be "A B".


> I'm assuming all the regression tests still pass with your patch
> applied?  I can't remember whether I added a test for this situation or
> not.

Yes, all tests pass.


thanks,
-boris

Attachment: signature.asc
Description: Digital signature


reply via email to

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