summaryrefslogtreecommitdiff
path: root/compiler/HsVersions.h
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-06-05 00:52:01 +0100
committerIan Lynagh <igloo@earth.li>2012-06-05 03:11:23 +0100
commit243439e6e77eca548a6583722792d6b96e3f6bcd (patch)
tree82a7852a205a53f3acfcd5d345a43cb7e284108f /compiler/HsVersions.h
parent50fddb2b046605315f903d9b744780497cc978de (diff)
downloadhaskell-243439e6e77eca548a6583722792d6b96e3f6bcd.tar.gz
Change how macros like ASSERT are defined
By using Haskell's debugIsOn rather than CPP's "#ifdef DEBUG", we don't need to kludge things to keep the warning checker happy etc.
Diffstat (limited to 'compiler/HsVersions.h')
-rw-r--r--compiler/HsVersions.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h
index d85234784a..9a83af9768 100644
--- a/compiler/HsVersions.h
+++ b/compiler/HsVersions.h
@@ -46,18 +46,9 @@ name :: IORef (ty); \
name = Util.globalM (value);
#endif
-#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 ASSERT(e) if debugIsOn && not (e) then (assertPanic __FILE__ __LINE__) else
+#define ASSERT2(e,msg) if debugIsOn && not (e) then (assertPprPanic __FILE__ __LINE__ (msg)) else
#define WARN( e, msg ) (warnPprTrace (e) __FILE__ __LINE__ (msg)) $
-#else
--- We have to actually use all the variables we are given or we may get
--- unused variable warnings when DEBUG is off.
-#define ASSERT(e) if False && (not (e)) then panic "ASSERT" else
-#define ASSERT2(e,msg) if False && (const False (e,msg)) then pprPanic "ASSERT2" (msg) else
-#define WARN(e,msg) if False && (e) then pprPanic "WARN" (msg) else
--- Here we deliberately don't use when as Control.Monad might not be imported
-#endif
-- Examples: Assuming flagSet :: String -> m Bool
--