
Hi, It seems to me that "newSession" does not exist. But it is used in comments and error messages. % grep -r newSession * compiler/main/DynFlags.hs:-- | Used by 'GHC.newSession' to partially initialize a new 'DynFlags' value compiler/main/DynFlags.hs:-- and must be fully initialized by 'GHC.newSession' first. compiler/main/StaticFlags.hs: when ready $ throwGhcExceptionIO (ProgramError "Too late for parseStaticFlags: call it before newSession") compiler/main/StaticFlags.hs: then panic "Static flags have not been initialised!\n Please call GHC.newSession or GHC.parseStaticFlags early enough." I think they should be updated. --Kazu

On 2013-09-25 at 04:52:33 +0200, Kazu Yamamoto (山本和彦) wrote:
It seems to me that "newSession" does not exist. But it is used in comments and error messages.
fwiw, it seems to have been removed back in 2008: http://git.haskell.org/ghc.git/commitdiff/1c7d0ac0a433f85effeb5e9cfb6b303c26...

fwiw, it seems to have been removed back in 2008:
http://git.haskell.org/ghc.git/commitdiff/1c7d0ac0a433f85effeb5e9cfb6b303c26...
Herbert, thank you! Austin, would you check the following patch and apply it if it seems OK? --Kazu diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d52835d..d5c65d9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1250,7 +1250,7 @@ dynamicTooMkDynamicDynFlags dflags0 ----------------------------------------------------------------------------- --- | Used by 'GHC.newSession' to partially initialize a new 'DynFlags' value +-- | Used by 'GHC.runGhc' and 'GHC.runGhcT' to partially initialize a new 'DynFlags' value initDynFlags :: DynFlags -> IO DynFlags initDynFlags dflags = do let -- We can't build with dynamic-too on Windows, as labels before @@ -1287,7 +1287,7 @@ 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. +-- and must be fully initialized by 'GHC.runGhc' or 'GHC.runGhcT' first. defaultDynFlags :: Settings -> DynFlags defaultDynFlags mySettings = DynFlags { diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 1eb01ca..8b82f17 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -81,7 +81,7 @@ parseStaticFlagsFull :: [Flag IO] -> [Located String] -> IO ([Located String], [Located String]) parseStaticFlagsFull flagsAvailable args = do ready <- readIORef v_opt_C_ready - when ready $ throwGhcExceptionIO (ProgramError "Too late for parseStaticFlags: call it before newSession") + when ready $ throwGhcExceptionIO (ProgramError "Too late for parseStaticFlags: call it before runGhc or runGhcT") (leftover, errs, warns) <- processArgs flagsAvailable args when (not (null errs)) $ throwGhcExceptionIO $ errorsToGhcException errs @@ -100,7 +100,7 @@ staticFlags :: [String] staticFlags = unsafePerformIO $ do ready <- readIORef v_opt_C_ready if (not ready) - then panic "Static flags have not been initialised!\n Please call GHC.newSession or GHC.parseStaticFlags early enough." + then panic "Static flags have not been initialised!\n Please call GHC.parseStaticFlags early enough." else readIORef v_opt_C -- All the static flags should appear in this list. It describes how each

Kazu,
Thanks for the patch. Applied.
On Tue, Oct 1, 2013 at 7:34 PM, Kazu Yamamoto
fwiw, it seems to have been removed back in 2008:
http://git.haskell.org/ghc.git/commitdiff/1c7d0ac0a433f85effeb5e9cfb6b303c26...
Herbert, thank you!
Austin, would you check the following patch and apply it if it seems OK?
--Kazu
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d52835d..d5c65d9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1250,7 +1250,7 @@ dynamicTooMkDynamicDynFlags dflags0
-----------------------------------------------------------------------------
--- | Used by 'GHC.newSession' to partially initialize a new 'DynFlags' value +-- | Used by 'GHC.runGhc' and 'GHC.runGhcT' to partially initialize a new 'DynFlags' value initDynFlags :: DynFlags -> IO DynFlags initDynFlags dflags = do let -- We can't build with dynamic-too on Windows, as labels before @@ -1287,7 +1287,7 @@ 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. +-- and must be fully initialized by 'GHC.runGhc' or 'GHC.runGhcT' first. defaultDynFlags :: Settings -> DynFlags defaultDynFlags mySettings = DynFlags { diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 1eb01ca..8b82f17 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -81,7 +81,7 @@ parseStaticFlagsFull :: [Flag IO] -> [Located String] -> IO ([Located String], [Located String]) parseStaticFlagsFull flagsAvailable args = do ready <- readIORef v_opt_C_ready - when ready $ throwGhcExceptionIO (ProgramError "Too late for parseStaticFlags: call it before newSession") + when ready $ throwGhcExceptionIO (ProgramError "Too late for parseStaticFlags: call it before runGhc or runGhcT")
(leftover, errs, warns) <- processArgs flagsAvailable args when (not (null errs)) $ throwGhcExceptionIO $ errorsToGhcException errs @@ -100,7 +100,7 @@ staticFlags :: [String] staticFlags = unsafePerformIO $ do ready <- readIORef v_opt_C_ready if (not ready) - then panic "Static flags have not been initialised!\n Please call GHC.newSession or GHC.parseStaticFlags early enough." + then panic "Static flags have not been initialised!\n Please call GHC.parseStaticFlags early enough." else readIORef v_opt_C
-- All the static flags should appear in this list. It describes how each _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
-- Austin Seipp, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/
participants (3)
-
Austin Seipp
-
Herbert Valerio Riedel
-
Kazu Yamamoto