| Cpp HscSource
| HsPp HscSource
| Hsc HscSource
+ | Ccpp
| Cc
| HCc -- Haskellised C (as opposed to vanilla C) compilation
| Mangle -- assembly mangling, now done by a separate script.
eqPhase (Cpp _) (Cpp _) = True
eqPhase (HsPp _) (HsPp _) = True
eqPhase (Hsc _) (Hsc _) = True
+eqPhase Ccpp Ccpp = True
eqPhase Cc Cc = True
eqPhase HCc HCc = True
eqPhase Mangle Mangle = True
nextPhase SplitMangle = As
nextPhase As = SplitAs
nextPhase SplitAs = StopLn
+nextPhase Ccpp = As
nextPhase Cc = As
nextPhase CmmCpp = Cmm
nextPhase Cmm = HCc
startPhase "hcr" = Hsc ExtCoreFile
startPhase "hc" = HCc
startPhase "c" = Cc
-startPhase "cpp" = Cc
+startPhase "cpp" = Ccpp
startPhase "C" = Cc
-startPhase "cc" = Cc
-startPhase "cxx" = Cc
+startPhase "cc" = Ccpp
+startPhase "cxx" = Ccpp
startPhase "raw_s" = Mangle
startPhase "split_s" = SplitMangle
startPhase "s" = As
-- because runPipeline uses the StopBefore phase to pick the
-- output filename. That could be fixed, but watch out.
phaseInputExt HCc = "hc"
+phaseInputExt Ccpp = "cpp"
phaseInputExt Cc = "c"
phaseInputExt Mangle = "raw_s"
phaseInputExt SplitMangle = "split_s" -- not really generated
-- 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
-- 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