NetBSD-Bugs archive

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

Re: bin/43821: make: longstanding bug with loop variables



The following reply was made to PR bin/43821; it has been noted by GNATS.

From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/43821: make: longstanding bug with loop variables
Date: Wed, 1 Sep 2010 10:53:01 +0100

 On Tue, Aug 31, 2010 at 12:20:01PM +0000, cheusov%tut.by@localhost wrote:
 > >Number:         43821
 > >Category:       bin
 > >Synopsis:       make: oldstanding bug with loop variables
 ...
 > >Description:
 > 
 >     .for i in 1 2
 >     .if empty(i:M2)
 >     res=passed
 >     .endif
 >     .endfor
 ...
 
 The 'problem' is that the code that substitutes the loop variables
 into the loop body before the body is parsed (yes it does work that way)
 doesn't identify empty(...) as equivalent to $(...) and modify the text.
 
 Since empty() is just a comparison against "" there is a trivial
 work around.
 
 A better fix is to rework the .for handling (again) so that the loop
 control variables are put into the main symbol table for the first
 pass processing, and the textual substitution done when lines are saved.
 eg for variable assignments (except :=) and shell commands.
 
 If that were done then all the . directives would work identically
 on loop variables.
 
        David
 
 -- 
 David Laight: david%l8s.co.uk@localhost
 


Home | Main Index | Thread Index | Old Index