summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/HsVersions.h5
-rw-r--r--compiler/basicTypes/Var.lhs2
-rw-r--r--compiler/codeGen/CgCon.lhs4
-rw-r--r--compiler/codeGen/CgUtils.hs2
-rw-r--r--compiler/codeGen/CodeGen.lhs3
-rw-r--r--compiler/coreSyn/CoreLint.lhs6
-rw-r--r--compiler/main/CmdLineParser.hs4
-rw-r--r--compiler/main/GHC.hs2
-rw-r--r--compiler/nativeGen/RegAllocLinear.hs10
-rw-r--r--compiler/specialise/SpecConstr.lhs2
-rw-r--r--compiler/stgSyn/CoreToStg.lhs4
-rw-r--r--compiler/typecheck/TcGadt.lhs5
12 files changed, 9 insertions, 40 deletions
diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h
index fb47f7cba5..a53fb4bf35 100644
--- a/compiler/HsVersions.h
+++ b/compiler/HsVersions.h
@@ -48,8 +48,9 @@ name = Util.global (value) :: IORef (ty); \
#define ASSERT(e) if False && (not (e)) then panic "ASSERT" else
#define ASSERT2(e,msg) if False && (not (e)) then pprPanic "ASSERT2" (msg) else
#define ASSERTM(e) do { let { _mbool = (e) } }
-#define ASSERTM2(e,msg) do { let { _mbool = (e) }; when False (panic "ASSERTM2") }
-#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
+#define ASSERTM2(e,msg) do { let { _mbool = (e) }; if False then panic "ASSERTM2" else return () }
+#define WARN(e,msg) if False && (e) then pprPanic "WARN" (msg) else
#endif
-- This #ifndef lets us switch off the "import FastString"
diff --git a/compiler/basicTypes/Var.lhs b/compiler/basicTypes/Var.lhs
index 2f4edd300f..4b58a328c9 100644
--- a/compiler/basicTypes/Var.lhs
+++ b/compiler/basicTypes/Var.lhs
@@ -47,9 +47,7 @@ import {-# SOURCE #-} TypeRep( Type, Kind )
import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails )
import {-# SOURCE #-} IdInfo( GlobalIdDetails, notGlobalId,
IdInfo, seqIdInfo )
-#ifdef DEBUG
import {-# SOURCE #-} TypeRep( isCoercionKind )
-#endif
import Name hiding (varName)
import Unique
diff --git a/compiler/codeGen/CgCon.lhs b/compiler/codeGen/CgCon.lhs
index bf4cf3d9e7..711c633fd8 100644
--- a/compiler/codeGen/CgCon.lhs
+++ b/compiler/codeGen/CgCon.lhs
@@ -51,9 +51,7 @@ import Type
import PrelInfo
import Outputable
import ListSetOps
-#ifdef DEBUG
-import Util ( lengthIs )
-#endif
+import Util
\end{code}
diff --git a/compiler/codeGen/CgUtils.hs b/compiler/codeGen/CgUtils.hs
index 7101a4d5b2..260248d419 100644
--- a/compiler/codeGen/CgUtils.hs
+++ b/compiler/codeGen/CgUtils.hs
@@ -74,9 +74,7 @@ import Util
import DynFlags
import FastString
import PackageConfig
-#ifdef DEBUG
import Outputable
-#endif
import Data.Char
import Data.Bits
diff --git a/compiler/codeGen/CodeGen.lhs b/compiler/codeGen/CodeGen.lhs
index a53ff49621..4221342d4f 100644
--- a/compiler/codeGen/CodeGen.lhs
+++ b/compiler/codeGen/CodeGen.lhs
@@ -54,10 +54,7 @@ import OccName
import TyCon
import Module
import ErrUtils
-
-#ifdef DEBUG
import Panic
-#endif
\end{code}
\begin{code}
diff --git a/compiler/coreSyn/CoreLint.lhs b/compiler/coreSyn/CoreLint.lhs
index c4c48a7dd3..07e1284b7e 100644
--- a/compiler/coreSyn/CoreLint.lhs
+++ b/compiler/coreSyn/CoreLint.lhs
@@ -44,11 +44,7 @@ import BasicTypes
import StaticFlags
import DynFlags
import Outputable
-
-#ifdef DEBUG
-import Util ( notNull )
-#endif
-
+import Util
import Data.Maybe
\end{code}
diff --git a/compiler/main/CmdLineParser.hs b/compiler/main/CmdLineParser.hs
index 148dbe8e32..3373143ed3 100644
--- a/compiler/main/CmdLineParser.hs
+++ b/compiler/main/CmdLineParser.hs
@@ -24,9 +24,7 @@ module CmdLineParser (
#include "HsVersions.h"
import Util ( maybePrefixMatch, notNull, removeSpaces )
-#ifdef DEBUG
-import Panic ( assertPanic )
-#endif
+import Panic
data OptKind m -- Suppose the flag is -f
= NoArg (m ()) -- -f all by itself
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 1656e1ccbc..f1c7b88684 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -562,10 +562,8 @@ load2 s@(Session ref) how_much mod_graph = do
-- (see msDeps)
let all_home_mods = [ms_mod_name s
| s <- mod_graph, not (isBootSummary s)]
-#ifdef DEBUG
bad_boot_mods = [s | s <- mod_graph, isBootSummary s,
not (ms_mod_name s `elem` all_home_mods)]
-#endif
ASSERT( null bad_boot_mods ) return ()
-- mg2_with_srcimps drops the hi-boot nodes, returning a
diff --git a/compiler/nativeGen/RegAllocLinear.hs b/compiler/nativeGen/RegAllocLinear.hs
index 968b3998bf..7c7690c798 100644
--- a/compiler/nativeGen/RegAllocLinear.hs
+++ b/compiler/nativeGen/RegAllocLinear.hs
@@ -102,11 +102,9 @@ import UniqSupply
import Outputable
import State
-#ifndef DEBUG
-import Data.Maybe ( fromJust )
-#endif
-import Data.List ( nub, partition, foldl')
-import Control.Monad ( when )
+import Data.Maybe
+import Data.List
+import Control.Monad
import Data.Word
import Data.Bits
@@ -293,10 +291,8 @@ save it in a spill location, but mark it as InBoth because the current
instruction might still want to read it.
-}
-#ifdef DEBUG
instance Outputable Loc where
ppr l = text (show l)
-#endif
-- | Do register allocation on some basic blocks.
diff --git a/compiler/specialise/SpecConstr.lhs b/compiler/specialise/SpecConstr.lhs
index 21bca945d2..256674b4c4 100644
--- a/compiler/specialise/SpecConstr.lhs
+++ b/compiler/specialise/SpecConstr.lhs
@@ -1249,12 +1249,10 @@ samePat (vs1, as1) (vs2, as2)
same e1 e2 = WARN( bad e1 || bad e2, ppr e1 $$ ppr e2)
False -- Let, lambda, case should not occur
-#ifdef DEBUG
bad (Case {}) = True
bad (Let {}) = True
bad (Lam {}) = True
bad other = False
-#endif
\end{code}
Note [Ignore type differences]
diff --git a/compiler/stgSyn/CoreToStg.lhs b/compiler/stgSyn/CoreToStg.lhs
index aca1f868f7..ddbc632d5c 100644
--- a/compiler/stgSyn/CoreToStg.lhs
+++ b/compiler/stgSyn/CoreToStg.lhs
@@ -215,7 +215,6 @@ coreTopBindToStg this_pkg env body_fvs (Rec pairs)
ASSERT2(consistentCafInfo (head binders) bind, ppr binders)
(env', fvs' `unionFVInfo` body_fvs, bind)
-#ifdef DEBUG
-- Assertion helper: this checks that the CafInfo on the Id matches
-- what CoreToStg has figured out about the binding's SRT. The
-- CafInfo will be exact in all cases except when CorePrep has
@@ -230,7 +229,6 @@ consistentCafInfo id bind
exact = id_marked_caffy == binding_is_caffy
id_marked_caffy = mayHaveCafRefs (idCafInfo id)
binding_is_caffy = stgBindHasCafRefs bind
-#endif
\end{code}
\begin{code}
@@ -1074,7 +1072,6 @@ plusFVInfo (id1,hb1,info1) (id2,hb2,info2)
= ASSERT (id1 == id2 && hb1 `check_eq_how_bound` hb2)
(id1, hb1, combineStgBinderInfo info1 info2)
-#ifdef DEBUG
-- The HowBound info for a variable in the FVInfo should be consistent
check_eq_how_bound ImportBound ImportBound = True
check_eq_how_bound LambdaBound LambdaBound = True
@@ -1084,7 +1081,6 @@ check_eq_how_bound hb1 hb2 = False
check_eq_li (NestedLet _) (NestedLet _) = True
check_eq_li TopLet TopLet = True
check_eq_li li1 li2 = False
-#endif
\end{code}
Misc.
diff --git a/compiler/typecheck/TcGadt.lhs b/compiler/typecheck/TcGadt.lhs
index 6650bde180..b556e89e32 100644
--- a/compiler/typecheck/TcGadt.lhs
+++ b/compiler/typecheck/TcGadt.lhs
@@ -39,11 +39,8 @@ import Maybes
import Control.Monad
import Outputable
import TcType
-
-#ifdef DEBUG
import Unique
import UniqFM
-#endif
\end{code}
@@ -261,7 +258,6 @@ tryToBind tv_set tv | tv `elemVarSet` tv_set = BindMe
%************************************************************************
\begin{code}
-#ifdef DEBUG
badReftElts :: InternalReft -> [(Unique, (Coercion,Type))]
-- Return the BAD elements of the refinement
-- Should be empty; used in asserions only
@@ -274,7 +270,6 @@ badReftElts env
| otherwise = False
where
(ty1,ty2) = coercionKind co
-#endif
emptyInternalReft :: InternalReft
emptyInternalReft = emptyVarEnv