Skip to content
Snippets Groups Projects
Commit 6c43076c authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

[project @ 1999-01-07 12:47:34 by simonpj]

Add debug macro WARN
parent 033f9d00
No related merge requests found
......@@ -15,9 +15,11 @@ you will screw up the layout where they are used in case expressions!
#ifdef DEBUG
#define ASSERT(e) if (not (e)) then (assertPanic __FILE__ __LINE__) else
#define ASSERT2(e,msg) if (not (e)) then (assertPprPanic __FILE__ __LINE__ (msg)) else
#define WARN( e, msg ) (warnPprTrace (e) __FILE__ __LINE__ (msg))
#else
#define ASSERT(e)
#define ASSERT2(e,msg)
#define WARN(e,msg)
#endif
#if __STDC__
......
......@@ -402,4 +402,12 @@ assertPprPanic file line msg
text file,
text "line", int line],
msg]
warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a
warnPprTrace False file line msg x = x
warnPprTrace True file line msg x
= trace (show (doc PprDebug)) x
where
doc = sep [hsep [text "WARNING: file", text file, text "line", int line],
msg]
\end{code}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment