aboutsummaryrefslogtreecommitdiff
path: root/build2/target.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-14 14:44:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-14 14:44:03 +0200
commitbee7ac72e5cf6856c1dd94875eb3026aeedf702d (patch)
tree9415eb7e9afd860032c1e3e0d1488d291ed7290a /build2/target.ixx
parent0275a8661dce5b89960d2baf6245bf08679fb596 (diff)
Preserve failed state even if recipe is overridden
Diffstat (limited to 'build2/target.ixx')
-rw-r--r--build2/target.ixx21
1 files changed, 14 insertions, 7 deletions
diff --git a/build2/target.ixx b/build2/target.ixx
index 0be5aed..eb7dbaa 100644
--- a/build2/target.ixx
+++ b/build2/target.ixx
@@ -129,15 +129,22 @@ namespace build2
{
recipe_ = move (r);
- // If this is a noop recipe, then mark the target unchanged to allow for
- // some optimizations.
+ // Do not clear the failed target state in case of an override (and we
+ // should never see the failed state from the previous operation since we
+ // should abort the execution in this case).
//
- state_ = target_state::unknown;
-
- if (recipe_function** f = recipe_.target<recipe_function*> ())
+ if (state_ != target_state::failed)
{
- if (*f == &noop_action)
- state_ = target_state::unchanged;
+ // If this is a noop recipe, then mark the target unchanged to allow for
+ // some optimizations.
+ //
+ state_ = target_state::unknown;
+
+ if (recipe_function** f = recipe_.target<recipe_function*> ())
+ {
+ if (*f == &noop_action)
+ state_ = target_state::unchanged;
+ }
}
}