[commit: ghc] master: Make a picPOpts function (5d0fce8)

Ian Lynagh igloo at earth.li
Fri Jul 20 15:47:18 CEST 2012


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/5d0fce85fd5c885343196142b15b8a8d2928d3fe

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

commit 5d0fce85fd5c885343196142b15b8a8d2928d3fe
Author: Ian Lynagh <igloo at earth.li>
Date:   Mon Jul 16 19:48:18 2012 +0100

    Make a picPOpts function
    
    We now handle the preprocessor options the same way as the gcc options
    (picCCOpts).

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

 compiler/iface/FlagChecker.hs   |    4 ++--
 compiler/main/DriverPipeline.hs |    2 +-
 compiler/main/DynFlags.hs       |    7 ++++++-
 compiler/main/SysTools.lhs      |    6 +-----
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs
index 0365be7..60b1fb6 100644
--- a/compiler/iface/FlagChecker.hs
+++ b/compiler/iface/FlagChecker.hs
@@ -25,7 +25,7 @@ import System.FilePath (normalise)
 fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ())
                     -> IO Fingerprint
 
-fingerprintDynFlags DynFlags{..} this_mod nameio =
+fingerprintDynFlags dflags at DynFlags{..} this_mod nameio =
     let mainis   = if mainModIs == this_mod then Just mainFunIs else Nothing
                       -- see #5878
         -- pkgopts  = (thisPackage dflags, sort $ packageFlags dflags)
@@ -37,7 +37,7 @@ fingerprintDynFlags DynFlags{..} this_mod nameio =
                 IntSet.toList $ extensionFlags)
 
         -- -I, -D and -U flags affect CPP
-        cpp = (map normalise includePaths, sOpt_P settings)
+        cpp = (map normalise includePaths, opt_P dflags ++ picPOpts)
             -- normalise: eliminate spurious differences due to "./foo" vs "foo"
 
         -- Note [path flags and recompilation]
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 4770679..73273ef 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2036,7 +2036,7 @@ linkDynLib dflags o_files dep_packages = do
 
 doCpp :: DynFlags -> Bool -> Bool -> FilePath -> FilePath -> IO ()
 doCpp dflags raw include_cc_opts input_fn output_fn = do
-    let hscpp_opts = getOpts dflags opt_P
+    let hscpp_opts = getOpts dflags opt_P ++ picPOpts
     let cmdline_include_paths = includePaths dflags
 
     pkg_include_dirs <- getPackageIncludePath dflags []
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 60b6e82..48d3402 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -94,7 +94,7 @@ module DynFlags (
         supportedLanguagesAndExtensions,
 
         -- ** DynFlag C compiler options
-        picCCOpts,
+        picCCOpts, picPOpts,
 
         -- * Configuration of the stg-to-stg passes
         StgToDo(..),
@@ -2796,6 +2796,11 @@ picCCOpts dflags
        | opt_PIC || not opt_Static -> ["-fPIC", "-U __PIC__", "-D__PIC__"]
        | otherwise                 -> []
 
+picPOpts :: [String]
+picPOpts
+ | opt_PIC   = ["-U __PIC__", "-D__PIC__"]
+ | otherwise = []
+
 -- -----------------------------------------------------------------------------
 -- Splitting
 
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index 9e5d247..a75a3bc 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -50,7 +50,6 @@ import Panic
 import Platform
 import Util
 import DynFlags
-import StaticFlags
 import Exception
 
 import Data.IORef
@@ -295,10 +294,7 @@ initSysTools mbMinusB
                         -- Hans: this isn't right in general, but you can
                         -- elaborate it in the same way as the others
                         sOpt_L       = [],
-                        sOpt_P       = (if opt_PIC
-                                        then -- this list gets reversed
-                                             ["-D__PIC__", "-U __PIC__"]
-                                        else []),
+                        sOpt_P       = [],
                         sOpt_F       = [],
                         sOpt_c       = [],
                         sOpt_a       = [],





More information about the Cvs-ghc mailing list