#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"
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
import PrelInfo
import Outputable
import ListSetOps
-#ifdef DEBUG
-import Util ( lengthIs )
-#endif
+import Util
\end{code}
import DynFlags
import FastString
import PackageConfig
-#ifdef DEBUG
import Outputable
-#endif
import Data.Char
import Data.Bits
import TyCon
import Module
import ErrUtils
-
-#ifdef DEBUG
import Panic
-#endif
\end{code}
\begin{code}
import StaticFlags
import DynFlags
import Outputable
-
-#ifdef DEBUG
-import Util ( notNull )
-#endif
-
+import Util
import Data.Maybe
\end{code}
#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
-- (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
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
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.
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]
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
exact = id_marked_caffy == binding_is_caffy
id_marked_caffy = mayHaveCafRefs (idCafInfo id)
binding_is_caffy = stgBindHasCafRefs bind
-#endif
\end{code}
\begin{code}
= 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
check_eq_li (NestedLet _) (NestedLet _) = True
check_eq_li TopLet TopLet = True
check_eq_li li1 li2 = False
-#endif
\end{code}
Misc.
import Control.Monad
import Outputable
import TcType
-
-#ifdef DEBUG
import Unique
import UniqFM
-#endif
\end{code}
%************************************************************************
\begin{code}
-#ifdef DEBUG
badReftElts :: InternalReft -> [(Unique, (Coercion,Type))]
-- Return the BAD elements of the refinement
-- Should be empty; used in asserions only
| otherwise = False
where
(ty1,ty2) = coercionKind co
-#endif
emptyInternalReft :: InternalReft
emptyInternalReft = emptyVarEnv