about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-08-04 16:59:52 -0700
committerKartik Agaram <vc@akkartik.com>2018-08-04 16:59:52 -0700
commit6cabcefe67d2cd0583b556129fe3d8c89cf0fcb8 (patch)
tree27863e0b6af0bfaa275577a82706805b9f444574
parent1837c61635e47143188732454c40f899fd5775ba (diff)
downloadmu-6cabcefe67d2cd0583b556129fe3d8c89cf0fcb8.tar.gz
4477
-rw-r--r--subx/003trace.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/subx/003trace.cc b/subx/003trace.cc
index f5969de6..84af9a4a 100644
--- a/subx/003trace.cc
+++ b/subx/003trace.cc
@@ -113,6 +113,7 @@ atexit(cleanup_main);
 // compilation units. So no extern linkage.
 const int Max_depth = 9999;
 const int Error_depth = 0;  // definitely always print errors
+const int Warn_depth = 1;
 
 struct trace_stream {
   vector<trace_line> past_lines;
@@ -192,8 +193,9 @@ int Trace_errors = 0;  // used only when Trace_stream is NULL
 #define dbg trace(0, "a")
 #define DUMP(label)  if (Trace_stream) cerr << Trace_stream->readable_contents(label);
 
-// Errors are a special layer.
+// Errors and warnings are special layers.
 #define raise  (!Trace_stream ? (++Trace_errors,cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error"))
+#define warn (!Trace_stream ? (++Trace_errors,cerr) /*do print*/ : Trace_stream->stream(Warn_depth, "warn"))
 // If we aren't yet sure how to deal with some corner case, use assert_for_now
 // to indicate that it isn't an inviolable invariant.
 #define assert_for_now assert