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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/6caa417ded740fb8eaa50669269e38c8129092f0

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

commit 6caa417ded740fb8eaa50669269e38c8129092f0
Merge: 91bb651... 9e27ad1...
Author: Simon Marlow <[email protected]>
Date:   Wed Apr 6 14:30:59 2011 +0100

    Merge branch 'trac_5025' of https://github.com/thoughtpolice/ghc
    
    * 'trac_5025' of https://github.com/thoughtpolice/ghc:
      Teach GHC to compile objective-c files; trac #5025
    
    Conflicts:
        compiler/main/DriverPipeline.hs

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

diff --cc compiler/main/DriverPhases.hs
index 87ae663,ee4a756..f6a9738
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@@ -75,7 -75,9 +75,8 @@@ data Phas
          | Hsc   HscSource
          | Ccpp
          | Cc
+         | Cobjc
          | HCc           -- Haskellised C (as opposed to vanilla C) compilation
 -        | Mangle        -- assembly mangling, now done by a separate script.
          | SplitMangle   -- after mangler if splitting
          | SplitAs
          | As
@@@ -110,7 -111,9 +111,8 @@@ eqPhase (HsPp  _)   (HsPp  _)   = Tru
  eqPhase (Hsc   _)   (Hsc   _)   = True
  eqPhase Ccpp        Ccpp        = True
  eqPhase Cc          Cc          = True
+ eqPhase Cobjc       Cobjc       = True
  eqPhase HCc         HCc         = True
 -eqPhase Mangle      Mangle      = True
  eqPhase SplitMangle SplitMangle = True
  eqPhase SplitAs     SplitAs     = True
  eqPhase As          As          = True
@@@ -147,13 -151,12 +149,14 @@@ nextPhase LlvmLlc       = LlvmMangl
  nextPhase LlvmLlc       = As
  #endif
  nextPhase LlvmMangle    = As
 -nextPhase SplitAs       = StopLn
 +nextPhase SplitAs       = MergeStub
  nextPhase Ccpp          = As
  nextPhase Cc            = As
+ nextPhase Cobjc         = As
  nextPhase CmmCpp        = Cmm
  nextPhase Cmm           = HCc
 +nextPhase HCc           = As
 +nextPhase MergeStub     = StopLn
  nextPhase StopLn        = panic "nextPhase: nothing after StopLn"
  
  -- the first compilation phase for a given file is determined
@@@ -170,8 -173,10 +173,9 @@@ startPhase "hc"       = HC
  startPhase "c"        = Cc
  startPhase "cpp"      = Ccpp
  startPhase "C"        = Cc
+ startPhase "m"        = Cobjc
  startPhase "cc"       = Ccpp
  startPhase "cxx"      = Ccpp
 -startPhase "raw_s"    = Mangle
  startPhase "split_s"  = SplitMangle
  startPhase "s"        = As
  startPhase "S"        = As
@@@ -198,7 -203,9 +202,8 @@@ phaseInputExt (Hsc   _)           = "hs
          --     output filename.  That could be fixed, but watch out.
  phaseInputExt HCc                 = "hc"
  phaseInputExt Ccpp                = "cpp"
+ phaseInputExt Cobjc               = "m"
  phaseInputExt Cc                  = "c"
 -phaseInputExt Mangle              = "raw_s"
  phaseInputExt SplitMangle         = "split_s"   -- not really generated
  phaseInputExt As                  = "s"
  phaseInputExt LlvmOpt             = "ll"
diff --cc compiler/main/DriverPipeline.hs
index 9bcc30a,fb262ba..8d31fd9
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@@ -985,9 -911,9 +985,9 @@@ runPhase Cmm input_fn dflag
  -- we don't support preprocessing .c files (with -E) now.  Doing so introduces
  -- way too many hacks, and I can't say I've ever used it anyway.
  
 -runPhase cc_phase _stop hsc_env _basename _suff input_fn get_output_fn 
maybe_loc
 +runPhase cc_phase input_fn dflags
-    | cc_phase `eqPhase` Cc || cc_phase `eqPhase` Ccpp || cc_phase `eqPhase` 
HCc
+    | cc_phase `eqPhase` Cc || cc_phase `eqPhase` Ccpp || cc_phase `eqPhase` 
HCc || cc_phase `eqPhase` Cobjc
 -   = do let dflags = hsc_dflags hsc_env
 +   = do
          let cc_opts = getOpts dflags opt_c
              hcc = cc_phase `eqPhase` HCc
  
@@@ -1054,7 -983,10 +1054,10 @@@
                  -- very weakly typed, being derived from C--.
                  ["-fno-strict-aliasing"]
  
+         let gcc_lang_opt | cc_phase `eqPhase` Ccpp  = "c++"
+                          | cc_phase `eqPhase` Cobjc = "objective-c"
+                          | otherwise                = "c"
 -        SysTools.runCc dflags (
 +        io $ SysTools.runCc dflags (
                  -- force the C compiler to interpret this file as C when
                  -- compiling .hc files, by adding the -x c option.
                  -- Also useful for plain .c files, just in case GHC saw a



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

Reply via email to