about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--subx/003trace.cc5
-rw-r--r--subx/003trace.test.cc2
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.