Fixed Savannah bug #13881.
authorBoris Kolpackov <boris@kolpackov.net>
Wed, 10 Aug 2005 10:21:13 +0000 (10:21 +0000)
committerBoris Kolpackov <boris@kolpackov.net>
Wed, 10 Aug 2005 10:21:13 +0000 (10:21 +0000)
ChangeLog
read.c
tests/ChangeLog
tests/scripts/features/statipattrules

index 4d2c55be880f144c141f8b40fc87e4582ad4ba7c..8ce5e999c254bb8c4e3a936fa554d5d33de13df0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-10  Boris Kolpackov  <boris@kolpackov.net>
+
+       * read.c (record_files): Move code that sets stem for static
+       pattern rules out of the if (!two_colon) condition so it is
+       also executed for two-colon rules. Fixes Savannah bug #13881.
+
 2005-08-07  Paul D. Smith  <psmith@gnu.org>
 
        * w32/pathstuff.c (getcwd_fs): Fix warning about assignment in a
diff --git a/read.c b/read.c
index 65a352ff833b4b274e2cd07adbf700d246284282..0f07ee91c0af9c6dfe001a014e0048b88c3de9e6 100644 (file)
--- a/read.c
+++ b/read.c
@@ -2106,18 +2106,6 @@ record_files (struct nameseq *filenames, char *pattern, char *pattern_percent,
               if (cmds != 0)
                 f->updating = 1;
            }
-
-         /* If this is a static pattern rule, set the file's stem to
-            the part of its name that matched the `%' in the pattern,
-            so you can use $* in the commands.  */
-         if (pattern != 0)
-           {
-             static char *percent = "%";
-             char *buffer = variable_expand ("");
-             char *o = patsubst_expand (buffer, name, pattern, percent,
-                                        pattern_percent+1, percent+1);
-             f->stem = savestring (buffer, o - buffer);
-           }
        }
       else
        {
@@ -2143,6 +2131,18 @@ record_files (struct nameseq *filenames, char *pattern, char *pattern_percent,
          f->cmds = cmds;
        }
 
+      /* If this is a static pattern rule, set the file's stem to
+         the part of its name that matched the `%' in the pattern,
+         so you can use $* in the commands.  */
+      if (pattern != 0)
+        {
+          static char *percent = "%";
+          char *buffer = variable_expand ("");
+          char *o = patsubst_expand (buffer, name, pattern, percent,
+                                     pattern_percent+1, percent+1);
+          f->stem = savestring (buffer, o - buffer);
+        }
+
       /* Free name if not needed further.  */
       if (f != 0 && name != f->name
          && (name < f->name || name > f->name + strlen (f->name)))
index a2050745082547b60f7e5f1d05366c072761bdd2..cb3edebcad333b3193c6d9db8e6f4bec57276bfb 100644 (file)
@@ -1,3 +1,7 @@
+2005-08-10  Boris Kolpackov  <boris@kolpackov.net>
+
+       * scripts/features/statipattrules: Add a test for Savannah bug #13881.
+
 2005-08-07  Paul D. Smith  <psmith@gnu.org>
 
        * scripts/features/parallelism: Add a test for a bug reported by
index b5459b9e64a5b9e6cae5d02dbcd5b3fcb6ca3fa8..0ca2bb7b673fdb5469b3b63d8a613832b67eb000 100644 (file)
@@ -73,4 +73,15 @@ foo.x bar.x: %.x : ; @echo $@
 'foo.x
 ');
 
+
+# TEST #6 -- bug #13881: double colon static pattern rule does not
+#                        substitute %.
+#
+run_make_test('
+foo.bar:: %.bar: %.baz
+foo.baz: ;@:
+',
+'',
+'');
+
 1;