[commit: ghc] master: Rename driver phases C(obj)cpp to C(obj)cplusplus (abde5da)

Karel Gardas karel.gardas at centrum.cz
Fri Mar 27 21:03:41 UTC 2015


Hi Thomas,

Cplusplus is quite long identifier, bad for eyes. Usually in C++ 
community if you can't use cpp then you use cxx. It's shorter and clear 
even when reading fast, don't you think?

Karel

PS: of course even before cxx it was CC, but I think this does not have 
any advantage over cxx in this context...

On 03/27/15 09:38 PM, git at git.haskell.org wrote:
> Repository : ssh://git@git.haskell.org/ghc
>
> On branch  : master
> Link       : http://ghc.haskell.org/trac/ghc/changeset/abde5da4dee5f3b83264f8471e458b20d04f8b29/ghc
>
>> ---------------------------------------------------------------
>
> commit abde5da4dee5f3b83264f8471e458b20d04f8b29
> Author: Thomas Miedema<thomasmiedema at gmail.com>
> Date:   Fri Mar 27 21:37:49 2015 +0100
>
>      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
>
>
>> ---------------------------------------------------------------
>
> abde5da4dee5f3b83264f8471e458b20d04f8b29
>   compiler/main/DriverPhases.hs   | 32 ++++++++++++++++----------------
>   compiler/main/DriverPipeline.hs |  9 +++++----
>   ghc/Main.hs                     |  2 +-
>   3 files changed, 22 insertions(+), 21 deletions(-)
>
> diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
> index 2433f6d..2d7d904 100644
> --- a/compiler/main/DriverPhases.hs
> +++ b/compiler/main/DriverPhases.hs
> @@ -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"
> diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
> index 24df3a2..845cc95 100644
> --- a/compiler/main/DriverPipeline.hs
> +++ b/compiler/main/DriverPipeline.hs
> @@ -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 [])
>
> diff --git a/ghc/Main.hs b/ghc/Main.hs
> index da95ebf..a95382f 100644
> --- a/ghc/Main.hs
> +++ b/ghc/Main.hs
> @@ -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
>
> _______________________________________________
> ghc-commits mailing list
> ghc-commits at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-commits
>



More information about the ghc-devs mailing list