diff options
author | Boris Kolpackov <boris@kolpackov.net> | 2005-05-31 20:54:30 +0000 |
---|---|---|
committer | Boris Kolpackov <boris@kolpackov.net> | 2005-05-31 20:54:30 +0000 |
commit | af88a3550a6202361aa9eab7e59d83b0bf2c1610 (patch) | |
tree | fdcc9f84496083cac0fa2a852c56e9409c50be56 | |
parent | e50e0fdf8856fada821393af3dbd268db09c3b47 (diff) | |
download | gunmake-af88a3550a6202361aa9eab7e59d83b0bf2c1610.tar.gz |
Fixed Savannah bugs #13216 and #13218.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | implicit.c | 14 | ||||
-rw-r--r-- | job.c | 10 | ||||
-rw-r--r-- | tests/ChangeLog | 5 | ||||
-rw-r--r-- | tests/scripts/features/include | 18 | ||||
-rw-r--r-- | tests/scripts/features/patternrules | 20 |
6 files changed, 74 insertions, 2 deletions
@@ -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. @@ -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; } @@ -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; |