aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-19 15:20:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-19 15:20:07 +0200
commit2cab7b3c2618be9328545e66fc340faea6b15f45 (patch)
treebd15d73a0543a943732a7b5f3becc750df59470f /libbuild2/algorithm.cxx
parent18394bc05dc4cadb2dc193cfeb78598c70447869 (diff)
Minor tweaks to target_lock passing semantics
This should also get rid of the bogus -Wdangling-pointer issued by GCC 12.
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r--libbuild2/algorithm.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index 16a6728..e11275d 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -1117,8 +1117,10 @@ namespace build2
return ct.try_matched_state (a, false);
}
+ // Note: lock is a reference to avoid the stacking overhead.
+ //
static group_view
- resolve_members_impl (action a, const target& g, target_lock l)
+ resolve_members_impl (action a, const target& g, target_lock&& l)
{
// Note that we will be unlocked if the target is already applied.
//
@@ -1247,8 +1249,10 @@ namespace build2
return r;
}
+ // Note: lock is a reference to avoid the stacking overhead.
+ //
void
- resolve_group_impl (action a, const target& t, target_lock l)
+ resolve_group_impl (action a, const target& t, target_lock&& l)
{
pair<bool, target_state> r (
match_impl (l, true /* step */, true /* try_match */));
@@ -1262,6 +1266,8 @@ namespace build2
r.second = target_state::failed;
}
+ l.unlock ();
+
if (r.first && r.second == target_state::failed)
throw failed ();
}