diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-08-05 08:30:25 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-08-05 08:30:48 -0700 |
commit | 6bb2e7118094d93823c25daf6de3fd9134649eef (patch) | |
tree | 5dc7d4438912366e5e1a8819420007404a1dbd37 | |
parent | b817d4bd2229718ee1a5649280d63a06812f8123 (diff) | |
download | mu-6bb2e7118094d93823c25daf6de3fd9134649eef.tar.gz |
4487
Draft attempt at cleaning up warnings, but this isn't quite right. We still emit warnings for every level-1 scenario, and hiding for each of them seems painful. Even if we do that, level-2 scenarios would want to hide level-3 and over warnings, but *not* level-1 warnings. So we need a cardinal number rather than booleans.
-rw-r--r-- | subx/003trace.cc | 5 | ||||
-rw-r--r-- | subx/003trace.test.cc | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/subx/003trace.cc b/subx/003trace.cc index 6d04b6b2..61526371 100644 --- a/subx/003trace.cc +++ b/subx/003trace.cc @@ -149,7 +149,8 @@ void trace_stream::newline() { string curr_contents = curr_stream->str(); if (!curr_contents.empty()) { past_lines.push_back(trace_line(curr_depth, trim(curr_label), curr_contents)); // preserve indent in contents - if ((!Hide_errors && curr_depth <= Warn_depth) + if ((!Hide_errors && curr_depth == Error_depth) + || (!Hide_warnings && !Hide_errors && curr_depth == Warn_depth) || Dump_trace || (!Dump_label.empty() && curr_label == Dump_label)) cerr << curr_label << ": " << curr_contents << '\n'; @@ -176,10 +177,12 @@ int Trace_errors = 0; // used only when Trace_stream is NULL :(before "End Globals") bool Hide_errors = false; // if set, don't print even error trace lines to screen +bool Hide_warnings = false; // if set, don't print warnings to screen bool Dump_trace = false; // if set, print trace lines to screen string Dump_label = ""; // if set, print trace lines matching a single label to screen :(before "End Reset") Hide_errors = false; +Hide_warnings = false; Dump_trace = false; Dump_label = ""; diff --git a/subx/003trace.test.cc b/subx/003trace.test.cc index 67b4c345..85751a4a 100644 --- a/subx/003trace.test.cc +++ b/subx/003trace.test.cc @@ -66,6 +66,8 @@ void test_trace_count_ignores_trailing_whitespace() { // pending: readable_contents() adds newline if necessary. // pending: raise also prints to stderr. // pending: raise doesn't print to stderr if Hide_errors is set. +// pending: warn doesn't print to stderr if Hide_errors is set. +// pending: warn doesn't print to stderr if Hide_warnings is set. // pending: raise doesn't have to be saved if Hide_errors is set, just printed. // pending: raise prints to stderr if Trace_stream is NULL. // pending: raise prints to stderr if Trace_stream is NULL even if Hide_errors is set. |