Commit eaffe229 authored by nr@eecs.harvard.edu's avatar nr@eecs.harvard.edu
Browse files

check for unreachable code only with -DDEBUG

parent 45cbf5e1
...@@ -321,11 +321,16 @@ mkWhileDo cbranch body = ...@@ -321,11 +321,16 @@ mkWhileDo cbranch body =
note_this_code_becomes_unreachable :: note_this_code_becomes_unreachable ::
(Monad m, LastNode l, Outputable middle, Outputable l) => ZTail middle l -> m () (Monad m, LastNode l, Outputable middle, Outputable l) => ZTail middle l -> m ()
#ifdef DEBUG
note_this_code_becomes_unreachable = u note_this_code_becomes_unreachable = u
where u (ZLast LastExit) = return () where u (ZLast LastExit) = return ()
u (ZLast (LastOther l)) | isBranchNode l = return () u (ZLast (LastOther l)) | isBranchNode l = return ()
-- Note [Branch follows branch] -- Note [Branch follows branch]
u tail = fail ("unreachable code: " ++ showSDoc (ppr tail)) u tail = fail ("unreachable code: " ++ showSDoc (ppr tail))
#else
note_this_code_becomes_unreachable = return ()
#endif
{- {-
Note [Branch follows branch] Note [Branch follows branch]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
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