X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2FMain.hs;h=df90857fbbb457805cd15d4849a7aa9a0e011b53;hb=59fa6266f00b6edcfc20c491c8de9a1b215dfa22;hp=766577eac8d83af59a94da87d48c2ca83db14b42;hpb=4cdb06b3b6e836777eef10f4707a07d1ddcb280e;p=ghc-hetmet.git diff --git a/ghc/Main.hs b/ghc/Main.hs index 766577e..df90857 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -16,7 +16,8 @@ module Main (main) where import qualified GHC import GHC ( DynFlags(..), HscTarget(..), GhcMode(..), GhcLink(..), - LoadHowMuch(..), dopt, DynFlag(..) ) + LoadHowMuch(..), dopt, DynFlag(..), + defaultCallbacks ) import CmdLineParser -- Implementations of the various modes (--show-iface, mkdependHS. etc.) @@ -153,7 +154,11 @@ main = let flagWarnings = staticFlagWarnings ++ modeFlagWarnings ++ dynamicFlagWarnings - liftIO $ handleFlagWarnings dflags2 flagWarnings + + handleSourceError (\e -> do + GHC.printExceptionAndWarnings e + liftIO $ exitWith (ExitFailure 1)) $ + handleFlagWarnings dflags2 flagWarnings -- make sure we clean up after ourselves GHC.defaultCleanupHandler dflags2 $ do @@ -511,7 +516,7 @@ doMake srcs = do doShowIface :: DynFlags -> FilePath -> IO () doShowIface dflags file = do - hsc_env <- newHscEnv dflags + hsc_env <- newHscEnv defaultCallbacks dflags showIface hsc_env file -- ---------------------------------------------------------------------------