Commit bfa0c2ed authored by Ian Lynagh's avatar Ian Lynagh

Initialise Settings before DynFlags

Stops us having to temporarily have a panic in the DynFlags.
We still need a panic in the DynFlags used for the top-level
error handler, though.
parent e550494a
......@@ -43,7 +43,7 @@ module DynFlags (
-- ** Manipulating DynFlags
defaultDynFlags, -- DynFlags
defaultDynFlags, -- Settings -> DynFlags
initDynFlags, -- DynFlags -> IO DynFlags
getOpts, -- DynFlags -> (DynFlags -> [a]) -> [a]
......@@ -697,8 +697,8 @@ initDynFlags dflags = do
-- | The normal 'DynFlags'. Note that they is not suitable for use in this form
-- and must be fully initialized by 'GHC.newSession' first.
defaultDynFlags :: DynFlags
defaultDynFlags =
defaultDynFlags :: Settings -> DynFlags
defaultDynFlags mySettings =
DynFlags {
ghcMode = CompManager,
ghcLink = LinkBinary,
......@@ -774,8 +774,7 @@ defaultDynFlags =
buildTag = panic "defaultDynFlags: No buildTag",
rtsBuildTag = panic "defaultDynFlags: No rtsBuildTag",
splitInfo = Nothing,
-- initSysTools fills this in:
settings = panic "defaultDynFlags: No settings",
settings = mySettings,
-- ghc -M values
depMakefile = "Makefile",
depIncludePkgDeps = False,
......
......@@ -431,9 +431,8 @@ initGhcMonad mb_top_dir = do
liftIO $ StaticFlags.initStaticOpts
dflags0 <- liftIO $ initDynFlags defaultDynFlags
mySettings <- liftIO $ initSysTools mb_top_dir
let dflags = dflags0 { settings = mySettings }
dflags <- liftIO $ initDynFlags (defaultDynFlags mySettings)
env <- liftIO $ newHscEnv dflags
setSession env
......
......@@ -78,7 +78,8 @@ import Data.Maybe
main :: IO ()
main = do
hSetBuffering stdout NoBuffering
GHC.defaultErrorHandler defaultDynFlags $ do
let defaultErrorHandlerDynFlags = defaultDynFlags (panic "No settings")
GHC.defaultErrorHandler defaultErrorHandlerDynFlags $ do
-- 1. extract the -B flag from the args
argv0 <- getArgs
......
......@@ -10,6 +10,7 @@ import DriverPhases ( isHaskellSrcFilename )
import HscTypes ( msHsFilePath )
import Name ( getOccString )
--import ErrUtils ( printBagOfErrors )
import Panic ( panic )
import DynFlags ( defaultDynFlags )
import Bag
import Exception
......@@ -100,7 +101,7 @@ main = do
then Just `liftM` openFile "TAGS" openFileMode
else return Nothing
GHC.defaultErrorHandler defaultDynFlags $
GHC.defaultErrorHandler (defaultDynFlags (panic "No settings")) $
runGhc (Just ghc_topdir) $ do
--liftIO $ print "starting up session"
dflags <- getSessionDynFlags
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment