aboutsummaryrefslogtreecommitdiff
path: root/build2/target.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/target.ixx')
-rw-r--r--build2/target.ixx15
1 files changed, 13 insertions, 2 deletions
diff --git a/build2/target.ixx b/build2/target.ixx
index 459265b..9b4b9d8 100644
--- a/build2/target.ixx
+++ b/build2/target.ixx
@@ -92,9 +92,20 @@ namespace build2
{
// Note that the target could be being asynchronously re-matched.
//
- target_state r (state (a));
+ pair<bool, target_state> r (state (a));
- if (fail && r == target_state::failed)
+ if (fail && (!r.first || r.second == target_state::failed))
+ throw failed ();
+
+ return r.second;
+ }
+
+ inline pair<bool, target_state> target::
+ try_matched_state (action_type a, bool fail) const
+ {
+ pair<bool, target_state> r (state (a));
+
+ if (fail && r.first && r.second == target_state::failed)
throw failed ();
return r;