Commit abde5da4 authored by thomie's avatar thomie

Rename driver phases C(obj)cpp to C(obj)cplusplus

Before:
Cpp     = Pre-process C
Ccpp    = Compile C++
Cobjcpp = Compile Objective-C++
CmmCpp  = Pre-process Cmm

Quite confusing! This commit renames `Ccpp` to `Ccplusplus`, and
`Cobjcpp` to `Cobjcplusplus`. The two letters `p-p` keep standing for
`pre-processing` throughout the compiler.

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D756
parent af45feba
......@@ -111,10 +111,10 @@ data Phase
| Cpp HscSource
| HsPp HscSource
| Hsc HscSource
| Ccpp
| Cc
| Cobjc
| Cobjcpp
| Ccplusplus -- Compile C++
| Cc -- Compile C
| Cobjc -- Compile Objective-C
| Cobjcplusplus -- Compile Objective-C++
| HCc -- Haskellised C (as opposed to vanilla C) compilation
| Splitter -- Assembly file splitter (part of '-split-objs')
| SplitAs -- Assembler for split assembly files (part of '-split-objs')
......@@ -148,10 +148,8 @@ eqPhase (Unlit _) (Unlit _) = True
eqPhase (Cpp _) (Cpp _) = True
eqPhase (HsPp _) (HsPp _) = True
eqPhase (Hsc _) (Hsc _) = True
eqPhase Ccpp Ccpp = True
eqPhase Cc Cc = True
eqPhase Cobjc Cobjc = True
eqPhase Cobjcpp Cobjcpp = True
eqPhase HCc HCc = True
eqPhase Splitter Splitter = True
eqPhase SplitAs SplitAs = True
......@@ -163,7 +161,9 @@ eqPhase CmmCpp CmmCpp = True
eqPhase Cmm Cmm = True
eqPhase MergeStub MergeStub = True
eqPhase StopLn StopLn = True
eqPhase _ _ = False
eqPhase Ccplusplus Ccplusplus = True
eqPhase Cobjcplusplus Cobjcplusplus = True
eqPhase _ _ = False
-- Partial ordering on phases: we want to know which phases will occur before
-- which others. This is used for sanity checking, to ensure that the
......@@ -189,10 +189,10 @@ nextPhase dflags p
LlvmMangle -> As False
SplitAs -> MergeStub
As _ -> MergeStub
Ccpp -> As False
Ccplusplus -> As False
Cc -> As False
Cobjc -> As False
Cobjcpp -> As False
Cobjcplusplus -> As False
CmmCpp -> Cmm
Cmm -> maybeHCc
HCc -> As False
......@@ -215,13 +215,13 @@ startPhase "hscpp" = HsPp HsSrcFile
startPhase "hspp" = Hsc HsSrcFile
startPhase "hc" = HCc
startPhase "c" = Cc
startPhase "cpp" = Ccpp
startPhase "cpp" = Ccplusplus
startPhase "C" = Cc
startPhase "m" = Cobjc
startPhase "M" = Cobjcpp
startPhase "mm" = Cobjcpp
startPhase "cc" = Ccpp
startPhase "cxx" = Ccpp
startPhase "M" = Cobjcplusplus
startPhase "mm" = Cobjcplusplus
startPhase "cc" = Ccplusplus
startPhase "cxx" = Ccplusplus
startPhase "split_s" = Splitter
startPhase "s" = As False
startPhase "S" = As True
......@@ -247,9 +247,9 @@ phaseInputExt (Hsc _) = "hspp" -- intermediate only
-- 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 Ccplusplus = "cpp"
phaseInputExt Cobjc = "m"
phaseInputExt Cobjcpp = "mm"
phaseInputExt Cobjcplusplus = "mm"
phaseInputExt Cc = "c"
phaseInputExt Splitter = "split_s"
phaseInputExt (As True) = "S"
......
......@@ -1068,7 +1068,7 @@ runPhase (RealPhase Cmm) input_fn dflags
-- way too many hacks, and I can't say I've ever used it anyway.
runPhase (RealPhase cc_phase) input_fn dflags
| any (cc_phase `eqPhase`) [Cc, Ccpp, HCc, Cobjc, Cobjcpp]
| any (cc_phase `eqPhase`) [Cc, Ccplusplus, HCc, Cobjc, Cobjcplusplus]
= do
let platform = targetPlatform dflags
hcc = cc_phase `eqPhase` HCc
......@@ -1137,9 +1137,9 @@ runPhase (RealPhase cc_phase) input_fn dflags
ghcVersionH <- liftIO $ getGhcVersionPathName dflags
let gcc_lang_opt | cc_phase `eqPhase` Ccpp = "c++"
let gcc_lang_opt | cc_phase `eqPhase` Ccplusplus = "c++"
| cc_phase `eqPhase` Cobjc = "objective-c"
| cc_phase `eqPhase` Cobjcpp = "objective-c++"
| cc_phase `eqPhase` Cobjcplusplus = "objective-c++"
| otherwise = "c"
liftIO $ SysTools.runCc dflags (
-- force the C compiler to interpret this file as C when
......@@ -1176,7 +1176,8 @@ runPhase (RealPhase cc_phase) input_fn dflags
else [])
-- GCC 4.6+ doesn't like -Wimplicit when compiling C++.
++ (if (cc_phase /= Ccpp && cc_phase /= Cobjcpp)
++ (if (cc_phase /= Ccplusplus &&
cc_phase /= Cobjcplusplus)
then ["-Wimplicit"]
else [])
......
......@@ -653,7 +653,7 @@ doMake srcs = do
haskellish (f,Nothing) =
looksLikeModuleName f || isHaskellUserSrcFilename f || '.' `notElem` f
haskellish (_,Just phase) =
phase `notElem` [ As True, As False, Cc, Cobjc, Cobjcpp, CmmCpp, Cmm
phase `notElem` [ As True, As False, Cc, Cobjc, Cobjcplusplus, CmmCpp, Cmm
, StopLn]
hsc_env <- GHC.getSession
......
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