newSession

Kazu Yamamoto 山本和彦 kazu
Wed Oct 2 00:34:45 UTC 2013


> fwiw, it seems to have been removed back in 2008:
> 
>   http://git.haskell.org/ghc.git/commitdiff/1c7d0ac0a433f85effeb5e9cfb6b303c26b201d1
> 

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



More information about the ghc-devs mailing list