summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--implicit.c14
-rw-r--r--job.c10
-rw-r--r--tests/ChangeLog5
-rw-r--r--tests/scripts/features/include18
-rw-r--r--tests/scripts/features/patternrules20
6 files changed, 74 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5bd7bea..318cbd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-05-31 Boris Kolpackov <boris@kolpackov.net>
+
+ * job.c (reap_children): Don't die of the command failed but
+ the dontcare flag is set. Fixes Savannah bug #13216.
+
+ * implicit.c (pattern_search): When creating a target from
+ an implicit rule match, lookup pattern target and set precious
+ flag in a newly created target. Fixes Savannah bug #13218.
+
2005-05-13 Paul D. Smith <psmith@gnu.org>
Implement "if... else if... endif" syntax.
diff --git a/implicit.c b/implicit.c
index 67f0559..cae4c40 100644
--- a/implicit.c
+++ b/implicit.c
@@ -899,6 +899,13 @@ pattern_search (struct file *file, int archive,
file->cmds = rule->cmds;
file->is_target = 1;
+ /* Set precious flag. */
+ {
+ struct file *f = lookup_file (rule->targets[matches[foundrule]]);
+ if (f && f->precious)
+ file->precious = 1;
+ }
+
/* If this rule builds other targets, too, put the others into FILE's
`also_make' member. */
@@ -906,6 +913,7 @@ pattern_search (struct file *file, int archive,
for (i = 0; rule->targets[i] != 0; ++i)
if (i != matches[foundrule])
{
+ struct file *f;
struct dep *new = (struct dep *) xmalloc (sizeof (struct dep));
/* GKM FIMXE: handle '|' here too */
new->ignore_mtime = 0;
@@ -920,6 +928,12 @@ pattern_search (struct file *file, int archive,
rule->lens[i] - (rule->suffixes[i] - rule->targets[i]) + 1);
new->file = enter_file (new->name);
new->next = file->also_make;
+
+ /* Set precious flag. */
+ f = lookup_file (rule->targets[i]);
+ if (f && f->precious)
+ new->file->precious = 1;
+
file->also_make = new;
}
diff --git a/job.c b/job.c
index fbd78a0..8349445 100644
--- a/job.c
+++ b/job.c
@@ -470,6 +470,7 @@ reap_children (int block, int err)
register struct child *lastc, *c;
int child_failed;
int any_remote, any_local;
+ int dontcare;
if (err && block)
{
@@ -686,12 +687,17 @@ reap_children (int block, int err)
if (c->good_stdin)
good_stdin_used = 0;
+ dontcare = c->file->dontcare;
+
if (child_failed && !c->noerror && !ignore_errors_flag)
{
/* The commands failed. Write an error message,
delete non-precious targets, and abort. */
static int delete_on_error = -1;
- child_error (c->file->name, exit_code, exit_sig, coredump, 0);
+
+ if (!dontcare)
+ child_error (c->file->name, exit_code, exit_sig, coredump, 0);
+
c->file->update_status = 2;
if (delete_on_error == -1)
{
@@ -791,7 +797,7 @@ reap_children (int block, int err)
/* If the job failed, and the -k flag was not given, die,
unless we are already in the process of dying. */
- if (!err && child_failed && !keep_going_flag &&
+ if (!err && child_failed && !dontcare && !keep_going_flag &&
/* fatal_error_signal will die with the right signal. */
!handling_fatal_signal)
die (2);
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 914a67f..b33269c 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-31 Boris Kolpackov <boris@kolpackov.net>
+
+ * scripts/features/include: Add a test for Savannah bug #13216.
+ * scripts/features/patternrules: Add a test for Savannah bug #13218.
+
2005-05-13 Paul D. Smith <psmith@gnu.org>
* scripts/features/conditionals: Add tests for the new if... else
diff --git a/tests/scripts/features/include b/tests/scripts/features/include
index f48cbd3..26ee1bd 100644
--- a/tests/scripts/features/include
+++ b/tests/scripts/features/include
@@ -78,6 +78,7 @@ hello: ; @echo hello
"hello\n"
);
+
# Test inheritance of dontcare flag when rebuilding makefiles.
#
run_make_test('
@@ -90,3 +91,20 @@ foo: bar; @:
', '', '');
1;
+
+
+# Make sure that we don't die when the command fails but we dontcare.
+# (Savannah bug #13216).
+#
+run_make_test('
+.PHONY: all
+all:; @:
+
+-include foo
+
+foo: bar; @:
+
+bar:; @false
+', '', '');
+
+1;
diff --git a/tests/scripts/features/patternrules b/tests/scripts/features/patternrules
index ee29c4e..0e2f281 100644
--- a/tests/scripts/features/patternrules
+++ b/tests/scripts/features/patternrules
@@ -95,5 +95,25 @@ $dir/foo.o");
unlink("$dir/foo.c");
+
+# TEST #4: make sure precious flag is set properly for targets
+# that are built via implicit rules (Savannah bug #13218).
+#
+run_make_test('
+.DELETE_ON_ERROR:
+
+.PRECIOUS: %.bar
+
+%.bar:; @touch $@ && false
+
+$(dir)/foo.bar:
+
+',
+"dir=$dir",
+"make: *** [$dir/foo.bar] Error 1",
+512);
+
+unlink("$dir/foo.bar");
+
# This tells the test driver that the perl test script executed properly.
1;