aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-10-23 11:02:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-10-26 13:29:24 +0200
commit3386bad31f31d5623141297e08cee5de29cd0219 (patch)
tree4802e2f9e927dc7f7d5addda09c4d7e03a3d7257
parentc9e9432018b57b7f532480415059ff62d7f96a40 (diff)
WIP: reorder options/fail argument in match_*() functions
-rw-r--r--libbuild2/algorithm.hxx30
-rw-r--r--libbuild2/algorithm.ixx40
-rw-r--r--libbuild2/operation.cxx11
3 files changed, 43 insertions, 38 deletions
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index 829c5be..5ebbae2 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -371,13 +371,13 @@ namespace build2
target_state
match_sync (action, const target&,
- bool fail = true,
- uint64_t options = match_extra::all_options);
+ uint64_t options = match_extra::all_options,
+ bool fail = true);
pair<bool, target_state>
try_match_sync (action, const target&,
- bool fail = true,
- uint64_t options = match_extra::all_options);
+ uint64_t options = match_extra::all_options,
+ bool fail = true);
pair<bool, target_state>
match_sync (action, const target&,
@@ -407,13 +407,13 @@ namespace build2
target_state
match_async (action, const target&,
size_t start_count, atomic_count& task_count,
- bool fail = true,
- uint64_t options = match_extra::all_options);
+ uint64_t options = match_extra::all_options,
+ bool fail = true);
target_state
match_complete (action, const target&,
- bool fail = true,
- uint64_t options = match_extra::all_options);
+ uint64_t options = match_extra::all_options,
+ bool fail = true);
pair<bool, target_state>
match_complete (action, const target&,
@@ -427,13 +427,13 @@ namespace build2
//
target_state
match_direct_sync (action, const target&,
- bool fail = true,
- uint64_t options = match_extra::all_options);
+ uint64_t options = match_extra::all_options,
+ bool fail = true);
target_state
match_direct_complete (action, const target&,
- bool fail = true,
- uint64_t options = match_extra::all_options);
+ uint64_t options = match_extra::all_options,
+ bool fail = true);
// Apply the specified recipe directly and without incrementing the
// dependency counts. The target must be locked.
@@ -464,8 +464,8 @@ namespace build2
recipe
match_delegate (action, target&,
const rule&,
- bool try_match = false,
- uint64_t options = match_extra::all_options);
+ uint64_t options = match_extra::all_options,
+ bool try_match = false);
// Incrementing the dependency counts of the specified target.
//
@@ -496,8 +496,8 @@ namespace build2
target_state
rematch_async (action, const target&,
- uint64_t options,
size_t start_count, atomic_count& task_count,
+ uint64_t options,
bool fail = true);
target_state
diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx
index f9992c9..09fc6d9 100644
--- a/libbuild2/algorithm.ixx
+++ b/libbuild2/algorithm.ixx
@@ -417,7 +417,7 @@ namespace build2
}
inline target_state
- match_sync (action a, const target& t, bool fail, uint64_t options)
+ match_sync (action a, const target& t, uint64_t options, bool fail)
{
assert (t.ctx.phase == run_phase::match);
@@ -432,7 +432,7 @@ namespace build2
}
inline pair<bool, target_state>
- try_match_sync (action a, const target& t, bool fail, uint64_t options)
+ try_match_sync (action a, const target& t, uint64_t options, bool fail)
{
assert (t.ctx.phase == run_phase::match);
@@ -496,8 +496,8 @@ namespace build2
inline target_state
match_async (action a, const target& t,
size_t sc, atomic_count& tc,
- bool fail,
- uint64_t options)
+ uint64_t options,
+ bool fail)
{
context& ctx (t.ctx);
@@ -511,9 +511,9 @@ namespace build2
}
inline target_state
- match_complete (action a, const target& t, bool fail, uint64_t options)
+ match_complete (action a, const target& t, uint64_t options, bool fail)
{
- return match_sync (a, t, fail, options);
+ return match_sync (a, t, options, fail);
}
inline pair<bool, target_state>
@@ -523,7 +523,7 @@ namespace build2
}
inline target_state
- match_direct_sync (action a, const target& t, bool fail, uint64_t options)
+ match_direct_sync (action a, const target& t, uint64_t options, bool fail)
{
assert (t.ctx.phase == run_phase::match);
@@ -537,10 +537,10 @@ namespace build2
inline target_state
match_direct_complete (action a, const target& t,
- bool fail,
- uint64_t options)
+ uint64_t options,
+ bool fail)
{
- return match_direct_sync (a, t, fail, options);
+ return match_direct_sync (a, t, options, fail);
}
// Clear rule match-specific target data (except match_extra).
@@ -612,7 +612,7 @@ namespace build2
}
inline void
- match_recipe (target_lock& l, recipe r, uint64_t o)
+ match_recipe (target_lock& l, recipe r, uint64_t options)
{
assert (l.target != nullptr &&
l.offset < target::offset_matched &&
@@ -621,7 +621,7 @@ namespace build2
match_extra& me ((*l.target)[l.action].match_extra);
me.reinit (false /* fallback */);
- me.cur_options = o; // Already applied, so cur_, not new_options.
+ me.cur_options = options; // Already applied, so cur_, not new_options.
clear_target (l.action, *l.target);
set_rule (l, nullptr); // No rule.
set_recipe (l, move (r));
@@ -629,7 +629,7 @@ namespace build2
}
inline void
- match_rule (target_lock& l, const rule_match& r, uint64_t o)
+ match_rule (target_lock& l, const rule_match& r, uint64_t options)
{
assert (l.target != nullptr &&
l.offset < target::offset_matched &&
@@ -638,7 +638,7 @@ namespace build2
match_extra& me ((*l.target)[l.action].match_extra);
me.reinit (false /* fallback */);
- me.new_options = o;
+ me.new_options = options;
clear_target (l.action, *l.target);
set_rule (l, &r);
l.offset = target::offset_matched;
@@ -647,8 +647,8 @@ namespace build2
inline recipe
match_delegate (action a, target& t,
const rule& dr,
- bool try_match,
- uint64_t options)
+ uint64_t options,
+ bool try_match)
{
assert (t.ctx.phase == run_phase::match);
@@ -683,16 +683,16 @@ namespace build2
uint64_t options,
bool fail)
{
- return match_direct_sync (a, t, fail, options);
+ return match_direct_sync (a, t, options, fail);
}
inline target_state
rematch_async (action a, const target& t,
- uint64_t options,
size_t start_count, atomic_count& task_count,
+ uint64_t options,
bool fail)
{
- return match_async (a, t, start_count, task_count, fail, options);
+ return match_async (a, t, start_count, task_count, options, fail);
}
inline target_state
@@ -700,7 +700,7 @@ namespace build2
uint64_t options,
bool fail)
{
- return match_direct_complete (a, t, fail, options);
+ return match_direct_complete (a, t, options, fail);
}
LIBBUILD2_SYMEXPORT void
diff --git a/libbuild2/operation.cxx b/libbuild2/operation.cxx
index 4af03fe..7b6dc3c 100644
--- a/libbuild2/operation.cxx
+++ b/libbuild2/operation.cxx
@@ -330,7 +330,10 @@ namespace build2
const target& t (ts[i].as<target> ());
l5 ([&]{trace << diag_doing (a, t);});
- target_state s (match_async (a, t, 0, task_count, false));
+ target_state s (match_async (a, t,
+ 0, task_count,
+ match_extra::all_options,
+ false /* fail */));
// Bail out if the target has failed and we weren't instructed to
// keep going.
@@ -382,7 +385,9 @@ namespace build2
//
for (const target* pt: p.prerequisite_targets)
{
- target_state s (match_direct_sync (a, *pt, false /* fail */));
+ target_state s (match_direct_sync (a, *pt,
+ match_extra::all_options,
+ false /* fail */));
if (s == target_state::failed)
{
@@ -419,7 +424,7 @@ namespace build2
target_state s;
if (j < i)
{
- s = match_complete (a, t, false);
+ s = match_complete (a, t, match_extra::all_options, false /* fail */);
if (posthoc_fail)
s = /*t.state[a].state =*/ target_state::failed;