aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-09-01 17:33:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-09-01 17:33:44 +0200
commit53105890d75789c81adbb3d781eff9ebd7110222 (patch)
treeda93174356fc2d0a80f49b11e0cd16e7c71b7c80 /build2/algorithm.hxx
parent631c76d7613458dbef208ca056e194e94a5becf3 (diff)
Add support for try_match(), use to handle deleted headers
Diffstat (limited to 'build2/algorithm.hxx')
-rw-r--r--build2/algorithm.hxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/build2/algorithm.hxx b/build2/algorithm.hxx
index e8b9823..dbc7d9b 100644
--- a/build2/algorithm.hxx
+++ b/build2/algorithm.hxx
@@ -173,6 +173,11 @@ namespace build2
// 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().
// 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
@@ -185,6 +190,9 @@ namespace build2
target_state
match (action, const target&, bool fail = true);
+ pair<bool, target_state>
+ try_match (action, const target&, bool fail = true);
+
bool
match (action, const target&, unmatch);
@@ -208,13 +216,13 @@ namespace build2
match_recipe (target_lock&, recipe);
// Match a "delegate rule" from withing another rules' apply() function
- // avoiding recursive matches (thus the third argument). Unless fail is
- // false, fail if not rule is found. Otherwise return empty recipe. Note
- // that unlike match(), this function does not increment the dependents
+ // avoiding recursive matches (thus the third argument). Unless try_match is
+ // true, fail if not rule is found. Otherwise return empty recipe. Note that
+ // unlike match(), this function does not increment the dependents
// count. See also the companion execute_delegate().
//
recipe
- match_delegate (action, target&, const rule&, bool fail = true);
+ match_delegate (action, target&, const rule&, bool try_match = false);
// The standard prerequisite search and match implementations. They call
// search() and then match() for each prerequisite in a loop omitting out of