projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update copyrights in rts/sm
[ghc-hetmet.git]
/
compiler
/
main
/
GHC.hs
diff --git
a/compiler/main/GHC.hs
b/compiler/main/GHC.hs
index
ec62de5
..
f08b613
100644
(file)
--- a/
compiler/main/GHC.hs
+++ b/
compiler/main/GHC.hs
@@
-239,7
+239,7
@@
import CoreSyn
import TidyPgm
import DriverPipeline
import DriverPhases ( HscSource(..), Phase(..), isHaskellSrcFilename, startPhase )
import TidyPgm
import DriverPipeline
import DriverPhases ( HscSource(..), Phase(..), isHaskellSrcFilename, startPhase )
-import HeaderInfo ( getImports, getOptions )
+import HeaderInfo
import Finder
import HscMain
import HscTypes
import Finder
import HscMain
import HscTypes
@@
-248,17
+248,14
@@
import StaticFlags
import SysTools ( initSysTools, cleanTempFiles, cleanTempFilesExcept,
cleanTempDirs )
import Module
import SysTools ( initSysTools, cleanTempFiles, cleanTempFilesExcept,
cleanTempDirs )
import Module
-import UniqFM
+import LazyUniqFM
import UniqSet
import Unique
import FiniteMap
import Panic
import Digraph
import Bag ( unitBag, listToBag )
import UniqSet
import Unique
import FiniteMap
import Panic
import Digraph
import Bag ( unitBag, listToBag )
-import ErrUtils ( Severity(..), showPass, fatalErrorMsg, debugTraceMsg,
- mkPlainErrMsg, printBagOfErrors, printBagOfWarnings,
- WarnMsg )
-import qualified ErrUtils
+import ErrUtils
import Util
import StringBuffer ( StringBuffer, hGetStringBuffer )
import Outputable
import Util
import StringBuffer ( StringBuffer, hGetStringBuffer )
import Outputable
@@
-266,6
+263,7
@@
import BasicTypes
import Maybes ( expectJust, mapCatMaybes )
import HaddockParse
import HaddockLex ( tokenise )
import Maybes ( expectJust, mapCatMaybes )
import HaddockParse
import HaddockLex ( tokenise )
+import FastString
import Control.Concurrent
import System.Directory ( getModificationTime, doesFileExist,
import Control.Concurrent
import System.Directory ( getModificationTime, doesFileExist,
@@
-350,8
+348,8
@@
newSession mb_top_dir = do
installSignalHandlers
initStaticOpts
installSignalHandlers
initStaticOpts
- dflags0 <- initSysTools mb_top_dir defaultDynFlags
- dflags <- initDynFlags dflags0
+ dflags0 <- initDynFlags defaultDynFlags
+ dflags <- initSysTools mb_top_dir dflags0
env <- newHscEnv dflags
ref <- newIORef env
return (Session ref)
env <- newHscEnv dflags
ref <- newIORef env
return (Session ref)
@@
-1605,7
+1603,7
@@
warnUnnecessarySourceImports dflags sccs =
warn :: Located ModuleName -> WarnMsg
warn (L loc mod) =
mkPlainErrMsg loc
warn :: Located ModuleName -> WarnMsg
warn (L loc mod) =
mkPlainErrMsg loc
- (ptext SLIT("Warning: {-# SOURCE #-} unnecessary in import of ")
+ (ptext (sLit "Warning: {-# SOURCE #-} unnecessary in import of ")
<+> quotes (ppr mod))
-----------------------------------------------------------------------------
<+> quotes (ppr mod))
-----------------------------------------------------------------------------
@@
-1662,7
+1660,7
@@
downsweep hsc_env old_summaries excl_mods allow_dup_roots
Nothing -> packageModErr modl
Just s -> return s
Nothing -> packageModErr modl
Just s -> return s
- rootLoc = mkGeneralSrcSpan FSLIT("<command line>")
+ rootLoc = mkGeneralSrcSpan (fsLit "<command line>")
-- In a root module, the filename is allowed to diverge from the module
-- name, so we have to check that there aren't multiple root files
-- In a root module, the filename is allowed to diverge from the module
-- name, so we have to check that there aren't multiple root files
@@
-1771,7
+1769,7
@@
summariseFile hsc_env old_summaries file mb_phase maybe_buf
let dflags = hsc_dflags hsc_env
(dflags', hspp_fn, buf)
let dflags = hsc_dflags hsc_env
(dflags', hspp_fn, buf)
- <- preprocessFile dflags file mb_phase maybe_buf
+ <- preprocessFile hsc_env file mb_phase maybe_buf
(srcimps,the_imps, L _ mod_name) <- getImports dflags' buf hspp_fn file
(srcimps,the_imps, L _ mod_name) <- getImports dflags' buf hspp_fn file
@@
-1892,13
+1890,14
@@
summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod) maybe_buf exc
= do
-- Preprocess the source file and get its imports
-- The dflags' contains the OPTIONS pragmas
= do
-- Preprocess the source file and get its imports
-- The dflags' contains the OPTIONS pragmas
- (dflags', hspp_fn, buf) <- preprocessFile dflags src_fn Nothing maybe_buf
+ (dflags', hspp_fn, buf) <- preprocessFile hsc_env src_fn Nothing maybe_buf
(srcimps, the_imps, L mod_loc mod_name) <- getImports dflags' buf hspp_fn src_fn
when (mod_name /= wanted_mod) $
throwDyn $ mkPlainErrMsg mod_loc $
(srcimps, the_imps, L mod_loc mod_name) <- getImports dflags' buf hspp_fn src_fn
when (mod_name /= wanted_mod) $
throwDyn $ mkPlainErrMsg mod_loc $
- text "file name does not match module name"
- <+> quotes (ppr mod_name)
+ text "File name does not match module name:"
+ $$ text "Saw:" <+> quotes (ppr mod_name)
+ $$ text "Expected:" <+> quotes (ppr wanted_mod)
-- Find the object timestamp, and return the summary
obj_timestamp <- getObjTimestamp location is_boot
-- Find the object timestamp, and return the summary
obj_timestamp <- getObjTimestamp location is_boot
@@
-1921,22
+1920,24
@@
getObjTimestamp location is_boot
else modificationTimeIfExists (ml_obj_file location)
else modificationTimeIfExists (ml_obj_file location)
-preprocessFile :: DynFlags -> FilePath -> Maybe Phase -> Maybe (StringBuffer,ClockTime)
+preprocessFile :: HscEnv -> FilePath -> Maybe Phase -> Maybe (StringBuffer,ClockTime)
-> IO (DynFlags, FilePath, StringBuffer)
-> IO (DynFlags, FilePath, StringBuffer)
-preprocessFile dflags src_fn mb_phase Nothing
+preprocessFile hsc_env src_fn mb_phase Nothing
= do
= do
- (dflags', hspp_fn) <- preprocess dflags (src_fn, mb_phase)
+ (dflags', hspp_fn) <- preprocess hsc_env (src_fn, mb_phase)
buf <- hGetStringBuffer hspp_fn
return (dflags', hspp_fn, buf)
buf <- hGetStringBuffer hspp_fn
return (dflags', hspp_fn, buf)
-preprocessFile dflags src_fn mb_phase (Just (buf, _time))
+preprocessFile hsc_env src_fn mb_phase (Just (buf, _time))
= do
= do
+ let dflags = hsc_dflags hsc_env
-- case we bypass the preprocessing stage?
let
-- case we bypass the preprocessing stage?
let
- local_opts = getOptions buf src_fn
+ local_opts = getOptions dflags buf src_fn
--
--
- (dflags', _errs) <- parseDynamicFlags dflags (map unLoc local_opts)
- -- XXX: shouldn't we be reporting the errors?
+ (dflags', leftovers, warns) <- parseDynamicFlags dflags (map unLoc local_opts)
+ checkProcessArgsResult leftovers src_fn
+ handleFlagWarnings dflags' warns
let
needs_preprocessing
let
needs_preprocessing
@@
-1984,11
+1985,11
@@
multiRootsErr summs@(summ1:_)
cyclicModuleErr :: [ModSummary] -> SDoc
cyclicModuleErr ms
cyclicModuleErr :: [ModSummary] -> SDoc
cyclicModuleErr ms
- = hang (ptext SLIT("Module imports form a cycle for modules:"))
+ = hang (ptext (sLit "Module imports form a cycle for modules:"))
2 (vcat (map show_one ms))
where
show_one ms = sep [ show_mod (ms_hsc_src ms) (ms_mod ms),
2 (vcat (map show_one ms))
where
show_one ms = sep [ show_mod (ms_hsc_src ms) (ms_mod ms),
- nest 2 $ ptext SLIT("imports:") <+>
+ nest 2 $ ptext (sLit "imports:") <+>
(pp_imps HsBootFile (ms_srcimps ms)
$$ pp_imps HsSrcFile (ms_imps ms))]
show_mod hsc_src mod = ppr mod <> text (hscSourceString hsc_src)
(pp_imps HsBootFile (ms_srcimps ms)
$$ pp_imps HsSrcFile (ms_imps ms))]
show_mod hsc_src mod = ppr mod <> text (hscSourceString hsc_src)