Commit 243439e6 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

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.
parent 50fddb2b
......@@ -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
--
......
......@@ -126,7 +126,7 @@ import Outputable
import Unique
import UniqSupply
import FastString
import Util( count )
import Util
import StaticFlags
-- infixl so you can say (id `set` a `set` b)
......
......@@ -62,6 +62,8 @@ import BasicTypes
import Binary
import Constants
import UniqFM
import Util
import Data.Int
import Data.Ratio
import Data.Word
......
......@@ -71,6 +71,7 @@ import FastTypes
import FastString
import Outputable
-- import StaticFlags
import Util
#if defined(__GLASGOW_HASKELL__)
--just for implementing a fast [0,61) -> Char function
......
......@@ -32,7 +32,7 @@ import Constants
import Digraph
import qualified Prelude as P
import Prelude hiding (succ)
import Util (sortLe)
import Util
import BlockId
import Bitmap
......
......@@ -27,6 +27,8 @@ import Platform
import StaticFlags
import UniqSupply
import MonadUtils
import Util
import Data.Bits
import Data.Word
......
......@@ -83,6 +83,7 @@ import OptimizationFuel as F
import Unique
import UniqSupply
import Constants( wORD_SIZE, tAG_MASK )
import Util
import Data.Word
import Data.Maybe
......
......@@ -42,6 +42,7 @@ import SMRep (ByteOff)
import StaticFlags
import Unique
import UniqSupply
import Util
#include "HsVersions.h"
......
......@@ -22,6 +22,7 @@ import Control.Monad
import StaticFlags (opt_Fuel)
import UniqSupply
import Panic
import Util
import Compiler.Hoopl
import Compiler.Hoopl.GHC (getFuel, setFuel)
......
......@@ -77,6 +77,7 @@ import VarEnv
import OrdList
import Unique
import UniqSupply
import Util
import Outputable
import Control.Monad
......
......@@ -43,6 +43,7 @@ import StgSyn
import PrimOp
import Outputable
import StaticFlags
import Util
import Control.Monad
import Data.Maybe
......
......@@ -96,6 +96,7 @@ import Outputable
import FastString
import Constants
import DynFlags
import Util
\end{code}
......
......@@ -45,6 +45,7 @@ import TyCon
import Module
import ErrUtils
import Panic
import Util
codeGen :: DynFlags
-> Module -- Module we are compiling
......
......@@ -46,6 +46,7 @@ import TyCon
import Module
import ErrUtils
import Outputable
import Util
codeGen :: DynFlags
-> Module
......
......@@ -90,6 +90,7 @@ import Outputable
import Platform
import Constants
import DynFlags
import Util
-----------------------------------------------------------------------------
-- Representations
......
......@@ -41,7 +41,7 @@ import PrelInfo
import Outputable
import Platform
import StaticFlags
import Util ( lengthIs )
import Util
import Control.Monad
import Data.Char
......
......@@ -44,6 +44,7 @@ import Module
import FastString( mkFastString, fsLit )
import Constants
import DynFlags
import Util
-----------------------------------------------------------
-- Initialise dynamic heap objects
......
......@@ -43,6 +43,7 @@ import Module
import FastString
import Outputable
import StaticFlags
import Util
------------------------------------------------------------------------
-- Primitive operations and foreign calls
......
......@@ -85,7 +85,7 @@ import Outputable
import FastString
import UniqSupply
import BasicTypes
import Util ( notNull, zipEqual, sortLe )
import Util
import Pair
import Constants
......
......@@ -49,6 +49,7 @@ import PrelNames
import VarSet
import Constants
import Outputable
import Util
\end{code}
Desugaring of @ccall@s consists of adding some state manipulation,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment