diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-19 10:26:22 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-19 10:26:22 +0200 |
commit | 18394bc05dc4cadb2dc193cfeb78598c70447869 (patch) | |
tree | 2b3d794305dc5d950f9c05094b80c89b93e5fd25 /libbuild2/algorithm.hxx | |
parent | b408d19f614b47670cd0a0def501266f0d7689b5 (diff) |
Add support for post hoc prerequisites
Unlike normal and ad hoc prerequisites, a post hoc prerequisite is built
after the target, not before. It may also form a dependency cycle together
with normal/ad hoc prerequisites. In other words, all this form of dependency
guarantees is that a post hoc prerequisite will be built if its dependent
target is built.
See the NEWS file for details and an example.
Diffstat (limited to 'libbuild2/algorithm.hxx')
-rw-r--r-- | libbuild2/algorithm.hxx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx index e558d3a..756c3fe 100644 --- a/libbuild2/algorithm.hxx +++ b/libbuild2/algorithm.hxx @@ -195,6 +195,8 @@ namespace build2 explicit operator bool () const {return target != nullptr;} + // Note: achieved offset is preserved. + // void unlock (); @@ -374,6 +376,12 @@ namespace build2 pair<bool, target_state> match_sync (action, const target&, unmatch); + // As above but without incrementing the target's dependents count. Should + // be executed with execute_direct_*(). + // + target_state + match_direct_sync (action, const target&, bool fail = true); + // Start asynchronous match. Return target_state::postponed if the // asynchronous operation has been started and target_state::busy if the // target has already been busy. Regardless of the result, match_complete() @@ -486,11 +494,11 @@ namespace build2 // target pointers are skipped. // LIBBUILD2_SYMEXPORT void - match_members (action, target&, const target* const*, size_t); + match_members (action, const target&, const target* const*, size_t); template <size_t N> inline void - match_members (action a, target& t, const target* (&ts)[N]) + match_members (action a, const target& t, const target* (&ts)[N]) { match_members (a, t, ts, N); } @@ -501,7 +509,7 @@ namespace build2 // LIBBUILD2_SYMEXPORT void match_members (action a, - target& t, + const target& t, prerequisite_targets& ts, size_t start = 0, pair<uintptr_t, uintptr_t> include = {0, 0}); @@ -613,7 +621,7 @@ namespace build2 // translates target_state::failed to the failed exception. // target_state - execute_direct_sync (action, const target&); + execute_direct_sync (action, const target&, bool fail = true); target_state execute_direct_async (action, const target&, @@ -795,8 +803,9 @@ namespace build2 // Call straight or reverse depending on the current mode. // + template <typename T> target_state - execute_members (action, const target&, const target*[], size_t); + execute_members (action, const target&, T[], size_t); template <size_t N> inline target_state |