Commit d8ee2b06 authored by thoughtpolice's avatar thoughtpolice

Fix many ASSERT uses under Clang.

Clang doesn't like whitespace between macro and arguments.
Signed-off-by: thoughtpolice's avatarAustin Seipp <aseipp@pobox.com>
parent 232737a0
......@@ -888,9 +888,9 @@ dataConInstArgTys :: DataCon -- ^ A datacon with no existentials or equality con
-> [Type]
dataConInstArgTys dc@(MkData {dcUnivTyVars = univ_tvs, dcEqSpec = eq_spec,
dcExTyVars = ex_tvs}) inst_tys
= ASSERT2 ( length univ_tvs == length inst_tys
, ptext (sLit "dataConInstArgTys") <+> ppr dc $$ ppr univ_tvs $$ ppr inst_tys)
ASSERT2 ( null ex_tvs && null eq_spec, ppr dc )
= ASSERT2( length univ_tvs == length inst_tys
, ptext (sLit "dataConInstArgTys") <+> ppr dc $$ ppr univ_tvs $$ ppr inst_tys)
ASSERT2( null ex_tvs && null eq_spec, ppr dc )
map (substTyWith univ_tvs inst_tys) (dataConRepArgTys dc)
-- | Returns just the instantiated /value/ argument types of a 'DataCon',
......
......@@ -424,7 +424,7 @@ ofBlockMap entry bodyMap = CmmGraph {g_entry=entry, g_graph=GMany NothingO bodyM
insertBlock :: CmmBlock -> BlockEnv CmmBlock -> BlockEnv CmmBlock
insertBlock block map =
ASSERT (isNothing $ mapLookup id map)
ASSERT(isNothing $ mapLookup id map)
mapInsert id block map
where id = entryLabel block
......
......@@ -519,7 +519,7 @@ getCallMethod _ _name _ (LFUnknown True) _n_args
= SlowCall -- might be a function
getCallMethod _ name _ (LFUnknown False) n_args
= ASSERT2 ( n_args == 0, ppr name <+> ppr n_args )
= ASSERT2( n_args == 0, ppr name <+> ppr n_args )
EnterIt -- Not a function
getCallMethod _ _name _ LFBlackHole _n_args
......
......@@ -156,7 +156,7 @@ assembleBCO dflags (ProtoBCO nm instrs bitmap bsize arity _origin _malloced) = d
(final_insns, final_lits, final_ptrs) <- flip execStateT initial_state $ runAsm dflags long_jumps env asm
-- precomputed size should be equal to final size
ASSERT (n_insns == sizeSS final_insns) return ()
ASSERT(n_insns == sizeSS final_insns) return ()
let asm_insns = ssElts final_insns
barr a = case a of UArray _lo _hi _n b -> b
......
......@@ -115,14 +115,14 @@ dataConInfoPtrToName x = do
-- Warning: this code assumes that the string is well formed.
parse :: [Word8] -> ([Word8], [Word8], [Word8])
parse input
= ASSERT (all (>0) (map length [pkg, mod, occ])) (pkg, mod, occ)
= ASSERT(all (>0) (map length [pkg, mod, occ])) (pkg, mod, occ)
where
dot = fromIntegral (ord '.')
(pkg, rest1) = break (== fromIntegral (ord ':')) input
(mod, occ)
= (concat $ intersperse [dot] $ reverse modWords, occWord)
where
(modWords, occWord) = ASSERT (length rest1 > 0) (parseModOcc [] (tail rest1))
(modWords, occWord) = ASSERT(length rest1 > 0) (parseModOcc [] (tail rest1))
parseModOcc :: [[Word8]] -> [Word8] -> ([[Word8]], [Word8])
-- We only look for dots if str could start with a module name,
-- i.e. if it starts with an upper case character.
......
......@@ -636,7 +636,7 @@ getLinkDeps hsc_env hpt pls replace_osuf span mods
return lnk
adjust_ul new_osuf (DotO file) = do
MASSERT (osuf `isSuffixOf` file)
MASSERT(osuf `isSuffixOf` file)
let file_base = reverse (drop (length osuf + 1) (reverse file))
new_file = file_base <.> new_osuf
ok <- doesFileExist new_file
......@@ -895,7 +895,7 @@ linkSomeBCOs dflags toplevs_only ie ce_in ul_bcos
else ce_all_additions
ce_out = -- make sure we're not inserting duplicate names into the
-- closure environment, which leads to trouble.
ASSERT (all (not . (`elemNameEnv` ce_in)) (map fst ce_additions))
ASSERT(all (not . (`elemNameEnv` ce_in)) (map fst ce_additions))
extendClosureEnv ce_in ce_additions
return (ce_out, hvals)
......
......@@ -1264,7 +1264,7 @@ unlessM condM acc = condM >>= \c -> unless c acc
-- Strict application of f at index i
appArr :: Ix i => (e -> a) -> Array i e -> Int -> a
appArr f a@(Array _ _ _ ptrs#) i@(I# i#)
= ASSERT2 (i < length(elems a), ppr(length$ elems a, i))
= ASSERT2(i < length(elems a), ppr(length$ elems a, i))
case indexArray# ptrs# i# of
(# e #) -> f e
......
......@@ -169,7 +169,7 @@ compileOne' m_tc_result mHscMessage
case e of
Left iface ->
do details <- genModDetails hsc_env iface
MASSERT (isJust maybe_old_linkable)
MASSERT(isJust maybe_old_linkable)
return (HomeModInfo{ hm_details = details,
hm_iface = iface,
hm_linkable = maybe_old_linkable })
......
......@@ -332,8 +332,7 @@ load how_much = do
liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1
-- there should be no Nothings where linkables should be, now
ASSERT(all (isJust.hm_linkable)
(eltsUFM (hsc_HPT hsc_env))) do
ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do
-- Link everything together
linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4
......
......@@ -913,7 +913,7 @@ genCCall' _ _ (PrimTarget MO_Touch) _ _
= return $ nilOL
genCCall' dflags gcp target dest_regs args0
= ASSERT (not $ any (`elem` [II16]) $ map cmmTypeSize argReps)
= ASSERT(not $ any (`elem` [II16]) $ map cmmTypeSize argReps)
-- we rely on argument promotion in the codeGen
do
(finalStack,passArgumentsCode,usedRegs) <- passArguments
......
......@@ -1834,7 +1834,7 @@ genCCall32' dflags target dest_regs args = do
use_sse2 <- sse2Enabled
push_codes <- mapM (push_arg use_sse2) (reverse prom_args)
delta <- getDeltaNat
MASSERT (delta == delta0 - tot_arg_size)
MASSERT(delta == delta0 - tot_arg_size)
-- deal with static vs dynamic call targets
(callinsns,cconv) <-
......
......@@ -721,7 +721,7 @@ tagToEnumRule = do
let tag = fromInteger i
correct_tag dc = (dataConTag dc - fIRST_TAG) == tag
(dc:rest) <- return $ filter correct_tag (tyConDataCons_maybe tycon `orElse` [])
ASSERT (null rest) return ()
ASSERT(null rest) return ()
return $ mkTyApps (Var (dataConWorkId dc)) tc_args
-- See Note [tagToEnum#]
......
......@@ -815,7 +815,7 @@ lookupQualifiedName rdr_name
| avail <- mi_exports iface,
name <- availNames avail,
nameOccName name == occ ] of
(n:ns) -> ASSERT (null ns) return (Just n)
(n:ns) -> ASSERT(null ns) return (Just n)
_ -> do { traceRn (text "lookupQualified" <+> ppr rdr_name)
; return Nothing }
......
......@@ -117,7 +117,7 @@ rnHsKind = rnHsTyKi False
rnHsTyKi :: Bool -> HsDocContext -> HsType RdrName -> RnM (HsType Name, FreeVars)
rnHsTyKi isType doc (HsForAllTy Implicit _ lctxt@(L _ ctxt) ty)
= ASSERT ( isType ) do
= ASSERT( isType ) do
-- Implicit quantifiction in source code (no kinds on tyvars)
-- Given the signature C => T we universally quantify
-- over FV(T) \ {in-scope-tyvars}
......@@ -140,7 +140,7 @@ rnHsTyKi isType doc (HsForAllTy Implicit _ lctxt@(L _ ctxt) ty)
rnForAll doc Implicit forall_kvs (mkHsQTvs tyvar_bndrs) lctxt ty
rnHsTyKi isType doc ty@(HsForAllTy Explicit forall_tyvars lctxt@(L _ ctxt) tau)
= ASSERT ( isType ) do { -- Explicit quantification.
= ASSERT( isType ) do { -- Explicit quantification.
-- Check that the forall'd tyvars are actually
-- mentioned in the type, and produce a warning if not
let (kvs, mentioned) = extractHsTysRdrTyVars (tau:ctxt)
......@@ -157,7 +157,7 @@ rnHsTyKi isType _ (HsTyVar rdr_name)
-- a sensible error message, but we don't want to complain about the dot too
-- Hence the jiggery pokery with ty1
rnHsTyKi isType doc ty@(HsOpTy ty1 (wrapper, L loc op) ty2)
= ASSERT ( isType ) setSrcSpan loc $
= ASSERT( isType ) setSrcSpan loc $
do { ops_ok <- xoptM Opt_TypeOperators
; op' <- if ops_ok
then rnTyVar isType op
......@@ -176,7 +176,7 @@ rnHsTyKi isType doc (HsParTy ty)
; return (HsParTy ty', fvs) }
rnHsTyKi isType doc (HsBangTy b ty)
= ASSERT ( isType )
= ASSERT( isType )
do { (ty', fvs) <- rnLHsType doc ty
; return (HsBangTy b ty', fvs) }
......@@ -206,7 +206,7 @@ rnHsTyKi isType doc listTy@(HsListTy ty)
; return (HsListTy ty', fvs) }
rnHsTyKi isType doc (HsKindSig ty k)
= ASSERT ( isType )
= ASSERT( isType )
do { kind_sigs_ok <- xoptM Opt_KindSignatures
; unless kind_sigs_ok (badSigErr False doc ty)
; (ty', fvs1) <- rnLHsType doc ty
......@@ -214,7 +214,7 @@ rnHsTyKi isType doc (HsKindSig ty k)
; return (HsKindSig ty' k', fvs1 `plusFV` fvs2) }
rnHsTyKi isType doc (HsPArrTy ty)
= ASSERT ( isType )
= ASSERT( isType )
do { (ty', fvs) <- rnLHsType doc ty
; return (HsPArrTy ty', fvs) }
......@@ -250,12 +250,12 @@ rnHsTyKi isType doc (HsEqTy ty1 ty2)
; return (HsEqTy ty1' ty2', fvs1 `plusFV` fvs2) }
rnHsTyKi isType _ (HsSpliceTy sp _ k)
= ASSERT ( isType )
= ASSERT( isType )
do { (sp', fvs) <- rnSplice sp -- ToDo: deal with fvs
; return (HsSpliceTy sp' fvs k, fvs) }
rnHsTyKi isType doc (HsDocTy ty haddock_doc)
= ASSERT ( isType )
= ASSERT( isType )
do { (ty', fvs) <- rnLHsType doc ty
; haddock_doc' <- rnLHsDoc haddock_doc
; return (HsDocTy ty' haddock_doc', fvs) }
......@@ -264,13 +264,13 @@ rnHsTyKi isType doc (HsDocTy ty haddock_doc)
rnHsTyKi _ _ ty@(HsQuasiQuoteTy _) = pprPanic "Can't do quasiquotation without GHCi" (ppr ty)
#else
rnHsTyKi isType doc (HsQuasiQuoteTy qq)
= ASSERT ( isType )
= ASSERT( isType )
do { ty <- runQuasiQuoteType qq
; rnHsType doc (unLoc ty) }
#endif
rnHsTyKi isType _ (HsCoreTy ty)
= ASSERT ( isType )
= ASSERT( isType )
return (HsCoreTy ty, emptyFVs)
-- The emptyFVs probably isn't quite right
-- but I don't think it matters
......
......@@ -1115,7 +1115,7 @@ plusFVInfo :: (Var, HowBound, StgBinderInfo)
-> (Var, HowBound, StgBinderInfo)
-> (Var, HowBound, StgBinderInfo)
plusFVInfo (id1,hb1,info1) (id2,hb2,info2)
= ASSERT (id1 == id2 && hb1 `check_eq_how_bound` hb2)
= ASSERT(id1 == id2 && hb1 `check_eq_how_bound` hb2)
(id1, hb1, combineStgBinderInfo info1 info2)
-- The HowBound info for a variable in the FVInfo should be consistent
......
......@@ -932,7 +932,7 @@ inferConstraints cls inst_tys rep_tc rep_tc_args
= return []
| cls `hasKey` gen1ClassKey -- Gen1 needs Functor
= ASSERT (length rep_tc_tvs > 0) -- See Note [Getting base classes]
= ASSERT(length rep_tc_tvs > 0) -- See Note [Getting base classes]
do { functorClass <- tcLookupClass functorClassName
; return (con_arg_constraints functorClass (get_gen1_constrained_tys last_tv)) }
......
......@@ -233,7 +233,7 @@ tcCoercionKind co = go co
eqVarKind :: EqVar -> Pair Type
eqVarKind cv
| Just (tc, [_kind,ty1,ty2]) <- tcSplitTyConApp_maybe (varType cv)
= ASSERT (tc `hasKey` eqTyConKey)
= ASSERT(tc `hasKey` eqTyConKey)
Pair ty1 ty2
| otherwise = pprPanic "eqVarKind, non coercion variable" (ppr cv <+> dcolon <+> ppr (varType cv))
......
......@@ -162,11 +162,11 @@ metaTyConsToDerivStuff tc metaDts =
(myZip2 s_insts s_binds)
myZip1 :: [a] -> [b] -> [(a,b)]
myZip1 l1 l2 = ASSERT (length l1 == length l2) zip l1 l2
myZip1 l1 l2 = ASSERT(length l1 == length l2) zip l1 l2
myZip2 :: [[a]] -> [[b]] -> [[(a,b)]]
myZip2 l1 l2 =
ASSERT (and (zipWith (>=) (map length l1) (map length l2)))
ASSERT(and (zipWith (>=) (map length l1) (map length l2)))
[ zip x1 x2 | (x1,x2) <- zip l1 l2 ]
return $ mapBag DerivTyCon (metaTyCons2TyCons metaDts)
......@@ -390,7 +390,7 @@ mkBindsRep gk tycon =
(from_alts, to_alts) = mkSum gk_ (1 :: US) tycon datacons
where gk_ = case gk of
Gen0 -> Gen0_
Gen1 -> ASSERT (length tyvars >= 1)
Gen1 -> ASSERT(length tyvars >= 1)
Gen1_ (last tyvars)
where tyvars = tyConTyVars tycon
......@@ -417,7 +417,7 @@ tc_mkRepFamInsts gk tycon metaDts mod =
; let -- `tyvars` = [a,b]
(tyvars, gk_) = case gk of
Gen0 -> (all_tyvars, Gen0_)
Gen1 -> ASSERT (not $ null all_tyvars)
Gen1 -> ASSERT(not $ null all_tyvars)
(init all_tyvars, Gen1_ $ last all_tyvars)
where all_tyvars = tyConTyVars tycon
......@@ -555,16 +555,16 @@ tc_mkRepTy gk_ tycon metaDts =
-- Sums and products are done in the same way for both Rep and Rep1
sumP [] = mkTyConTy v1
sumP l = ASSERT (length metaCTyCons == length l)
sumP l = ASSERT(length metaCTyCons == length l)
foldBal mkSum' [ mkC i d a
| (d,(a,i)) <- zip metaCTyCons (zip l [0..])]
-- The Bool is True if this constructor has labelled fields
prod :: Int -> [Type] -> Bool -> Type
prod i [] _ = ASSERT (length metaSTyCons > i)
ASSERT (length (metaSTyCons !! i) == 0)
prod i [] _ = ASSERT(length metaSTyCons > i)
ASSERT(length (metaSTyCons !! i) == 0)
mkTyConTy u1
prod i l b = ASSERT (length metaSTyCons > i)
ASSERT (length l == length (metaSTyCons !! i))
prod i l b = ASSERT(length metaSTyCons > i)
ASSERT(length l == length (metaSTyCons !! i))
foldBal mkProd [ arg d t b
| (d,t) <- zip (metaSTyCons !! i) l ]
......
......@@ -1416,7 +1416,7 @@ doTopReactDict inerts fl cls xis loc
doTopReactFunEq :: Ct -> CtEvidence -> TyCon -> [Xi] -> Xi
-> CtLoc -> TcS TopInteractResult
doTopReactFunEq _ct fl fun_tc args xi loc
= ASSERT (isSynFamilyTyCon fun_tc) -- No associated data families have
= ASSERT(isSynFamilyTyCon fun_tc) -- No associated data families have
-- reached this far
-- Look in the cache of solved funeqs
do { fun_eq_cache <- getTcSInerts >>= (return . inert_solved_funeqs)
......
......@@ -532,7 +532,7 @@ quantifyTyVars gbl_tvs tkvs
else do { let (meta_kvs, skolem_kvs) = partition is_meta kvs2
is_meta kv = isTcTyVar kv && isMetaTyVar kv
; mapM_ defaultKindVarToStar meta_kvs
; WARN ( not (null skolem_kvs), ppr skolem_kvs )
; WARN( not (null skolem_kvs), ppr skolem_kvs )
return skolem_kvs } -- Should be empty
; mapM zonk_quant (qkvs ++ qtvs) }
......@@ -582,7 +582,7 @@ zonkQuantifiedTyVar tv
defaultKindVarToStar :: TcTyVar -> TcM Kind
-- We have a meta-kind: unify it with '*'
defaultKindVarToStar kv
= do { ASSERT ( isKindVar kv && isMetaTyVar kv )
= do { ASSERT( isKindVar kv && isMetaTyVar kv )
writeMetaTyVar kv liftedTypeKind
; return liftedTypeKind }
......
......@@ -1167,7 +1167,7 @@ disambigGroup (default_ty:default_tys) group
-- discard all side effects from the attempt
do { setWantedTyBind the_tv default_ty
; implics_from_defaulting <- solveInteract wanteds
; MASSERT (isEmptyBag implics_from_defaulting)
; MASSERT(isEmptyBag implics_from_defaulting)
-- I am not certain if any implications can be generated
-- but I am letting this fail aggressively if this ever happens.
......
......@@ -1162,7 +1162,7 @@ unifyKindEq (FunTy a1 r1) (FunTy a2 r2)
unifyKindEq (TyConApp kc1 k1s) (TyConApp kc2 k2s)
| kc1 == kc2
= ASSERT (length k1s == length k2s)
= ASSERT(length k1s == length k2s)
-- Should succeed since the kind constructors are the same,
-- and the kinds are sort-checked, thus fully applied
do { mb_eqs <- zipWithM unifyKindEq k1s k2s
......
......@@ -637,7 +637,7 @@ splitForAllCo_maybe _ = Nothing
coVarKind :: CoVar -> (Type,Type)
coVarKind cv
| Just (tc, [_kind,ty1,ty2]) <- splitTyConApp_maybe (varType cv)
= ASSERT (tc `hasKey` eqPrimTyConKey)
= ASSERT(tc `hasKey` eqPrimTyConKey)
(ty1,ty2)
| otherwise = panic "coVarKind, non coercion variable"
......@@ -747,7 +747,7 @@ mkFunCo co1 co2 = mkTyConAppCo funTyCon [co1, co2]
mkForAllCo :: Var -> Coercion -> Coercion
-- note that a TyVar should be used here, not a CoVar (nor a TcTyVar)
mkForAllCo tv (Refl ty) = ASSERT( isTyVar tv ) Refl (mkForAllTy tv ty)
mkForAllCo tv co = ASSERT ( isTyVar tv ) ForAllCo tv co
mkForAllCo tv co = ASSERT( isTyVar tv ) ForAllCo tv co
-------------------------------
......
......@@ -2466,7 +2466,7 @@ enclosingTickSpan _ (UnhelpfulSpan _) = panic "enclosingTickSpan UnhelpfulSpan"
enclosingTickSpan md (RealSrcSpan src) = do
ticks <- getTickArray md
let line = srcSpanStartLine src
ASSERT (inRange (bounds ticks) line) do
ASSERT(inRange (bounds ticks) line) do
let toRealSrcSpan (UnhelpfulSpan _) = panic "enclosingTickSpan UnhelpfulSpan"
toRealSrcSpan (RealSrcSpan s) = s
enclosing_spans = [ pan | (_,pan) <- ticks ! line
......
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