From f5090740dcb36067707ff40e0d41cdbeef15e63e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 15 Oct 2016 17:57:55 +0200 Subject: Add support for skipping rule in delegate_match() --- build2/algorithm | 11 ++++++----- build2/algorithm.cxx | 9 ++++++--- build2/algorithm.ixx | 6 +++--- build2/install/rule.cxx | 2 +- build2/test/rule.cxx | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/build2/algorithm b/build2/algorithm index db2ccca..4c12148 100644 --- a/build2/algorithm +++ b/build2/algorithm @@ -87,13 +87,14 @@ namespace build2 void match_only (action, target&); - // Match a "delegate rule" from withing another rules' apply() - // function. Return recipe and recipe action (if any). Note - // that unlike match(), this call doesn't increment the - // dependents count. See also the companion execute_delegate(). + // Match a "delegate rule" from withing another rules' apply() function + // skipping recursive matches (thus the third argument). Return recipe and + // recipe action (if any). Note that unlike match(), this call doesn't + // increment the dependents count. See also the companion + // execute_delegate(). // pair - match_delegate (action, target&); + match_delegate (action, target&, const rule&); // The standard prerequisite search and match implementations. They call // search_and_match_*() versions below passing non-empty directory for diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 8dc5621..2390b04 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -53,7 +53,7 @@ namespace build2 } pair - match_impl (action a, target& t, bool apply) + match_impl (action a, target& t, bool apply, const rule* skip) { pair r; @@ -97,8 +97,8 @@ namespace build2 if (om == nullptr) continue; // No entry for this meta-operation id. - // First try the map for the actual operation. If that - // doesn't yeld anything, try the wildcard map. + // First try the map for the actual operation. If that doesn't yeld + // anything, try the wildcard map. // for (size_t oi (o), oip (o); oip != 0; oip = oi, oi = 0) { @@ -140,6 +140,9 @@ namespace build2 const string& n (i->first); const rule& ru (i->second); + if (&ru == skip) + continue; + match_result m; { auto g ( diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index c9c6b02..ee4e338 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -50,7 +50,7 @@ namespace build2 } pair - match_impl (action, target&, bool apply); + match_impl (action, target&, bool apply, const rule* skip = nullptr); inline void match (action a, target& t) @@ -82,9 +82,9 @@ namespace build2 } inline pair - match_delegate (action a, target& t) + match_delegate (action a, target& t, const rule& r) { - auto rp (match_impl (a, t, false)); + auto rp (match_impl (a, t, false, &r)); const match_result& mr (rp.second); return make_pair (rp.first->apply (mr.recipe_action, t, mr), mr.recipe_action); diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index fd88699..82dde04 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -193,7 +193,7 @@ namespace build2 // have been found if we signalled that we do not match from // match() above. // - recipe d (match_delegate (a, t).first); + recipe d (match_delegate (a, t, *this).first); // If we have no installable prerequisites, then simply redirect // to it. diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx index dd1e029..2370111 100644 --- a/build2/test/rule.cxx +++ b/build2/test/rule.cxx @@ -258,7 +258,7 @@ namespace build2 // been found if we signalled that we do not match from match() // above. // - recipe d (match_delegate (a, t).first); + recipe d (match_delegate (a, t, *this).first); // If we have no input/output that needs updating, then simply // redirect to it. -- cgit v1.1