From 9052b52dfc69d9567e2e664b0f096bfae535bcad Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Fri, 10 May 2002 03:15:07 +0000 Subject: Fix Debian bug #144306: pass target-specific variables into the environment properly. Fix configure: allow cross-compilation; fix getloadavg (still needs _lots_ of work!) Let $(call ...) functions to be self-referencing. Lets us do transitive closures, for example. --- expand.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'expand.c') diff --git a/expand.c b/expand.c index e397cf4..e32e289 100644 --- a/expand.c +++ b/expand.c @@ -95,16 +95,28 @@ initialize_variable_output () static char *allocated_variable_append PARAMS ((const struct variable *v)); char * -recursively_expand (v) - register struct variable *v; +recursively_expand_for_file (v, file) + struct variable *v; + struct file *file; { char *value; + struct variable_set_list *save; if (v->expanding) - /* Expanding V causes infinite recursion. Lose. */ - fatal (reading_file, - _("Recursive variable `%s' references itself (eventually)"), - v->name); + { + if (!v->exp_count) + /* Expanding V causes infinite recursion. Lose. */ + fatal (reading_file, + _("Recursive variable `%s' references itself (eventually)"), + v->name); + --v->exp_count; + } + + if (file) + { + save = current_variable_set_list; + current_variable_set_list = file->variables; + } v->expanding = 1; if (v->append) @@ -113,22 +125,10 @@ recursively_expand (v) value = allocated_variable_expand (v->value); v->expanding = 0; - return value; -} + if (file) + current_variable_set_list = save; -/* Warn that NAME is an undefined variable. */ - -#ifdef __GNUC__ -__inline -#endif -static void -warn_undefined (name, length) - char *name; - unsigned int length; -{ - if (warn_undefined_variables_flag) - error (reading_file, - _("warning: undefined variable `%.*s'"), (int)length, name); + return value; } /* Expand a simple reference to variable NAME, which is LENGTH chars long. */ @@ -280,7 +280,7 @@ variable_expand_string (line, string, length) Is the resultant text a substitution reference? */ colon = lindex (beg, end, ':'); - if (colon != 0) + if (colon) { /* This looks like a substitution reference: $(FOO:A=B). */ char *subst_beg, *subst_end, *replace_beg, *replace_end; -- cgit v1.2.3