aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
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
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')
-rw-r--r--libbuild2/algorithm.cxx10
-rw-r--r--libbuild2/algorithm.ixx2
2 files changed, 9 insertions, 3 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 ();
}
diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx
index 7c87a72..3398595 100644
--- a/libbuild2/algorithm.ixx
+++ b/libbuild2/algorithm.ixx
@@ -646,7 +646,7 @@ namespace build2
}
LIBBUILD2_SYMEXPORT void
- resolve_group_impl (action, const target&, target_lock);
+ resolve_group_impl (action, const target&, target_lock&&);
inline const target*
resolve_group (action a, const target& t)