X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDriverPipeline.hs;h=9e33f517e5e69dc72bd1cc19103b1fe9a25fbfd9;hb=311b1cdfc9b1c311cc53482c461c18cba8885b2a;hp=c0f5e7b7842f2a86361eb1fc26e0657c1eb8c015;hpb=501281032723cfb1e6e324921c6c3e47b03730ab;p=ghc-hetmet.git diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index c0f5e7b..9e33f51 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -50,17 +50,18 @@ import ParserCoreUtils ( getCoreModuleName ) import SrcLoc ( unLoc ) import SrcLoc ( Located(..) ) -import EXCEPTION -import DATA_IOREF ( readIORef, writeIORef, IORef ) -import GLAEXTS ( Int(..) ) - -import Directory -import System -import IO -import Monad +import Control.Exception as Exception +import Data.IORef ( readIORef, writeIORef, IORef ) +import GHC.Exts ( Int(..) ) +import System.Directory +import System.IO +import SYSTEM_IO_ERROR as IO +import Control.Monad import Data.List ( isSuffixOf ) -import Maybe - +import Data.Maybe +import System.Exit +import System.Cmd +import System.Environment -- --------------------------------------------------------------------------- -- Pre-process @@ -789,7 +790,7 @@ runPhase Cmm stop dflags basename suff input_fn get_output_fn maybe_loc -- way too many hacks, and I can't say I've ever used it anyway. runPhase cc_phase stop dflags basename suff input_fn get_output_fn maybe_loc - | cc_phase `eqPhase` Cc || cc_phase `eqPhase` HCc + | cc_phase `eqPhase` Cc || cc_phase `eqPhase` Ccpp || cc_phase `eqPhase` HCc = do let cc_opts = getOpts dflags opt_c hcc = cc_phase `eqPhase` HCc @@ -851,7 +852,8 @@ runPhase cc_phase stop dflags basename suff input_fn get_output_fn maybe_loc -- compiling .hc files, by adding the -x c option. -- Also useful for plain .c files, just in case GHC saw a -- -x c option. - [ SysTools.Option "-x", SysTools.Option "c"] ++ + [ SysTools.Option "-x", if cc_phase `eqPhase` Ccpp + then SysTools.Option "c++" else SysTools.Option "c"] ++ [ SysTools.FileOption "" input_fn , SysTools.Option "-o" , SysTools.FileOption "" output_fn @@ -1132,7 +1134,7 @@ checkProcessArgsResult flags filename getHCFilePackages :: FilePath -> IO [PackageId] getHCFilePackages filename = - EXCEPTION.bracket (openFile filename ReadMode) hClose $ \h -> do + Exception.bracket (openFile filename ReadMode) hClose $ \h -> do l <- hGetLine h case l of '/':'*':' ':'G':'H':'C':'_':'P':'A':'C':'K':'A':'G':'E':'S':rest ->