Fixed Savannah bug #12266.
authorBoris Kolpackov <boris@kolpackov.net>
Wed, 9 Mar 2005 19:21:34 +0000 (19:21 +0000)
committerBoris Kolpackov <boris@kolpackov.net>
Wed, 9 Mar 2005 19:21:34 +0000 (19:21 +0000)
ChangeLog
main.c
read.c
tests/ChangeLog
tests/scripts/variables/DEFAULT_TARGET

index 8d7dcbbbb9924dad4f93b67aa911b1b02f8d02c2..58b650c579e94cecd5f22144239d11e0083773d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-03-09  Boris Kolpackov  <boris@kolpackov.net>
+
+       * main.c (main): Use o_file instead of o_default when defining
+       the .DEFAULT_TARGET special variable.
+
+       * read.c (eval): Use define_variable_global() instead of
+       define_variable() when setting new value for the .DEFAULT_TARGET
+       special variable. Fixes Savannah bug #12266.
+
 2005-03-04  Boris Kolpackov  <boris@kolpackov.net>
 
        * imlicit.c (pattern_search): Mark files for which an implicit
diff --git a/main.c b/main.c
index c20be9b04dd398f9ff3f4b703e021d3c1651dee1..750ded3b330f41b6a403193a8dc7ba936fc80c1c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1553,7 +1553,7 @@ main (int argc, char **argv, char **envp)
 
   {
     struct variable *v = define_variable (
-      ".DEFAULT_TARGET", 15, "", o_default, 0);
+      ".DEFAULT_TARGET", 15, "", o_file, 0);
 
     default_target_name = &v->value;
   }
diff --git a/read.c b/read.c
index c7ff6c680ba8ba7af64261f680151028184dffc8..772ef8c1e9700e711b37eb7c12b92b6e63e57992 100644 (file)
--- a/read.c
+++ b/read.c
@@ -1262,8 +1262,8 @@ eval (struct ebuffer *ebuf, int set_default)
 
                 if (!reject)
                   {
-                    (void) define_variable (
-                      ".DEFAULT_TARGET", 15, t->name, o_file, 0);
+                    (void) define_variable_global (
+                      ".DEFAULT_TARGET", 15, t->name, o_file, 0, NILF);
                     break;
                   }
               }
index ce8f460c18dee375281b56510c61b9744574df39..7fa8f867ae7fb8bf8d29d9e568275b09b9d2f89e 100644 (file)
@@ -1,6 +1,11 @@
+2005-03-09  Boris Kolpackov  <boris@kolpackov.net>
+
+       * scripts/variables/DEFAULT_TARGET: Add a test for Savannah
+       bug #12266.
+
 2005-03-04  Boris Kolpackov  <boris@kolpackov.net>
 
-       * features/patternrules: Add a test fo Savannah bug #12202.
+       * scripts/features/patternrules: Add a test for Savannah bug #12202.
 
 2005-03-03  Boris Kolpackov  <boris@kolpackov.net>
 
index 76b2a23d5faf694f1c34ea10c6582d13b5c44852..d8f117390c6b42973bda20bc02e7233a7b2db08a 100644 (file)
@@ -3,6 +3,7 @@ $description = "Test the .DEFAULT_TARGET special variable.";
 
 $details = "";
 
+
 # Test #1: basic logic.
 #
 run_make_test('
@@ -45,7 +46,7 @@ run_make_test('
 512);
 
 
-# Test #2: more than one target.
+# Test #3: more than one target.
 #
 run_make_test('
 .DEFAULT_TARGET := foo bar
@@ -55,5 +56,23 @@ run_make_test('
 512);
 
 
+# Test #4: Savannah bug #12226.
+#
+run_make_test('
+define rule
+foo: ; @echo $$@
+endef
+
+define make-rule
+$(eval $(rule))
+endef
+
+$(call make-rule)
+
+',
+'',
+'foo');
+
+
 # This tells the test driver that the perl test script executed properly.
 1;