[project @ 2001-02-14 11:54:33 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPipeline.hs
index d7bc710..d81b6af 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPipeline.hs,v 1.47 2001/01/09 17:16:35 rrt Exp $
+-- $Id: DriverPipeline.hs,v 1.50 2001/02/05 17:52:49 rrt Exp $
 --
 -- GHC Driver
 --
@@ -322,7 +322,7 @@ run_phase Cpp basename suff input_fn output_fn
                           ++ ": static flags are not allowed in {-# OPTIONS #-} pragmas:\n\t" 
                           ++ unwords unhandled_flags)) (ExitFailure 1))
 
-       do_cpp <- readState cpp_flag
+       do_cpp <- dynFlag cppFlag
        if do_cpp
           then do
                    cpp <- readIORef v_Pgm_P
@@ -335,19 +335,21 @@ run_phase Cpp basename suff input_fn output_fn
                                                        ++ pkg_include_dirs)
 
            verb <- getVerbFlag
+           (md_c_flags, _) <- machdepCCOpts
 
            runSomething "C pre-processor" 
                (unwords
-                          (["echo '{-# LINE 1 \"" ++ input_fn ++ "\" -}'", ">", output_fn, "&&",
+                          (["echo '{-# LINE 1 \"" ++ input_fn ++ "\" #-}'", ">", output_fn, "&&",
                     cpp, verb] 
                    ++ include_paths
                    ++ hs_src_cpp_opts
                    ++ hscpp_opts
+                   ++ md_c_flags
                    ++ [ "-x", "c", input_fn, ">>", output_fn ]
                   ))
          else do
            runSomething "Ineffective C pre-processor"
-                  ("echo '{-# LINE 1 \""  ++ input_fn ++ "\" -}' > " 
+                  ("echo '{-# LINE 1 \""  ++ input_fn ++ "\" #-}' > " 
                    ++ output_fn ++ " && cat " ++ input_fn
                    ++ " >> " ++ output_fn)
        return True
@@ -525,7 +527,7 @@ run_phase cc_phase _basename _suff input_fn output_fn
                                                        ++ pkg_include_dirs)
 
        c_includes <- getPackageCIncludes
-       cmdline_includes <- readState cmdline_hc_includes -- -#include options
+       cmdline_includes <- dynFlag cmdlineHcIncludes -- -#include options
 
        let cc_injects | hcc = unlines (map mk_include 
                                        (c_includes ++ reverse cmdline_includes))
@@ -588,7 +590,7 @@ run_phase Mangle _basename _suff input_fn output_fn
        mangler_opts <- getOpts opt_m
        machdep_opts <-
         if (prefixMatch "i386" cTARGETPLATFORM)
-           then do n_regs <- readState stolen_x86_regs
+           then do n_regs <- dynFlag stolen_x86_regs
                    return [ show n_regs ]
            else return []
        runSomething "Assembly Mangler"
@@ -811,14 +813,12 @@ doMkDLL o_files = do
 preprocess :: FilePath -> IO FilePath
 preprocess filename =
   ASSERT(haskellish_file filename) 
-  do init_driver_state <- readIORef v_InitDriverState
-     writeIORef v_Driver_state init_driver_state
-
+  do init_dyn_flags <- readIORef v_InitDynFlags
+     writeIORef v_DynFlags init_dyn_flags
      pipeline <- genPipeline (StopBefore Hsc) ("preprocess") False 
                        defaultHscLang filename
      runPipeline pipeline filename False{-no linking-} False{-no -o flag-}
 
-
 -----------------------------------------------------------------------------
 -- Compile a single module, under the control of the compilation manager.
 --
@@ -858,8 +858,6 @@ data CompResult
 compile ghci_mode summary source_unchanged old_iface hst hit pcs = do 
    init_dyn_flags <- readIORef v_InitDynFlags
    writeIORef v_DynFlags init_dyn_flags
-   init_driver_state <- readIORef v_InitDriverState
-   writeIORef v_Driver_state init_driver_state
 
    showPass init_dyn_flags 
        (showSDoc (text "Compiling" <+> ppr (name_of_summary summary)))