diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-11-10 11:14:20 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-11-10 13:25:31 +0000 |
commit | 9df7f9b4022ffda25f004cb099de358d7d240fc1 (patch) | |
tree | 82fe29fe989956f74c23e18f1c0eaf150a61727b /compiler | |
parent | 40b2a22ccea70131d0633853a07d9769511af334 (diff) | |
download | haskell-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')
-rw-r--r-- | compiler/iface/FlagChecker.hs | 40 | ||||
-rw-r--r-- | compiler/iface/MkIface.lhs | 3 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 3 |
3 files changed, 24 insertions, 22 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 -} -- ----------------------------------------------------------------------------- diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index a44c400634..f633d8f38e 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -1189,8 +1189,7 @@ checkVersions hsc_env mod_summary iface mod_deps :: ModuleNameEnv (ModuleName, IsBootInterface) mod_deps = mkModDeps (dep_mods (mi_deps iface)) --- | Check the safe haskell flags haven't changed --- (e.g different flag on command line now) +-- | Check the flags haven't changed checkFlagHash :: HscEnv -> ModIface -> IfG RecompileRequired checkFlagHash hsc_env iface = do let old_hash = mi_flag_hash iface diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 64e857565a..19bce9f82f 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -340,6 +340,7 @@ data WarningFlag = deriving (Eq, Show) data Language = Haskell98 | Haskell2010 + deriving Enum -- | The various Safe Haskell modes data SafeHaskellMode @@ -435,7 +436,7 @@ data ExtensionFlag | Opt_NondecreasingIndentation | Opt_RelaxedLayout | Opt_TraditionalRecordSyntax - deriving (Eq, Show) + deriving (Eq, Enum, Show) -- | Contains not only a collection of 'DynFlag's but also a plethora of -- information relating to the compilation of a single file or GHC session |