Fixed Savannah bugs #13216 and #13218.

This commit is contained in:
Boris Kolpackov 2005-05-31 20:54:30 +00:00
parent e50e0fdf88
commit af88a3550a
6 changed files with 74 additions and 2 deletions

View file

@ -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.

View file

@ -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;
}

10
job.c
View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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;