From 87201b1c10769606214e27e64e88af5b835cb56f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Sep 2022 13:08:30 +0200 Subject: Fix assert after cycle detection in ad hoc groups --- libbuild2/algorithm.cxx | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'libbuild2') 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 r (match_impl (a, g, 0, nullptr, try_match)); + pair 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) -- cgit v1.1