diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-09-07 13:08:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-09-07 13:08:30 +0200 |
commit | 87201b1c10769606214e27e64e88af5b835cb56f (patch) | |
tree | 0515ca6fa456d901ffc859008ee35bdd9947e5e1 | |
parent | b6dfd0e94aad546069eee7749a0b78eda45f6a78 (diff) |
Fix assert after cycle detection in ad hoc groups
-rw-r--r-- | libbuild2/algorithm.cxx | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index fcff50e..d69ff95 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -827,46 +827,46 @@ namespace build2 target& t (*l.target); target::opstate& s (t[a]); - // Intercept and handle matching an ad hoc group member. - // - if (t.adhoc_group_member ()) + try { - assert (!step); + // Intercept and handle matching an ad hoc group member. + // + if (t.adhoc_group_member ()) + { + assert (!step); - const target& g (*t.group); + const target& g (*t.group); - // It feels natural to "convert" this call to the one for the group, - // including the try_match part. Semantically, we want to achieve the - // following: - // - // [try_]match (a, g); - // match_recipe (l, group_recipe); - // - auto df = make_diag_frame ( - [a, &t](const diag_record& dr) - { - if (verb != 0) - dr << info << "while matching group rule to " << diag_do (a, t); - }); + // It feels natural to "convert" this call to the one for the group, + // including the try_match part. Semantically, we want to achieve the + // following: + // + // [try_]match (a, g); + // match_recipe (l, group_recipe); + // + auto df = make_diag_frame ( + [a, &t](const diag_record& dr) + { + if (verb != 0) + 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, nullptr, try_match)); - if (r.first) - { - if (r.second != target_state::failed) + if (r.first) { - match_inc_dependents (a, g); - match_recipe (l, group_recipe); + if (r.second != target_state::failed) + { + match_inc_dependents (a, g); + match_recipe (l, group_recipe); + } } - } - else - l.offset = target::offset_tried; + else + l.offset = target::offset_tried; - return r; // Group state (must be consistent with matched_state()). - } + return r; // Group state (must be consistent with matched_state()). + } - try - { // Continue from where the target has been left off. // switch (l.offset) |