From 2ad6aa134d9e8e755c8c738d0b51d72b0851c212 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 24 Jun 2019 11:25:05 +0200 Subject: Constrain access to options to build system driver main() only --- build2/diagnostics.cxx | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'build2/diagnostics.cxx') diff --git a/build2/diagnostics.cxx b/build2/diagnostics.cxx index 3eb1e9a..ac95c64 100644 --- a/build2/diagnostics.cxx +++ b/build2/diagnostics.cxx @@ -12,6 +12,28 @@ using namespace std; namespace build2 { + // Diagnostics state (verbosity level, progress, etc). Keep disabled until + // set from options. + // + uint16_t verb = 0; + + optional diag_progress_option; + + bool diag_no_line = false; + bool diag_no_column = false; + + bool stderr_term = false; + + void + init_diag (uint16_t v, optional p, bool nl, bool nc, bool st) + { + verb = v; + diag_progress_option = p; + diag_no_line = nl; + diag_no_column = nc; + stderr_term = st; + } + // Stream verbosity. // const int stream_verb_index = ostream::xalloc (); @@ -29,10 +51,6 @@ namespace build2 r << butl::process_args {args, n}; } - // Diagnostics verbosity level. - // - uint16_t verb = 0; // Keep disabled until set from options. - // Diagnostics stack. // #ifdef __cpp_thread_local @@ -69,13 +87,13 @@ namespace build2 { r << *loc_.file << ':'; - if (!ops.no_line ()) + if (!diag_no_line) { if (loc_.line != 0) { r << loc_.line << ':'; - if (!ops.no_column ()) + if (!diag_no_column) { if (loc_.column != 0) r << loc_.column << ':'; -- cgit v1.1