aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/algorithm.cxx17
-rw-r--r--libbuild2/algorithm.hxx43
-rw-r--r--libbuild2/algorithm.ixx44
3 files changed, 62 insertions, 42 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index a414356..b34c175 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -1145,7 +1145,8 @@ namespace build2
dr << info << "while matching group rule to " << diag_do (a, t);
});
- pair<bool, target_state> r (match_impl (a, g, 0, nullptr, try_match));
+ pair<bool, target_state> r (
+ match_impl (a, g, 0 /* options */, 0, nullptr, try_match));
if (r.first)
{
@@ -1285,15 +1286,11 @@ namespace build2
// the first half of the result.
//
pair<bool, target_state>
- match_impl (action a,
- const target& ct,
- size_t start_count,
- atomic_count* task_count,
+ match_impl (action a, const target& ct,
+ uint64_t options,
+ size_t start_count, atomic_count* task_count,
bool try_match)
{
-
- uint64_t options (match_extra::all_options); // @@ TMP
-
// If we are blocking then work our own queue one task at a time. The
// logic here is that we may have already queued other tasks before this
// one and there is nothing bad (except a potentially deep stack trace)
@@ -1384,12 +1381,10 @@ namespace build2
}
void
- match_only_sync (action a, const target& t)
+ match_only_sync (action a, const target& t, uint64_t options)
{
assert (t.ctx.phase == run_phase::match);
- uint64_t options (match_extra::all_options); // @@ TMP
-
target_lock l (lock_impl (a, t, scheduler::work_none, options));
if (l.target != nullptr)
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index 889eefc..e01fbb8 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -368,20 +368,27 @@ namespace build2
enum class unmatch {none, unchanged, safe};
target_state
- match_sync (action, const target&, bool fail = true);
+ match_sync (action, const target&,
+ bool fail = true,
+ uint64_t options = match_extra::all_options);
pair<bool, target_state>
- try_match_sync (action, const target&, bool fail = true);
+ try_match_sync (action, const target&,
+ bool fail = true,
+ uint64_t options = match_extra::all_options);
pair<bool, target_state>
- match_sync (action, const target&, unmatch);
+ match_sync (action, const target&,
+ unmatch,
+ uint64_t options = match_extra::all_options);
// As above but only match the target (unless already matched) without
// applying the match (which is normally done with match_sync()). You will
// most likely regret using this function.
//
LIBBUILD2_SYMEXPORT void
- match_only_sync (action, const target&);
+ match_only_sync (action, const target&,
+ uint64_t options = match_extra::all_options);
// Start asynchronous match. Return target_state::postponed if the
// asynchronous operation has been started and target_state::busy if the
@@ -393,16 +400,23 @@ namespace build2
// failed. Otherwise, throw the failed exception if keep_going is false and
// return target_state::failed otherwise.
//
+ // Note: same options must be passed to match_async() and match_complete().
+ //
target_state
match_async (action, const target&,
size_t start_count, atomic_count& task_count,
- bool fail = true);
+ bool fail = true,
+ uint64_t options = match_extra::all_options);
target_state
- match_complete (action, const target&, bool fail = true);
+ match_complete (action, const target&,
+ bool fail = true,
+ uint64_t options = match_extra::all_options);
pair<bool, target_state>
- match_complete (action, const target&, unmatch);
+ match_complete (action, const target&,
+ unmatch,
+ uint64_t options = match_extra::all_options);
// As above but without incrementing the target's dependents count. Should
// be executed with execute_direct_*().
@@ -410,10 +424,14 @@ namespace build2
// For async, call match_async() followed by match_direct_complete().
//
target_state
- match_direct_sync (action, const target&, bool fail = true);
+ match_direct_sync (action, const target&,
+ bool fail = true,
+ uint64_t options = match_extra::all_options);
target_state
- match_direct_complete (action, const target&, bool fail = true);
+ match_direct_complete (action, const target&,
+ bool fail = true,
+ uint64_t options = match_extra::all_options);
// Apply the specified recipe directly and without incrementing the
// dependency counts. The target must be locked.
@@ -457,10 +475,13 @@ namespace build2
// and inner_recipe.
//
target_state
- match_inner (action, const target&);
+ match_inner (action, const target&,
+ uint64_t options = match_extra::all_options);
pair<bool, target_state>
- match_inner (action, const target&, unmatch);
+ match_inner (action, const target&,
+ unmatch,
+ uint64_t options = match_extra::all_options);
// The standard prerequisite search and match implementations. They call
// search() (unless a custom is provided) and then match() (unless custom
diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx
index 5b7238c..813c685 100644
--- a/libbuild2/algorithm.ixx
+++ b/libbuild2/algorithm.ixx
@@ -405,6 +405,7 @@ namespace build2
LIBBUILD2_SYMEXPORT pair<bool, target_state>
match_impl (action, const target&,
+ uint64_t options,
size_t, atomic_count*,
bool try_match = false);
@@ -416,11 +417,11 @@ namespace build2
}
inline target_state
- match_sync (action a, const target& t, bool fail)
+ match_sync (action a, const target& t, bool fail, uint64_t options)
{
assert (t.ctx.phase == run_phase::match);
- target_state r (match_impl (a, t, 0, nullptr).second);
+ target_state r (match_impl (a, t, options, 0, nullptr).second);
if (r != target_state::failed)
match_inc_dependents (a, t);
@@ -431,12 +432,12 @@ namespace build2
}
inline pair<bool, target_state>
- try_match_sync (action a, const target& t, bool fail)
+ try_match_sync (action a, const target& t, bool fail, uint64_t options)
{
assert (t.ctx.phase == run_phase::match);
pair<bool, target_state> r (
- match_impl (a, t, 0, nullptr, true /* try_match */));
+ match_impl (a, t, options, 0, nullptr, true /* try_match */));
if (r.first)
{
@@ -450,11 +451,11 @@ namespace build2
}
inline pair<bool, target_state>
- match_sync (action a, const target& t, unmatch um)
+ match_sync (action a, const target& t, unmatch um, uint64_t options)
{
assert (t.ctx.phase == run_phase::match);
- target_state s (match_impl (a, t, 0, nullptr).second);
+ target_state s (match_impl (a, t, options, 0, nullptr).second);
if (s == target_state::failed)
throw failed ();
@@ -495,12 +496,13 @@ namespace build2
inline target_state
match_async (action a, const target& t,
size_t sc, atomic_count& tc,
- bool fail)
+ bool fail,
+ uint64_t options)
{
context& ctx (t.ctx);
assert (ctx.phase == run_phase::match);
- target_state r (match_impl (a, t, sc, &tc).second);
+ target_state r (match_impl (a, t, options, sc, &tc).second);
if (r == target_state::failed && fail && !ctx.keep_going)
throw failed ();
@@ -509,23 +511,23 @@ namespace build2
}
inline target_state
- match_complete (action a, const target& t, bool fail)
+ match_complete (action a, const target& t, bool fail, uint64_t options)
{
- return match_sync (a, t, fail);
+ return match_sync (a, t, fail, options);
}
inline pair<bool, target_state>
- match_complete (action a, const target& t, unmatch um)
+ match_complete (action a, const target& t, unmatch um, uint64_t options)
{
- return match_sync (a, t, um);
+ return match_sync (a, t, um, options);
}
inline target_state
- match_direct_sync (action a, const target& t, bool fail)
+ match_direct_sync (action a, const target& t, bool fail, uint64_t options)
{
assert (t.ctx.phase == run_phase::match);
- target_state r (match_impl (a, t, 0, nullptr).second);
+ target_state r (match_impl (a, t, options, 0, nullptr).second);
if (r == target_state::failed && fail)
throw failed ();
@@ -534,9 +536,11 @@ namespace build2
}
inline target_state
- match_direct_complete (action a, const target& t, bool fail)
+ match_direct_complete (action a, const target& t,
+ bool fail,
+ uint64_t options)
{
- return match_direct_sync (a, t, fail);
+ return match_direct_sync (a, t, fail, options);
}
// Clear rule match-specific target data (except match_extra).
@@ -656,19 +660,19 @@ namespace build2
}
inline target_state
- match_inner (action a, const target& t)
+ match_inner (action a, const target& t, uint64_t options)
{
// In a sense this is like any other dependency.
//
assert (a.outer ());
- return match_sync (a.inner_action (), t);
+ return match_sync (a.inner_action (), t, options);
}
inline pair<bool, target_state>
- match_inner (action a, const target& t, unmatch um)
+ match_inner (action a, const target& t, unmatch um, uint64_t options)
{
assert (a.outer ());
- return match_sync (a.inner_action (), t, um);
+ return match_sync (a.inner_action (), t, um, options);
}
LIBBUILD2_SYMEXPORT void