summaryrefslogtreecommitdiff
path: root/compiler/iface/FlagChecker.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-11-10 11:14:20 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-11-10 13:25:31 +0000
commit9df7f9b4022ffda25f004cb099de358d7d240fc1 (patch)
tree82fe29fe989956f74c23e18f1c0eaf150a61727b /compiler/iface/FlagChecker.hs
parent40b2a22ccea70131d0633853a07d9769511af334 (diff)
downloadhaskell-9df7f9b4022ffda25f004cb099de358d7d240fc1.tar.gz
Add more flags to the recompilation check (#437)
Now included: - all language flags - all filename-related flags (-i, -osuf, -hidir etc.) - all CPP-related flags (-I, -D, -U)
Diffstat (limited to 'compiler/iface/FlagChecker.hs')
-rw-r--r--compiler/iface/FlagChecker.hs40
1 files changed, 21 insertions, 19 deletions
diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs
index 21d4a96464..d9557b7778 100644
--- a/compiler/iface/FlagChecker.hs
+++ b/compiler/iface/FlagChecker.hs
@@ -1,4 +1,4 @@
--- {-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE RecordWildCards #-}
-- -----------------------------------------------------------------------------
-- | This module manages storing the various GHC option flags in a modules
@@ -15,7 +15,7 @@ import HscTypes
import Name
import Fingerprint
--- import Data.List (sort)
+import Data.List (sort)
{-
Note [DynFlags Hash]
@@ -36,22 +36,34 @@ recompilation manager and its not sure how beneficial it is.
-- | Produce a fingerprint of a @DynFlags@ value. We only base
-- the finger print on important fields in @DynFlags@ so that
-- the recompilation checker can use this fingerprint.
-fingerprintDynFlags :: DynFlags -> (BinHandle -> Name -> IO ()) -> IO Fingerprint
-fingerprintDynFlags dflags nameio =
+fingerprintDynFlags :: DynFlags -> (BinHandle -> Name -> IO ())
+ -> IO Fingerprint
+
+fingerprintDynFlags DynFlags{..} nameio =
let -- DriverPipeline.getLinkInfo handles this info I believe
-- rtsopts = (rtsOptsEnabled dflags, rtsOpts dflags)
-- Probably not a good idea
-- optlvl = optLevel dflags
- mainis = (mainModIs dflags, mainFunIs dflags)
+ mainis = (mainModIs, mainFunIs)
-- pkgopts = (thisPackage dflags, sort $ packageFlags dflags)
- safeHs = setSafeMode $ safeHaskell dflags
+ safeHs = setSafeMode safeHaskell
-- oflags = sort $ filter filterOFlags $ flags dflags
- -- eflags = sort $ filter filterEFlags $ extensionFlags dflags
- flagOpts = (mainis, safeHs)
- in computeFingerprint nameio flagOpts
+ -- *all* the extension flags and the language
+ lang = (fmap fromEnum language,
+ sort $ map fromEnum $ extensionFlags)
+
+ -- -I, -D and -U flags affect CPP
+ cpp = (includePaths, sOpt_P settings)
+
+ -- -i, -osuf, -hcsuf, -hisuf, -odir, -hidir, -stubdir, -o, -ohi
+ paths = (importPaths,
+ [ objectSuf, hcSuf, hiSuf ],
+ [ objectDir, hiDir, stubDir, outputFile, outputHi ])
+
+ in computeFingerprint nameio (mainis, safeHs, lang, cpp, paths)
{-
-- | Should the @DynFlag@ be included in the fingerprint?
@@ -67,16 +79,6 @@ filterOFlags Opt_SSE2 = True
filterOFlags Opt_SSE4_2 = True
filterOFlags Opt_PackageTrust = True
filterOFlags _ = False
-
--- | Should the @ExtensionFlag@ be included in the fingerprint?
-filterEFlags :: ExtensionFlag -> Bool
-filterEFlags Opt_ExtendedDefaultRules = True
-filterEFlags Opt_InterruptibleFFI = True
-filterEFlags Opt_ImplicitParams = True
-filterEFlags Opt_ImplicitPrelude = True
-filterEFlags Opt_OverloadedStrings = True
-filterEFlags Opt_RebindableSyntax = True
-filterEFlags _ = False
-}
-- -----------------------------------------------------------------------------