Commit 5d0fce85 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Make a picPOpts function

We now handle the preprocessor options the same way as the gcc options
(picCCOpts).
parent d6c1311a
...@@ -25,7 +25,7 @@ import System.FilePath (normalise) ...@@ -25,7 +25,7 @@ import System.FilePath (normalise)
fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ()) fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ())
-> IO Fingerprint -> IO Fingerprint
fingerprintDynFlags DynFlags{..} this_mod nameio = fingerprintDynFlags dflags@DynFlags{..} this_mod nameio =
let mainis = if mainModIs == this_mod then Just mainFunIs else Nothing let mainis = if mainModIs == this_mod then Just mainFunIs else Nothing
-- see #5878 -- see #5878
-- pkgopts = (thisPackage dflags, sort $ packageFlags dflags) -- pkgopts = (thisPackage dflags, sort $ packageFlags dflags)
...@@ -37,7 +37,7 @@ fingerprintDynFlags DynFlags{..} this_mod nameio = ...@@ -37,7 +37,7 @@ fingerprintDynFlags DynFlags{..} this_mod nameio =
IntSet.toList $ extensionFlags) IntSet.toList $ extensionFlags)
-- -I, -D and -U flags affect CPP -- -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" -- normalise: eliminate spurious differences due to "./foo" vs "foo"
-- Note [path flags and recompilation] -- Note [path flags and recompilation]
......
...@@ -2036,7 +2036,7 @@ linkDynLib dflags o_files dep_packages = do ...@@ -2036,7 +2036,7 @@ linkDynLib dflags o_files dep_packages = do
doCpp :: DynFlags -> Bool -> Bool -> FilePath -> FilePath -> IO () doCpp :: DynFlags -> Bool -> Bool -> FilePath -> FilePath -> IO ()
doCpp dflags raw include_cc_opts input_fn output_fn = do 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 let cmdline_include_paths = includePaths dflags
pkg_include_dirs <- getPackageIncludePath dflags [] pkg_include_dirs <- getPackageIncludePath dflags []
......
...@@ -94,7 +94,7 @@ module DynFlags ( ...@@ -94,7 +94,7 @@ module DynFlags (
supportedLanguagesAndExtensions, supportedLanguagesAndExtensions,
-- ** DynFlag C compiler options -- ** DynFlag C compiler options
picCCOpts, picCCOpts, picPOpts,
-- * Configuration of the stg-to-stg passes -- * Configuration of the stg-to-stg passes
StgToDo(..), StgToDo(..),
...@@ -2796,6 +2796,11 @@ picCCOpts dflags ...@@ -2796,6 +2796,11 @@ picCCOpts dflags
| opt_PIC || not opt_Static -> ["-fPIC", "-U __PIC__", "-D__PIC__"] | opt_PIC || not opt_Static -> ["-fPIC", "-U __PIC__", "-D__PIC__"]
| otherwise -> [] | otherwise -> []
picPOpts :: [String]
picPOpts
| opt_PIC = ["-U __PIC__", "-D__PIC__"]
| otherwise = []
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Splitting -- Splitting
......
...@@ -50,7 +50,6 @@ import Panic ...@@ -50,7 +50,6 @@ import Panic
import Platform import Platform
import Util import Util
import DynFlags import DynFlags
import StaticFlags
import Exception import Exception
import Data.IORef import Data.IORef
...@@ -295,10 +294,7 @@ initSysTools mbMinusB ...@@ -295,10 +294,7 @@ initSysTools mbMinusB
-- Hans: this isn't right in general, but you can -- Hans: this isn't right in general, but you can
-- elaborate it in the same way as the others -- elaborate it in the same way as the others
sOpt_L = [], sOpt_L = [],
sOpt_P = (if opt_PIC sOpt_P = [],
then -- this list gets reversed
["-D__PIC__", "-U __PIC__"]
else []),
sOpt_F = [], sOpt_F = [],
sOpt_c = [], sOpt_c = [],
sOpt_a = [], sOpt_a = [],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment