From 3bc0fc4c4496c345c79734dcd6dc56d44119aebf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 8 Nov 2022 10:34:22 +0200 Subject: Make process exit diagnostics consistent In particular, we now always print error message on non-0 exit except in cases where such exit is ignored. --- libbuild2/cc/compile-rule.cxx | 8 ++++---- libbuild2/cc/gcc.cxx | 2 +- libbuild2/cc/guess.cxx | 4 ++-- libbuild2/cc/link-rule.cxx | 9 ++++++--- libbuild2/cc/msvc.cxx | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) (limited to 'libbuild2/cc') diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index e5ff914..2534058 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -4769,7 +4769,7 @@ namespace build2 throw failed (); } else - run_finish (args, pr); + run_finish (args, pr, 2 /* verbosity */); } } catch (const process_error& e) @@ -5172,7 +5172,7 @@ namespace build2 info << "then run failing command to display compiler diagnostics"; } else - run_finish (args, pr); // Throws. + run_finish (args, pr, 2 /* verbosity */); // Throws. } catch (const process_error& e) { @@ -7382,7 +7382,7 @@ namespace build2 args.push_back (nullptr); } - run_finish (dbuf, args, pr); + run_finish (dbuf, args, pr, 1 /* verbosity */); } catch (const process_error& e) { @@ -7439,7 +7439,7 @@ namespace build2 env.empty () ? nullptr : env.data ()); dbuf.read (); - run_finish (dbuf, args, pr); + run_finish (dbuf, args, pr, 1 /* verbosity */); } catch (const process_error& e) { diff --git a/libbuild2/cc/gcc.cxx b/libbuild2/cc/gcc.cxx index 6b24516..0045c27 100644 --- a/libbuild2/cc/gcc.cxx +++ b/libbuild2/cc/gcc.cxx @@ -320,7 +320,7 @@ namespace build2 // by that and let run_finish() deal with it. } - run_finish (args, pr); + run_finish (args, pr, 2 /* verbosity */); if (l.empty ()) fail << "unable to extract " << x_lang << " compiler system library " diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx index 5e8dbbc..a0d7ee4 100644 --- a/libbuild2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -222,7 +222,7 @@ namespace build2 // that. } - if (!run_finish_code (args.data (), pr, l)) + if (!run_finish_code (args.data (), pr, l, 2 /* verbosity */)) r = "none"; if (r.empty ()) @@ -2331,7 +2331,7 @@ namespace build2 // that. } - if (!run_finish_code (args.data (), pr, l)) + if (!run_finish_code (args.data (), pr, l, 2 /* verbosity */)) fail << "unable to extract MSVC information from " << xp; if (const char* w = ( diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index af04ac7..c2ba8e7 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -3992,7 +3992,7 @@ namespace build2 } #endif - if (verb > 2) + if (verb >= 3) print_process (args); // Remove the target file if any of the subsequent (after the linker) @@ -4042,11 +4042,13 @@ namespace build2 #ifdef _WIN32 // Keep the options file if we have shown it. // - if (!e && verb > 2) + if (!e && verb >= 3) trm.cancel (); #endif - dbuf.close (oargs.empty () ? args : oargs, *pr.exit); + dbuf.close (oargs.empty () ? args : oargs, + *pr.exit, + 1 /* verbosity */); if (!e) throw failed (); @@ -4115,6 +4117,7 @@ namespace build2 run (dbuf, rl, args, + 1 /* finish_verbosity */, env_ptrs.empty () ? nullptr : env_ptrs.data ()); } } diff --git a/libbuild2/cc/msvc.cxx b/libbuild2/cc/msvc.cxx index 3165602..8b9c05b 100644 --- a/libbuild2/cc/msvc.cxx +++ b/libbuild2/cc/msvc.cxx @@ -491,7 +491,7 @@ namespace build2 io = true; } - if (!run_finish_code (args, pr, s) || io) + if (!run_finish_code (args, pr, s, 2 /* verbosity */) || io) { diag_record dr; dr << warn << "unable to detect " << l << " library type, ignoring" << -- cgit v1.1