X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDriverPipeline.hs;h=7620d074bd5af21deeae2276bb1c4080be02c739;hb=fc9bbbab3fe56cf0ff5723abbdb0f496d257f34e;hp=983bebef6febe29a7182ccd01e636e6155255d0d;hpb=1a50b338952e91251197d4cf4c4f0a0e266e99a7;p=ghc-hetmet.git diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 983bebe..7620d07 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -46,11 +46,10 @@ import StringBuffer ( hGetStringBuffer ) import BasicTypes ( SuccessFlag(..) ) import Maybes ( expectJust ) import ParserCoreUtils ( getCoreModuleName ) -import SrcLoc ( unLoc ) -import SrcLoc ( Located(..) ) +import SrcLoc import FastString -import Control.Exception as Exception +import Exception import Data.IORef ( readIORef, writeIORef, IORef ) import GHC.Exts ( Int(..) ) import System.Directory @@ -351,7 +350,7 @@ compileFile :: HscEnv -> Phase -> (FilePath, Maybe Phase) -> IO FilePath compileFile hsc_env stop_phase (src, mb_phase) = do exists <- doesFileExist src when (not exists) $ - throwDyn (CmdLineError ("does not exist: " ++ src)) + ghcError (CmdLineError ("does not exist: " ++ src)) let dflags = hsc_dflags hsc_env @@ -451,7 +450,7 @@ runPipeline stop_phase hsc_env0 (input_fn, mb_phase) mb_basename output maybe_lo -- before B in a normal compilation pipeline. when (not (start_phase `happensBefore` stop_phase)) $ - throwDyn (UsageError + ghcError (UsageError ("cannot compile this file to desired target: " ++ input_fn)) @@ -616,12 +615,12 @@ runPhase (Unlit sf) _stop hsc_env _basename _suff input_fn get_output_fn maybe_l -- Cpp phase : (a) gets OPTIONS out of file -- (b) runs cpp if necessary -runPhase (Cpp sf) _stop hsc_env basename suff input_fn get_output_fn maybe_loc +runPhase (Cpp sf) _stop hsc_env _basename _suff input_fn get_output_fn maybe_loc = do let dflags0 = hsc_dflags hsc_env src_opts <- getOptionsFromFile dflags0 input_fn - (dflags, unhandled_flags, warns) <- parseDynamicFlags dflags0 (map unLoc src_opts) + (dflags, unhandled_flags, warns) <- parseDynamicFlags dflags0 src_opts handleFlagWarnings dflags warns - checkProcessArgsResult unhandled_flags (basename <.> suff) + checkProcessArgsResult unhandled_flags if not (dopt Opt_Cpp dflags) then -- no need to preprocess CPP, just pass input file along @@ -777,7 +776,7 @@ runPhase (Hsc src_flavour) stop hsc_env basename suff input_fn get_output_fn _ma Nothing -- No "module i of n" progress info case mbResult of - Nothing -> throwDyn (PhaseFailed "hsc" (ExitFailure 1)) + Nothing -> ghcError (PhaseFailed "hsc" (ExitFailure 1)) Just HscNoRecomp -> do SysTools.touch dflags' "Touching object file" o_file -- The .o file must have a later modification date @@ -818,7 +817,7 @@ runPhase Cmm stop hsc_env basename _ input_fn get_output_fn maybe_loc ok <- hscCmmFile hsc_env' input_fn - when (not ok) $ throwDyn (PhaseFailed "cmm" (ExitFailure 1)) + when (not ok) $ ghcError (PhaseFailed "cmm" (ExitFailure 1)) return (next_phase, dflags, maybe_loc, output_fn) @@ -852,7 +851,13 @@ runPhase cc_phase _stop hsc_env _basename _suff input_fn get_output_fn maybe_loc let verb = getVerbFlag dflags - pkg_extra_cc_opts <- getPackageExtraCcOpts dflags pkgs + -- cc-options are not passed when compiling .hc files. Our + -- hc code doesn't not #include any header files anyway, so these + -- options aren't necessary. + pkg_extra_cc_opts <- + if cc_phase `eqPhase` HCc + then return [] + else getPackageExtraCcOpts dflags pkgs #ifdef darwin_TARGET_OS pkg_framework_paths <- getPackageFrameworkPath dflags pkgs @@ -1120,7 +1125,7 @@ runPhase_MoveBinary dflags input_fn dep_packages pvm_executable_base = "=" ++ input_fn pvm_executable = pvm_root ++ "/bin/" ++ pvm_arch ++ "/" ++ pvm_executable_base -- nuke old binary; maybe use configur'ed names for cp and rm? - Panic.try (removeFile pvm_executable) + tryIO (removeFile pvm_executable) -- move the newly created binary into PVM land copy dflags "copying PVM executable" input_fn pvm_executable -- generate a wrapper script for running a parallel prg under PVM @@ -1352,7 +1357,7 @@ linkBinary dflags o_files dep_packages = do -- parallel only: move binary to another dir -- HWL success <- runPhase_MoveBinary dflags output_fn dep_packages if success then return () - else throwDyn (InstallationError ("cannot move binary")) + else ghcError (InstallationError ("cannot move binary")) exeFileName :: DynFlags -> FilePath