From af5ed67002b7031e1735968674bacb5ee868165f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 30 Aug 2019 16:03:07 +0200 Subject: Cutoff diagnostics stack when switching to nested context --- libbuild2/module.cxx | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'libbuild2/module.cxx') diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx index 5cfb1ec..b5914cd 100644 --- a/libbuild2/module.cxx +++ b/libbuild2/module.cxx @@ -209,30 +209,42 @@ namespace build2 action_targets tgs; action a (perform_id, update_id); - // Note that for now we suppress progress since it would clash with - // the progress of what we are already doing (maybe in the future we - // can do save/restore but then we would need some sort of diagnostics - // that we have switched to another task). - // - mo_perform.search ({}, /* parameters */ - rs, /* root scope */ - rs, /* base scope */ - path (), /* buildfile */ - rs.find_target_key (lr.first, loc), - loc, - tgs); - - mo_perform.match ({}, /* parameters */ - a, - tgs, - 1, /* diag (failures only) */ - false /* progress */); - - mo_perform.execute ({}, /* parameters */ - a, - tgs, - 1, /* diag (failures only) */ - false /* progress */); + { + // Cutoff the existing diagnostics stack and push our own entry. + // + diag_frame::stack_guard diag_cutoff (nullptr); + + auto df = make_diag_frame ( + [&loc, &mod](const diag_record& dr) + { + dr << info (loc) << "while loading build system module " << mod; + }); + + // Note that for now we suppress progress since it would clash with + // the progress of what we are already doing (maybe in the future we + // can do save/restore but then we would need some sort of + // diagnostics that we have switched to another task). + // + mo_perform.search ({}, /* parameters */ + rs, /* root scope */ + rs, /* base scope */ + path (), /* buildfile */ + rs.find_target_key (lr.first, loc), + loc, + tgs); + + mo_perform.match ({}, /* parameters */ + a, + tgs, + 1, /* diag (failures only) */ + false /* progress */); + + mo_perform.execute ({}, /* parameters */ + a, + tgs, + 1, /* diag (failures only) */ + false /* progress */); + } assert (tgs.size () == 1); const target& l (tgs[0].as_target ()); -- cgit v1.1