make-w32
[Top][All Lists]
Advanced

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

Re: Allow SHELL to include variables and functions.


From: Paul Smith
Subject: Re: Allow SHELL to include variables and functions.
Date: Fri, 12 Oct 2007 21:24:41 -0400

On Fri, 2007-10-12 at 19:01 +0200, Eli Zaretskii wrote:
> > And if it's expanded right here then won't the automatic variables like
> > $@, $^, and $? not be set yet?
> 
> Yes.  That is why the modified patch below installs the original
> value, not the expanded one (as the original patch mistakenly did).

Ah!  That makes more sense to me.  Thanks!

> Btw, I wonder whether I should recursively_expand the value, not just
> expand it once, in case the first expansion still yields variables
> and/or functions.  WDYT?

All expansion in make is recursive; there's no such thing as an
expansion that just does "the first level".  It already does what you'd
expect, as far as I can see, just by using allocated_variable_expand().

> Oh, and I think there's no memory leak introduced by the patch,
> because do_variable_definition does this just before it returns:
> 
>   if (alloc_value)
>     free (alloc_value);

True, but before that happens you drop whatever memory alloc_value is
set to, here:

> +      else if (find_and_set_default_shell (alloc_value = 
> allocated_variable_expand (p)))

so that's the memory leak.  But, I fixed this and applied this patch;
let me know if I messed something up:

2007-10-12  Eli Zaretskii  <address@hidden>

        * variable.c (do_variable_definition): Allow $(SHELL) to expand to
        a more complex value than a simple shell: if it's not a default
        shell now then expand it and see if is a default shell then.

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

Attachment: var.c.diff
Description: Text Data


reply via email to

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