diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-13 14:48:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-13 14:48:41 +0200 |
commit | 9fa5209175dffb881e8ec6c5f6ad4fc54448244a (patch) | |
tree | b937763e9605832f9cac87b846a2996c8727af12 /build/operation.cxx | |
parent | 467d700c66582471013a07384318d0142d2f3de2 (diff) |
Rework postponed logic
Specifically, now postponed is only used by the execution mode logic
and rules should not return it directly.
Diffstat (limited to 'build/operation.cxx')
-rw-r--r-- | build/operation.cxx | 36 |
1 files changed, 14 insertions, 22 deletions
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<reference_wrapper<target>> 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: |