From bee7ac72e5cf6856c1dd94875eb3026aeedf702d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 14 Mar 2017 14:44:03 +0200 Subject: Preserve failed state even if recipe is overridden --- build2/target.ixx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'build2/target.ixx') 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 ()) + 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 ()) + { + if (*f == &noop_action) + state_ = target_state::unchanged; + } } } -- cgit v1.1