summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-07-16 19:48:18 +0100
committerIan Lynagh <igloo@earth.li>2012-07-16 19:48:18 +0100
commit5d0fce85fd5c885343196142b15b8a8d2928d3fe (patch)
treea460a2ef476741dcfe1518632840f703a71d8542 /compiler
parentd6c1311a30471eb252db321c6151214ad1eb1fbb (diff)
downloadhaskell-5d0fce85fd5c885343196142b15b8a8d2928d3fe.tar.gz
Make a picPOpts function
We now handle the preprocessor options the same way as the gcc options (picCCOpts).
Diffstat (limited to 'compiler')
-rw-r--r--compiler/iface/FlagChecker.hs4
-rw-r--r--compiler/main/DriverPipeline.hs2
-rw-r--r--compiler/main/DynFlags.hs7
-rw-r--r--compiler/main/SysTools.lhs6
4 files changed, 10 insertions, 9 deletions
diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs
index 0365be7338..60b1fb6bfb 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@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 47706798f7..73273ef6c8 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 60b6e82bb7..48d3402586 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 9e5d24703e..a75a3bc5b4 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 = [],