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

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)
fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ())
-> IO Fingerprint
fingerprintDynFlags DynFlags{..} this_mod nameio =
fingerprintDynFlags dflags@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]
......
......@@ -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 []
......
......@@ -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
......
......@@ -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 = [],
......
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