From 88f0780e34116c0441a8d8c58b8a8fd9fde4b1f5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Jan 2017 15:41:44 +0200 Subject: Add model mutex, make var_pool const by default --- build2/test/init.cxx | 2 +- build2/test/rule | 6 +++--- build2/test/rule.cxx | 34 +++++++++++++++++----------------- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'build2/test') diff --git a/build2/test/init.cxx b/build2/test/init.cxx index 94e4073..fd8db99 100644 --- a/build2/test/init.cxx +++ b/build2/test/init.cxx @@ -36,7 +36,7 @@ namespace build2 // Enter module variables. Do it during boot in case they get assigned // in bootstrap.build. // - auto& vp (var_pool); + auto& vp (var_pool.rw (rs)); // Tests to execute. // diff --git a/build2/test/rule b/build2/test/rule index 20ad905..0e208ff 100644 --- a/build2/test/rule +++ b/build2/test/rule @@ -21,7 +21,7 @@ namespace build2 { public: virtual match_result - match (action, target&, const string&) const override; + match (slock&, action, target&, const string&) const override; target_state perform_script (action, target&) const; @@ -31,7 +31,7 @@ namespace build2 { public: virtual recipe - apply (action, target&) const override; + apply (slock&, action, target&) const override; static target_state perform_test (action, target&); @@ -41,7 +41,7 @@ namespace build2 { public: virtual recipe - apply (action, target&) const override; + apply (slock&, action, target&) const override; target_state perform_test (action, target&) const; diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx index 1f27979..17821a4 100644 --- a/build2/test/rule.cxx +++ b/build2/test/rule.cxx @@ -35,7 +35,7 @@ namespace build2 "insufficient space"); match_result rule_common:: - match (action a, target& t, const string&) const + match (slock& ml, action a, target& t, const string&) const { // The (admittedly twisted) logic of this rule tries to achieve the // following: If the target is testable, then we want both first update @@ -63,7 +63,7 @@ namespace build2 // If we have any prerequisites of the test{} type, then this is the // testscript case. // - for (prerequisite_member p: group_prerequisite_members (a, t)) + for (prerequisite_member p: group_prerequisite_members (ml, a, t)) { if (p.is_a ()) { @@ -91,7 +91,7 @@ namespace build2 // Use lookup depths to figure out who "overrides" whom. // - auto p (t.find ("test")); + auto p (t.find (var_pool["test"])); const name* n (cast_null (p.first)); // Note that test can be set to an "override" target. @@ -102,7 +102,7 @@ namespace build2 { auto test = [&t, &p] (const char* var) { - return t.find (var).second < p.second; + return t.find (var_pool[var]).second < p.second; }; md.test = @@ -155,7 +155,7 @@ namespace build2 } recipe alias_rule:: - apply (action a, target& t) const + apply (slock& ml, action a, target& t) const { match_data md (move (t.data ())); t.clear_data (); // In case delegated-to rule also uses aux storage. @@ -171,7 +171,7 @@ namespace build2 // standard alias rule. // if (a.operation () == update_id) - return match_delegate (a, t, *this).first; + return match_delegate (ml, a, t, *this).first; // For the test operation we have to implement our own search and match // because we need to ignore prerequisites that are outside of our @@ -181,7 +181,7 @@ namespace build2 // not ours seems right. Note that we still want to make sure they are // up to date (via the above delegate) since our tests might use them. // - search_and_match_prerequisites (a, t, t.root_scope ()); + search_and_match_prerequisites (ml, a, t, t.root_scope ()); // If not a test then also redirect to the alias rule. // @@ -191,7 +191,7 @@ namespace build2 } recipe rule:: - apply (action a, target& t) const + apply (slock& ml, action a, target& t) const { tracer trace ("test::rule::apply"); @@ -208,11 +208,11 @@ namespace build2 if (md.script) { if (a.operation () == update_id) - return match_delegate (a, t, *this).first; + return match_delegate (ml, a, t, *this).first; // Collect all the testscript targets in prerequisite_targets. // - for (prerequisite_member p: group_prerequisite_members (a, t)) + for (prerequisite_member p: group_prerequisite_members (ml, a, t)) { if (p.is_a ()) t.prerequisite_targets.push_back (&p.search ()); @@ -229,10 +229,10 @@ namespace build2 // We should have either arguments or input/roundtrip. Again, use // lookup depth to figure out who takes precedence. // - auto ip (t.find ("test.input")); - auto op (t.find ("test.output")); - auto rp (t.find ("test.roundtrip")); - auto ap (t.find ("test.arguments")); + auto ip (t.find (var_pool["test.input"])); + auto op (t.find (var_pool["test.output"])); + auto rp (t.find (var_pool["test.roundtrip"])); + auto ap (t.find (var_pool["test.arguments"])); auto test = [&t] (pair& x, const char* xn, pair& y, const char* yn) @@ -286,7 +286,7 @@ namespace build2 // if (it != nullptr) { - build2::match (a, *it); + build2::match (ml, a, *it); if (it->state () == target_state::unchanged) { @@ -299,7 +299,7 @@ namespace build2 { if (in != on) { - build2::match (a, *ot); + build2::match (ml, a, *ot); if (ot->state () == target_state::unchanged) { @@ -315,7 +315,7 @@ namespace build2 // been found if we signalled that we do not match from match() // above. // - recipe d (match_delegate (a, t, *this).first); + recipe d (match_delegate (ml, a, t, *this).first); // If we have no input/output that needs updating, then simply // redirect to it. -- cgit v1.1