summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--NEWS8
-rw-r--r--expand.c16
-rw-r--r--tests/scripts/features/targetvars12
4 files changed, 37 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 04f4672..abe3b9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
diff --git a/NEWS b/NEWS
index ffaa0f3..b720e02 100644
--- a/NEWS
+++ b/NEWS
@@ -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
diff --git a/expand.c b/expand.c
index 5c7934e..993e6d4 100644
--- a/expand.c
+++ b/expand.c
@@ -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.
diff --git a/tests/scripts/features/targetvars b/tests/scripts/features/targetvars
index 18dd023..e2e9c90 100644
--- a/tests/scripts/features/targetvars
+++ b/tests/scripts/features/targetvars
@@ -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;