diff --git a/ghc/compiler/HsVersions.h b/ghc/compiler/HsVersions.h
index cd5c2207b5b9221d7028c314c6ab9ad5386de397..c5663b12dcf142e5d64d32611ffcb466b0f0ba1d 100644
--- a/ghc/compiler/HsVersions.h
+++ b/ghc/compiler/HsVersions.h
@@ -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__
diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs
index 0e55176aa2a7c69193e436a101f84259aef38ad1..15a2acf83a8a3a3186a130645b0458de1035c40d 100644
--- a/ghc/compiler/utils/Outputable.lhs
+++ b/ghc/compiler/utils/Outputable.lhs
@@ -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}