[Top][All Lists]

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

Re: Recursive $(call)

From: Paul D. Smith
Subject: Re: Recursive $(call)
Date: Sun, 28 Apr 2002 00:48:26 -0400

%% Philip Guenther <address@hidden> writes:

  pg> Unfortunately, the restriction on recursive macros not referencing
  pg> themselves includes references via $(call).  I would argue that
  pg> GNU make should not try to protect someone from themself if the
  pg> write a recursive $(call).  Yes, you can trivially write infinite
  pg> loops if it's allowed, but the increase in expressiveness is
  pg> substantial.

  >> OK, I buy this argument.  As a test I removed the restriction on
  >> recursive variable definitions and (with the above fix) your example
  >> did work as you intended.  Neat.

  >> However, I think the restriction is valid for normal variable
  >> expansions, and most if not all builtin functions.  Are there any
  >> other builtins you think would benefit from loosening this
  >> restriction?

  pg> The only other one which could legitimately benefit would be $(foreach),

I made a change for $(call ...) which allows the function variable
(only) to be recursively expanded a large number of times before it
decides the recursion is infinite, and only when used as the
user-defined function in a $(call ...) function.  It will be in the next

However, when I went to look at foreach, doing the same there was very
difficult (with $(call ...) you want to just special-case the
user-defined function variable, which must be a single variable; with
$(foreach ...) you want to special-case the body of the loop, which may
be very complex and consist of a number of variables).

So, I'm going to leave it as just $(call ...) allowing this.


 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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