From bee90675a701d7267caba40921b4606db5072247 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Apr 2022 09:33:50 +0200 Subject: Rename {match,execute}() to *_sync(), add *_complete() In particular, the match() rename makes sure it doesn't clash with rule::match() which, after removal of the hint argument in simple_rule, has exactly the same signature, thus making it error-prone to calling recursively. --- build2/cli/rule.cxx | 2 +- libbuild2/adhoc-rule-buildscript.cxx | 6 +-- libbuild2/adhoc-rule-cxx.cxx | 4 +- libbuild2/algorithm.cxx | 94 ++++++++++++++---------------------- libbuild2/algorithm.hxx | 85 ++++++++++++++++++-------------- libbuild2/algorithm.ixx | 71 +++++++++++++++++++-------- libbuild2/cc/compile-rule.cxx | 2 +- libbuild2/cc/link-rule.cxx | 2 +- libbuild2/config/operation.cxx | 2 +- libbuild2/dist/rule.cxx | 2 +- libbuild2/dyndep.cxx | 10 ++-- libbuild2/install/rule.cxx | 10 ++-- libbuild2/operation.cxx | 5 +- libbuild2/target.hxx | 4 +- 14 files changed, 161 insertions(+), 138 deletions(-) diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx index a11380e..364c90b 100644 --- a/build2/cli/rule.cxx +++ b/build2/cli/rule.cxx @@ -183,7 +183,7 @@ namespace build2 else { const cli_cxx& g (xt.group->as ()); - build2::match (a, g); + match_sync (a, g); return group_recipe; // Execute the group's recipe. } } diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx index 77c0823..78891b9 100644 --- a/libbuild2/adhoc-rule-buildscript.cxx +++ b/libbuild2/adhoc-rule-buildscript.cxx @@ -424,7 +424,7 @@ namespace build2 // unmatch um ((pt.include & 4) != 0 ? unmatch::safe : unmatch::none); - pair mr (build2::match (a, *pt.target, um)); + pair mr (match_complete (a, *pt.target, um)); if (um != unmatch::none) { @@ -1370,7 +1370,6 @@ namespace build2 // This is essentially a customized execute_prerequisites(a, t, mt). // size_t busy (ctx.count_busy ()); - size_t exec (ctx.count_executed ()); target_state rs (target_state::unchanged); @@ -1398,11 +1397,10 @@ namespace build2 (p.target != nullptr ? p.target : p.adhoc () ? reinterpret_cast (p.data) : nullptr)) { - ctx.sched.wait (exec, (*pt)[a].task_count, scheduler::work_none); + target_state s (execute_complete (a, *pt)); if (p.data == 0) { - target_state s (pt->executed_state (a)); rs |= s; // Compare our timestamp to this prerequisite's skipping diff --git a/libbuild2/adhoc-rule-cxx.cxx b/libbuild2/adhoc-rule-cxx.cxx index 72387c1..dc795df 100644 --- a/libbuild2/adhoc-rule-cxx.cxx +++ b/libbuild2/adhoc-rule-cxx.cxx @@ -605,10 +605,10 @@ namespace build2 l = find_target (); phase_switch mp (ctx, run_phase::match); - if (build2::match (perform_update_id, *l) != target_state::unchanged) + if (match_sync (perform_update_id, *l) != target_state::unchanged) { phase_switch ep (ctx, run_phase::execute); - execute (a, *l); + execute_sync (a, *l); } } else diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index 61ab92c..9e4d77a 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -751,7 +751,7 @@ namespace build2 dr << info << "while matching group rule to " << diag_do (a, t); }); - pair r (match (a, g, 0, nullptr, try_match)); + pair r (match_impl (a, g, 0, nullptr, try_match)); if (r.first) { @@ -843,11 +843,11 @@ namespace build2 // the first half of the result. // pair - match (action a, - const target& ct, - size_t start_count, - atomic_count* task_count, - bool try_match) + match_impl (action a, + const target& ct, + size_t start_count, + atomic_count* task_count, + bool try_match) { // If we are blocking then work our own queue one task at a time. The // logic here is that we may have already queued other tasks before this @@ -997,15 +997,15 @@ namespace build2 { // Execute (unlocked). // - // Note that we use execute_direct() rather than execute() here to - // sidestep the dependents count logic. In this context, this is by - // definition the first attempt to execute this rule (otherwise we - // would have already known the members list) and we really do need + // Note that we use execute_direct_sync() rather than execute_sync() + // here to sidestep the dependents count logic. In this context, this + // is by definition the first attempt to execute this rule (otherwise + // we would have already known the members list) and we really do need // to execute it now. // { phase_switch ps (g.ctx, run_phase::execute); - execute_direct (a, g); + execute_direct_sync (a, g); } r = g.group_members (a); @@ -1099,7 +1099,7 @@ namespace build2 for (size_t n (pts.size ()); i != n; ++i) { const target& pt (*pts[i]); - match (a, pt); + match_complete (a, pt); } } @@ -1149,7 +1149,7 @@ namespace build2 if (m == nullptr || marked (m)) continue; - match (a, *m); + match_complete (a, *m); } } @@ -1217,7 +1217,7 @@ namespace build2 // Make it ad hoc so that it doesn't end up in prerequisite_targets // after execution. // - match (a, *r); + match_sync (a, *r); t.prerequisite_targets[a].emplace_back (r, include_type::adhoc); } @@ -1903,10 +1903,10 @@ namespace build2 } target_state - execute (action a, - const target& ct, - size_t start_count, - atomic_count* task_count) + execute_impl (action a, + const target& ct, + size_t start_count, + atomic_count* task_count) { target& t (const_cast (ct)); // MT-aware. target::opstate& s (t[a]); @@ -2002,17 +2002,17 @@ namespace build2 } target_state - execute_direct (action a, - const target& ct, - size_t start_count, - atomic_count* task_count) + execute_direct_impl (action a, + const target& ct, + size_t start_count, + atomic_count* task_count) { context& ctx (ct.ctx); target& t (const_cast (ct)); // MT-aware. target::opstate& s (t[a]); - // Similar logic to execute() above. + // Similar logic to execute_impl() above. // size_t tc (ctx.count_applied ()); @@ -2078,8 +2078,8 @@ namespace build2 // date (and which is where it originated). // // There would normally be a lot of headers for every source file (think - // all the system headers) and just calling execute_direct() on all of - // them can get expensive. At the same time, most of these headers are + // all the system headers) and just calling execute_direct_sync() on all + // of them can get expensive. At the same time, most of these headers are // existing files that we will never be updating (again, system headers, // for example) and the rule that will match them is the fallback // file_rule. That rule has an optimization: it returns noop_recipe (which @@ -2117,7 +2117,7 @@ namespace build2 // any generated header. // phase_switch ps (t.ctx, run_phase::execute); - target_state ns (execute_direct (a, t)); + target_state ns (execute_direct_sync (a, t)); if (ns != os && ns != target_state::unchanged) { @@ -2188,7 +2188,7 @@ namespace build2 const target& pt (*p.target); target_state os (static_cast (p.data)); - target_state ns (execute_direct (a, pt)); + target_state ns (execute_direct_sync (a, pt)); if (ns != os && ns != target_state::unchanged) { @@ -2213,7 +2213,6 @@ namespace build2 atomic_count& tc (t[a].task_count); size_t busy (ctx.count_busy ()); - size_t exec (ctx.count_executed ()); wait_guard wg (ctx, busy, tc); @@ -2234,13 +2233,8 @@ namespace build2 if ((p.include & mask) != 0 && p.data != 0) { const target& pt (*p.target); - - // If the target is still busy, wait for its completion. - // - ctx.sched.wait (exec, pt[a].task_count, scheduler::work_none); - + target_state ns (execute_complete (a, pt)); target_state os (static_cast (p.data)); - target_state ns (pt.executed_state (a)); if (ns != os && ns != target_state::unchanged) { @@ -2278,7 +2272,6 @@ namespace build2 target_state r (target_state::unchanged); size_t busy (ctx.count_busy ()); - size_t exec (ctx.count_executed ()); // Start asynchronous execution of prerequisites. // @@ -2313,12 +2306,7 @@ namespace build2 continue; const target& mt (*ts[i]); - - // If the target is still busy, wait for its completion. - // - ctx.sched.wait (exec, mt[a].task_count, scheduler::work_none); - - r |= mt.executed_state (a); + r |= execute_complete (a, mt); blank_adhoc_member (ts[i]); } @@ -2336,7 +2324,6 @@ namespace build2 target_state r (target_state::unchanged); size_t busy (ctx.count_busy ()); - size_t exec (ctx.count_executed ()); wait_guard wg (ctx, busy, tc); @@ -2365,10 +2352,7 @@ namespace build2 continue; const target& mt (*ts[i]); - - ctx.sched.wait (exec, mt[a].task_count, scheduler::work_none); - - r |= mt.executed_state (a); + r |= execute_complete (a, mt); blank_adhoc_member (ts[i]); } @@ -2405,7 +2389,6 @@ namespace build2 context& ctx (t.ctx); size_t busy (ctx.count_busy ()); - size_t exec (ctx.count_executed ()); auto& pts (t.prerequisite_targets[a]); @@ -2447,10 +2430,7 @@ namespace build2 continue; const target& pt (*p.target); - - ctx.sched.wait (exec, pt[a].task_count, scheduler::work_none); - - target_state s (pt.executed_state (a)); + target_state s (execute_complete (a, pt)); rs |= s; // Should we compare the timestamp to this target's? @@ -2499,7 +2479,6 @@ namespace build2 context& ctx (t.ctx); size_t busy (ctx.count_busy ()); - size_t exec (ctx.count_executed ()); auto& pts (t.prerequisite_targets[a]); @@ -2541,10 +2520,7 @@ namespace build2 continue; const target& pt (*p.target); - - ctx.sched.wait (exec, pt[a].task_count, scheduler::work_none); - - target_state s (pt.executed_state (a)); + target_state s (execute_complete (a, pt)); rs |= s; // Should we compare the timestamp to this target's? @@ -2601,10 +2577,10 @@ namespace build2 // const target& g (*t.group); - // This is execute(a, t, false) but that saves a call to executed_state() - // (which we don't need). + // This is execute_sync(a, t, false) but that saves a call to + // executed_state() (which we don't need). // - target_state gs (execute (a, g, 0, nullptr)); + target_state gs (execute_impl (a, g, 0, nullptr)); if (gs == target_state::busy) ctx.sched.wait (ctx.count_executed (), diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx index 00d4fdd..439af78 100644 --- a/libbuild2/algorithm.hxx +++ b/libbuild2/algorithm.hxx @@ -331,17 +331,18 @@ namespace build2 } // Match and apply a rule to the action/target with ambiguity detection. - // Increment the target's dependents count, which means that you should call - // this function with the intent to also call execute(). Return the target - // state translating target_state::failed to the failed exception unless - // instructed otherwise. - // - // The try_match() version doesn't issue diagnostics if there is no rule - // match (but fails as match() for all other errors, like rule ambiguity, - // inability to apply, etc). The first half of the result indicated whether - // there was a rule match. - // - // The unmatch argument allows optimizations that avoid calling execute(). + // This is the synchrounous match implementation that waits for completion + // if the target is already being matched. Increment the target's dependents + // count, which means that you should call this function with the intent to + // also call execute*(). Translating target_state::failed to the failed + // exception unless instructed otherwise. + // + // The try_match_sync() version doesn't issue diagnostics if there is no + // rule match (but fails as match_sync() for all other errors, like rule + // ambiguity, inability to apply, etc). The first half of the result + // indicated whether there was a rule match. + // + // The unmatch argument allows optimizations that avoid calling execute*(). // If it is unmatch::unchanged then only unmatch the target if it is known // to be unchanged after match. If it is unmatch::safe, then unmatch the // target if it is safe (this includes unchanged or if we know that someone @@ -351,18 +352,19 @@ namespace build2 enum class unmatch {none, unchanged, safe}; target_state - match (action, const target&, bool fail = true); + match_sync (action, const target&, bool fail = true); pair - try_match (action, const target&, bool fail = true); + try_match_sync (action, const target&, bool fail = true); pair - match (action, const target&, unmatch); + match_sync (action, const target&, unmatch); // Start asynchronous match. Return target_state::postponed if the - // asynchrounous operation has been started and target_state::busy if the - // target has already been busy. Regardless of the result, match() must be - // called in order to complete the operation (except target_state::failed). + // asynchronous operation has been started and target_state::busy if the + // target has already been busy. Regardless of the result, match_complete() + // must be called in order to complete the operation (except if the result + // is target_state::failed), which has the result semantics of match_sync(). // // If fail is false, then return target_state::failed if the target match // failed. Otherwise, throw the failed exception if keep_going is false and @@ -373,6 +375,12 @@ namespace build2 size_t start_count, atomic_count& task_count, bool fail = true); + target_state + match_complete (action, const target&, bool fail = true); + + pair + match_complete (action, const target&, unmatch); + // Apply the specified recipe directly and without incrementing the // dependency counts. The target must be locked. // @@ -400,8 +408,8 @@ namespace build2 void match_inc_dependents (action, const target&); - // Match a rule for the inner operation from withing the outer rule's - // apply() function. See also the companion execute_inner(). + // Match (synchronously) a rule for the inner operation from withing the + // outer rule's apply() function. See also the companion execute_inner(). // target_state match_inner (action, const target&); @@ -514,8 +522,9 @@ namespace build2 resolve_group (action, const target&); // Inject a target as a "prerequisite target" (note: not a prerequisite) of - // another target. Specifically, first match the prerequisite target and - // then add it to the back of the dependent target's prerequisite_targets. + // another target. Specifically, match (synchronously) the prerequisite + // target and then add it to the back of the dependent target's + // prerequisite_targets. // void inject (action, target&, const target& prereq); @@ -542,7 +551,7 @@ namespace build2 // fail is false. // target_state - execute (action, const target&, bool fail = true); + execute_sync (action, const target&, bool fail = true); // As above but start asynchronous execution. Return target_state::unknown // if the asynchrounous execution has been started and target_state::busy if @@ -550,26 +559,32 @@ namespace build2 // // If fail is false, then return target_state::failed if the target // execution failed. Otherwise, throw the failed exception if keep_going is - // false and return target_state::failed otherwise. + // false and return target_state::failed otherwise. Regardless of the + // result, execute_complete() must be called in order to complete the + // operation (except if the result is target_state::failed), which has the + // result semantics of execute_sync(). // target_state execute_async (action, const target&, size_t start_count, atomic_count& task_count, bool fail = true); - // Execute the recipe obtained with match_delegate(). Note that the target's - // state is neither checked nor updated by this function. In other words, - // the appropriate usage is to call this function from another recipe and to - // factor the obtained state into the one returned. + target_state + execute_complete (action, const target&); + + // Execute (synchronously) the recipe obtained with match_delegate(). Note + // that the target's state is neither checked nor updated by this function. + // In other words, the appropriate usage is to call this function from + // another recipe and to factor the obtained state into the one returned. // target_state execute_delegate (const recipe&, action, const target&); - // Execute the inner operation matched with match_inner(). Note that the - // returned target state is for the inner operation. The appropriate usage - // is to call this function from the outer operation's recipe and to factor - // the obtained state into the one returned (similar to how we do it for - // prerequisites). + // Execute (synchronously) the inner operation matched with match_inner(). + // Note that the returned target state is for the inner operation. The + // appropriate usage is to call this function from the outer operation's + // recipe and to factor the obtained state into the one returned (similar to + // how we do it for prerequisites). // // Note: waits for the completion if the target is busy and translates // target_state::failed to the failed exception. @@ -582,11 +597,11 @@ namespace build2 // relationship (so no dependents count is decremented) and execution order // (so this function never returns the postponed target state). // - // Note: the first version waits for the completion if the target is busy - // and translates target_state::failed to the failed exception. + // The first version waits for the completion if the target is busy and + // translates target_state::failed to the failed exception. // target_state - execute_direct (action, const target&); + execute_direct_sync (action, const target&); target_state execute_direct_async (action, const target&, diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx index 1b3a5cd..ce1ebee 100644 --- a/libbuild2/algorithm.ixx +++ b/libbuild2/algorithm.ixx @@ -372,7 +372,9 @@ namespace build2 apply_impl (action, target&, const rule_match&); LIBBUILD2_SYMEXPORT pair - match (action, const target&, size_t, atomic_count*, bool try_match = false); + match_impl (action, const target&, + size_t, atomic_count*, + bool try_match = false); inline void match_inc_dependents (action a, const target& t) @@ -382,11 +384,11 @@ namespace build2 } inline target_state - match (action a, const target& t, bool fail) + match_sync (action a, const target& t, bool fail) { assert (t.ctx.phase == run_phase::match); - target_state r (match (a, t, 0, nullptr).second); + target_state r (match_impl (a, t, 0, nullptr).second); if (r != target_state::failed) match_inc_dependents (a, t); @@ -397,12 +399,12 @@ namespace build2 } inline pair - try_match (action a, const target& t, bool fail) + try_match_sync (action a, const target& t, bool fail) { assert (t.ctx.phase == run_phase::match); pair r ( - match (a, t, 0, nullptr, true /* try_match */)); + match_impl (a, t, 0, nullptr, true /* try_match */)); if (r.first) { @@ -416,11 +418,11 @@ namespace build2 } inline pair - match (action a, const target& t, unmatch um) + match_sync (action a, const target& t, unmatch um) { assert (t.ctx.phase == run_phase::match); - target_state s (match (a, t, 0, nullptr).second); + target_state s (match_impl (a, t, 0, nullptr).second); if (s == target_state::failed) throw failed (); @@ -466,7 +468,7 @@ namespace build2 context& ctx (t.ctx); assert (ctx.phase == run_phase::match); - target_state r (match (a, t, sc, &tc).second); + target_state r (match_impl (a, t, sc, &tc).second); if (fail && !ctx.keep_going && r == target_state::failed) throw failed (); @@ -474,6 +476,18 @@ namespace build2 return r; } + inline target_state + match_complete (action a, const target& t, bool fail) + { + return match_sync (a, t, fail); + } + + inline pair + match_complete (action a, const target& t, unmatch um) + { + return match_sync (a, t, um); + } + // Clear rule match-specific target data. // inline void @@ -568,14 +582,14 @@ namespace build2 // In a sense this is like any other dependency. // assert (a.outer ()); - return match (a.inner_action (), t); + return match_sync (a.inner_action (), t); } inline pair match_inner (action a, const target& t, unmatch um) { assert (a.outer ()); - return match (a.inner_action (), t, um); + return match_sync (a.inner_action (), t, um); } LIBBUILD2_SYMEXPORT void @@ -613,7 +627,7 @@ namespace build2 inline void inject (action a, target& t, const target& p) { - match (a, p); + match_sync (a, p); t.prerequisite_targets[a].emplace_back (&p); } @@ -677,12 +691,12 @@ namespace build2 } LIBBUILD2_SYMEXPORT target_state - execute (action, const target&, size_t, atomic_count*); + execute_impl (action, const target&, size_t, atomic_count*); inline target_state - execute (action a, const target& t, bool fail) + execute_sync (action a, const target& t, bool fail) { - target_state r (execute (a, t, 0, nullptr)); + target_state r (execute_impl (a, t, 0, nullptr)); if (r == target_state::busy) { @@ -704,7 +718,7 @@ namespace build2 size_t sc, atomic_count& tc, bool fail) { - target_state r (execute (a, t, sc, &tc)); + target_state r (execute_impl (a, t, sc, &tc)); if (r == target_state::failed && fail && !t.ctx.keep_going) throw failed (); @@ -712,13 +726,30 @@ namespace build2 return r; } + inline target_state + execute_complete (action a, const target& t) + { + // Note: standard operation execute() sidesteps this and calls + // executed_state() directly. + + context& ctx (t.ctx); + + // If the target is still busy, wait for its completion. + // + ctx.sched.wait (ctx.count_executed (), + t[a].task_count, + scheduler::work_none); + + return t.executed_state (a); + } + LIBBUILD2_SYMEXPORT target_state - execute_direct (action, const target&, size_t, atomic_count*); + execute_direct_impl (action, const target&, size_t, atomic_count*); inline target_state - execute_direct (action a, const target& t) + execute_direct_sync (action a, const target& t) { - target_state r (execute_direct (a, t, 0, nullptr)); + target_state r (execute_direct_impl (a, t, 0, nullptr)); if (r == target_state::busy) { @@ -740,7 +771,7 @@ namespace build2 size_t sc, atomic_count& tc, bool fail) { - target_state r (execute_direct (a, t, sc, &tc)); + target_state r (execute_direct_impl (a, t, sc, &tc)); if (r == target_state::failed && fail && !t.ctx.keep_going) throw failed (); @@ -758,7 +789,7 @@ namespace build2 execute_inner (action a, const target& t) { assert (a.outer ()); - return execute (a.inner_action (), t); + return execute_sync (a.inner_action (), t); } inline target_state diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 24c9b2b..a5e5417 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -1013,7 +1013,7 @@ namespace build2 // unmatch. See how we do this in ad hoc rule. // pair mr ( - build2::match ( + match_complete ( a, *pt, pt->is_a () || pt->is_a () || pt->is_a () diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 30024ce..ffb7dfb 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -1844,7 +1844,7 @@ namespace build2 if (pt == nullptr || (m = unmark (pt)) == 0) continue; - build2::match (a, *pt); + match_complete (a, *pt); // Nothing else to do if not marked for verification. // diff --git a/libbuild2/config/operation.cxx b/libbuild2/config/operation.cxx index 4597af4..98ad9d0 100644 --- a/libbuild2/config/operation.cxx +++ b/libbuild2/config/operation.cxx @@ -965,7 +965,7 @@ namespace build2 ctx.current_operation (*oif); phase_lock pl (ctx, run_phase::match); - match (action (configure_id, id), t); + match_sync (action (configure_id, id), t); } } diff --git a/libbuild2/dist/rule.cxx b/libbuild2/dist/rule.cxx index 76d11c9..ac3d440 100644 --- a/libbuild2/dist/rule.cxx +++ b/libbuild2/dist/rule.cxx @@ -92,7 +92,7 @@ namespace build2 // Don't match targets that are outside of our project. // if (pt->dir.sub (out_root)) - build2::match (a, *pt); + match_sync (a, *pt); } return noop_recipe; // We will never be executed. diff --git a/libbuild2/dyndep.cxx b/libbuild2/dyndep.cxx index 47c6396..727a28c 100644 --- a/libbuild2/dyndep.cxx +++ b/libbuild2/dyndep.cxx @@ -30,11 +30,11 @@ namespace build2 bool adhoc, uintptr_t data) { - // Even if failing we still use try_match() in order to issue consistent - // (with other places) diagnostics (rather than the generic "not rule to - // update ..."). + // Even if failing we still use try_match_sync() in order to issue + // consistent (with other places) diagnostics (rather than the generic + // "not rule to update ..."). // - if (!try_match (a, pt).first) + if (!try_match_sync (a, pt).first) { if (!f) return nullopt; @@ -65,7 +65,7 @@ namespace build2 bool adhoc, uintptr_t data) { - if (!try_match (a, pt).first) + if (!try_match_sync (a, pt).first) { if (!f) return nullopt; diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx index 0a1b994..30f1755 100644 --- a/libbuild2/install/rule.cxx +++ b/libbuild2/install/rule.cxx @@ -149,8 +149,8 @@ namespace build2 // libu{}) then ignore it if there is no rule to install. // if (pt->is_a ()) - build2::match (a, *pt); - else if (!try_match (a, *pt).first) + match_sync (a, *pt); + else if (!try_match_sync (a, *pt).first) { l5 ([&]{trace << "ignoring " << *pt << " (no rule)";}); pt = nullptr; @@ -284,7 +284,7 @@ namespace build2 continue; } - build2::match (a, *mt); + match_sync (a, *mt); pts.push_back (mt); // Never ad hoc. } } @@ -434,10 +434,10 @@ namespace build2 // when updating static installable content (headers, documentation, // etc). // - if (build2::match (a, *pt, unmatch::unchanged).first) + if (match_sync (a, *pt, unmatch::unchanged).first) pt = nullptr; } - else if (!try_match (a, *pt).first) + else if (!try_match_sync (a, *pt).first) { l5 ([&]{trace << "ignoring " << *pt << " (no rule)";}); pt = nullptr; diff --git a/libbuild2/operation.cxx b/libbuild2/operation.cxx index 72b73f9..b7f414e 100644 --- a/libbuild2/operation.cxx +++ b/libbuild2/operation.cxx @@ -320,7 +320,7 @@ namespace build2 const target& t (at.as ()); target_state s (j < i - ? match (a, t, false) + ? match_complete (a, t, false) : target_state::postponed); switch (s) { @@ -510,6 +510,9 @@ namespace build2 { const target& t (at.as ()); + // Note that here we call executed_state() directly instead of + // execute_complete() since we know there is no need to wait. + // switch ((at.state = t.executed_state (a, false))) { case target_state::unknown: diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx index 4c51e2e..3d8c4ff 100644 --- a/libbuild2/target.hxx +++ b/libbuild2/target.hxx @@ -705,7 +705,7 @@ namespace build2 target_state matched_state (action, bool fail = true) const; - // See try_match(). + // See try_match_sync(). // pair try_matched_state (action, bool fail = true) const; @@ -730,7 +730,7 @@ namespace build2 // matched for this action. // // Indicate whether there is a rule match with the first half of the - // result (see try_match()). + // result (see try_match_sync()). // pair matched_state_impl (action) const; -- cgit v1.1