diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-02-28 09:28:09 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-05-03 18:44:51 +0100 |
commit | ff1e90cc84498f7bc4d303970860a7d04e90f465 (patch) | |
tree | 68c20a472560c9f5a230181be116682db1ff2b1d | |
parent | 8bafc223b8f31aa6f8d7bef1d20972e6d324c280 (diff) | |
download | haskell-ff1e90cc84498f7bc4d303970860a7d04e90f465.tar.gz |
Omit -osuf/-odir -hisuf/-hidir and -stubdir from the flag checker
The reasoning is that GHC will only skip recompilation if it has found
a valid up-to-date object file and .hi file, so there is no need to
also check that these flags have not changed, and indeed there are
valid reasons to want to change them.
-rw-r--r-- | compiler/iface/FlagChecker.hs | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs index 9398b6c6cb..0365be7338 100644 --- a/compiler/iface/FlagChecker.hs +++ b/compiler/iface/FlagChecker.hs @@ -40,12 +40,8 @@ fingerprintDynFlags DynFlags{..} this_mod nameio = cpp = (map normalise includePaths, sOpt_P settings) -- normalise: eliminate spurious differences due to "./foo" vs "foo" - -- -i, -osuf, -hcsuf, -hisuf, -odir, -hidir, -stubdir, -o, -ohi - paths = (map normalise importPaths, - [ objectSuf, hcSuf, hiSuf ], - [ objectDir, hiDir, stubDir, outputHi ]) - -- NB. not outputFile, we don't want "ghc --make M -o <file>" - -- to force recompilation when <file> changes. + -- Note [path flags and recompilation] + paths = [ hcSuf ] -- -fprof-auto etc. prof = if opt_SccProfilingOn then fromEnum profAuto else 0 @@ -53,3 +49,33 @@ fingerprintDynFlags DynFlags{..} this_mod nameio = in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths)) $ computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof) + +{- Note [path flags and recompilation] + +There are several flags that we deliberately omit from the +recompilation check; here we explain why. + +-osuf, -odir, -hisuf, -hidir + If GHC decides that it does not need to recompile, then + it must have found an up-to-date .hi file and .o file. + There is no point recording these flags - the user must + have passed the correct ones. Indeed, the user may + have compiled the source file in one-shot mode using + -o to specify the .o file, and then loaded it in GHCi + using -odir. + +-stubdir + We omit this one because it is automatically set by -outputdir, and + we don't want changes in -outputdir to automatically trigger + recompilation. This could be wrong, but only in very rare cases. + +-i (importPaths) + For the same reason as -osuf etc. above: if GHC decides not to + recompile, then it must have already checked all the .hi files on + which the current module depends, so it must have found them + successfully. It is occasionally useful to be able to cd to a + different directory and use -i flags to enable GHC to find the .hi + files; we don't want this to force recompilation. + +The only path-related flag left is -hcsuf. +-} |