From feecde4aaa0c3bf6644ddeec0dfd101d3cf6fd74 Mon Sep 17 00:00:00 2001 From: David Jones Date: Thu, 19 Apr 2007 11:32:08 +0100 Subject: [PATCH] Added diag and diag_writef Copied from Perforce Change: 162160 ServerID: perforce.ravenbrook.com --- mps/code/mpm.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mps/code/mpm.h b/mps/code/mpm.h index edd4a2e5dbe..2279b7ed2b7 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -945,6 +945,28 @@ extern void StackProbe(Size depth); #endif +/* Diagnostics */ + +Bool DiagIsOn(void); + +#define DIAG_STREAM (DiagStream()) + +#define DIAG(s) BEGIN \ + s \ + END + +/* + * Note the macro argument args should have parens around it (in the + * invocation); it is a variable number of arguments that we pass + * to another function. + * That makes this macro unclean in all sorts of ways. + */ +#define DIAG_WRITEF(stream, args) DIAG( \ + if(DiagIsOn()) { \ + WriteF a; \ + } \ +) + #endif /* mpm_h */