Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/e17c1568baf142c2d2ddca4a4b4a7ba5a4ceddca

>---------------------------------------------------------------

commit e17c1568baf142c2d2ddca4a4b4a7ba5a4ceddca
Author: Peter Wortmann 
<[email protected]>
Date:   Fri Apr 22 10:35:35 2011 +0100

    Teach GHC to compile objective-c++ files as well (trac #5150)

>---------------------------------------------------------------

 compiler/main/DriverPhases.hs   |    8 +++++++-
 compiler/main/DriverPipeline.hs |    3 ++-
 ghc/Main.hs                     |    2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
index 4702682..3cafd98 100644
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@ -76,6 +76,7 @@ data Phase
         | Ccpp
         | Cc
         | Cobjc
+        | Cobjcpp
         | HCc           -- Haskellised C (as opposed to vanilla C) compilation
         | SplitMangle   -- after mangler if splitting
         | SplitAs
@@ -112,6 +113,7 @@ 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 SplitMangle SplitMangle = True
 eqPhase SplitAs     SplitAs     = True
@@ -149,6 +151,7 @@ nextPhase SplitAs       = MergeStub
 nextPhase Ccpp          = As
 nextPhase Cc            = As
 nextPhase Cobjc         = As
+nextPhase Cobjcpp       = As
 nextPhase CmmCpp        = Cmm
 nextPhase Cmm           = HCc
 nextPhase HCc           = As
@@ -170,6 +173,8 @@ startPhase "c"        = Cc
 startPhase "cpp"      = Ccpp
 startPhase "C"        = Cc
 startPhase "m"        = Cobjc
+startPhase "M"        = Cobjcpp
+startPhase "mm"       = Cobjcpp
 startPhase "cc"       = Ccpp
 startPhase "cxx"      = Ccpp
 startPhase "split_s"  = SplitMangle
@@ -199,6 +204,7 @@ phaseInputExt (Hsc   _)           = "hspp"      -- 
intermediate only
 phaseInputExt HCc                 = "hc"
 phaseInputExt Ccpp                = "cpp"
 phaseInputExt Cobjc               = "m"
+phaseInputExt Cobjcpp             = "mm"
 phaseInputExt Cc                  = "c"
 phaseInputExt SplitMangle         = "split_s"   -- not really generated
 phaseInputExt As                  = "s"
@@ -217,7 +223,7 @@ haskellish_src_suffixes, haskellish_suffixes, cish_suffixes,
 haskellish_src_suffixes      = haskellish_user_src_suffixes ++
                                [ "hspp", "hscpp", "hcr", "cmm", "cmmcpp" ]
 haskellish_suffixes          = haskellish_src_suffixes ++ ["hc", "raw_s"]
-cish_suffixes                = [ "c", "cpp", "C", "cc", "cxx", "s", "S", "ll", 
"bc", "m" ]
+cish_suffixes                = [ "c", "cpp", "C", "cc", "cxx", "s", "S", "ll", 
"bc", "m", "M", "mm" ]
 extcoreish_suffixes          = [ "hcr" ]
 -- Will not be deleted as temp files:
 haskellish_user_src_suffixes = [ "hs", "lhs", "hs-boot", "lhs-boot" ]
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index ebd8d39..fdb5ce3 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1008,7 +1008,7 @@ runPhase Cmm input_fn dflags
 -- way too many hacks, and I can't say I've ever used it anyway.
 
 runPhase cc_phase input_fn dflags
-   | cc_phase `eqPhase` Cc || cc_phase `eqPhase` Ccpp || cc_phase `eqPhase` 
HCc || cc_phase `eqPhase` Cobjc
+   | any (cc_phase `eqPhase`) [Cc, Ccpp, HCc, Cobjc, Cobjcpp]
    = do
         let cc_opts = getOpts dflags opt_c
             hcc = cc_phase `eqPhase` HCc
@@ -1076,6 +1076,7 @@ runPhase cc_phase input_fn dflags
 
         let gcc_lang_opt | cc_phase `eqPhase` Ccpp  = "c++"
                          | cc_phase `eqPhase` Cobjc = "objective-c"
+                         | cc_phase `eqPhase` Cobjcpp = "objective-c++"
                          | otherwise                = "c"
         io $ SysTools.runCc dflags (
                 -- force the C compiler to interpret this file as C when
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 8b7597c..0514fd2 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -606,7 +606,7 @@ doMake srcs  = do
        haskellish (f,Nothing) = 
          looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f
        haskellish (_,Just phase) = 
-         phase `notElem` [As, Cc, Cobjc, CmmCpp, Cmm, StopLn]
+         phase `notElem` [As, Cc, Cobjc, Cobjcpp, CmmCpp, Cmm, StopLn]
 
     hsc_env <- GHC.getSession
 



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to