From 9fa5209175dffb881e8ec6c5f6ad4fc54448244a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 13 Aug 2015 14:48:41 +0200 Subject: Rework postponed logic Specifically, now postponed is only used by the execution mode logic and rules should not return it directly. --- build/operation.cxx | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'build/operation.cxx') diff --git a/build/operation.cxx b/build/operation.cxx index 9bfa8d2..694ad1c 100644 --- a/build/operation.cxx +++ b/build/operation.cxx @@ -114,12 +114,11 @@ namespace build { tracer trace ("execute"); - // Build collecting postponed targets (to be re-examined later). + // Execute collecting postponed targets (to be re-examined later). + // Do it in reverse order if the execution mode is 'last'. // vector> psp; - // Execute targets in reverse if the execution mode is 'last'. - // auto body ( [a, &psp, &trace] (void* v) { @@ -129,11 +128,6 @@ namespace build switch (execute (a, t)) { - case target_state::postponed: - { - psp.push_back (t); - break; - } case target_state::unchanged: { // Be quiet in pre/post operations. @@ -142,6 +136,9 @@ namespace build info << diag_done (a, t); break; } + case target_state::postponed: + psp.push_back (t); + break; case target_state::changed: break; case target_state::failed: @@ -156,32 +153,27 @@ namespace build else for (void* v: reverse_iterate (ts)) body (v); - // Re-examine postponed targets. Note that we will do it in the - // order added, so no need to check the execution mode. + // We should have executed every target that we matched. + // + assert (dependency_count == 0); + + // Re-examine postponed targets. This is the only reliable way to + // find out whether the target has changed. // for (target& t: psp) { - if (t.state () == target_state::postponed) - execute (a, t); // Re-examine the state. - - switch (t.state ()) + switch (execute (a, t)) { - case target_state::postponed: - { - info << "unable to " << diag_do (a, t) << " at this time"; - break; - } case target_state::unchanged: { - // Be quiet in pre/post operations. - // if (a.outer_operation () == 0) info << diag_done (a, t); break; } - case target_state::unknown: // Assume something was done to it. case target_state::changed: break; + case target_state::postponed: + assert (false); case target_state::failed: //@@ This could probably happen in a parallel build. default: -- cgit v1.1