Fix Savannah bug #15913.

This commit is contained in:
Paul Smith 2006-03-15 03:31:30 +00:00
parent 6d8d9b74d9
commit 50eb3cf5e5
4 changed files with 37 additions and 9 deletions

View file

@ -1,3 +1,11 @@
2006-03-14 Paul D. Smith <psmith@gnu.org>
* expand.c (variable_append): Instead of appending everything then
expanding the result, we expand (or not, if it's simple) each part
as we add it.
(allocated_variable_append): Don't expand the final result.
Fixes Savannah bug #15913.
2006-03-09 Paul Smith <psmith@gnu.org>
* remake.c (update_file_1): Revert the change of 3 Jan 2006 which
@ -7,7 +15,7 @@
in the next release, to give them time to fix their build system.
Fixes Savannah bug #16002.
Introduces Savannah bug #16051.
* implicit.c (pattern_search) [DOS_PATHS]: Look for DOS paths if
we *don't* find UNIX "/".
Reported by David Ergo <david.ergo@alterface.com>

8
NEWS
View file

@ -17,6 +17,14 @@ Version 3.81rc2
the build_w32.bat batch file; see the file README.W32 for more
details.
* WARNING: Future backward-incompatibility!
Up to and including this release, the '$?' variable does not contain
any prerequisite that does not exist, even though that prerequisite
might have caused the target to rebuild. Starting with the _next_
release of GNU make, '$?' will contain all prerequisites that caused
the target to be considered out of date. See this Savannah bug:
http://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=16051
* WARNING: Backward-incompatibility!
GNU make now implements a generic "second expansion" feature on the
prerequisites of both explicit and implicit (pattern) rules. In order

View file

@ -501,14 +501,19 @@ variable_append (const char *name, unsigned int length,
if (buf > variable_buffer)
buf = variable_buffer_output (buf, " ", 1);
return variable_buffer_output (buf, v->value, strlen (v->value));
/* Either expand it or copy it, depending. */
if (! v->recursive)
return variable_buffer_output (buf, v->value, strlen (v->value));
buf = variable_expand_string (buf, v->value, strlen (v->value));
return (buf + strlen (buf));
}
static char *
allocated_variable_append (const struct variable *v)
{
char *val, *retval;
char *val;
/* Construct the appended variable value. */
@ -524,12 +529,7 @@ allocated_variable_append (const struct variable *v)
variable_buffer = obuf;
variable_buffer_length = olen;
/* Now expand it and return that. */
retval = allocated_variable_expand (val);
free (val);
return retval;
return val;
}
/* Like variable_expand_for_file, but the returned string is malloc'd.

View file

@ -292,4 +292,16 @@ rules.mk : MYVAR = foo
rmfiles('t1/rules.mk');
rmdir('t1');
# TEST #18
# Test appending to a simple variable containing a "$": avoid a
# double-expansion. See Savannah bug #15913.
run_make_test("
VAR := \$\$FOO
foo: VAR += BAR
foo: ; \@echo '\$(VAR)'",
'',
'$FOO BAR');
1;