diff options
Diffstat (limited to 'compiler/main/StaticFlags.hs')
| -rw-r--r-- | compiler/main/StaticFlags.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index fa4b61e287..68954a87e0 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -20,6 +20,8 @@ ----------------------------------------------------------------------------- module StaticFlags ( + unsafeGlobalDynFlags, setUnsafeGlobalDynFlags, + staticFlags, initStaticOpts, @@ -70,6 +72,8 @@ module StaticFlags ( #include "HsVersions.h" +import {-# SOURCE #-} DynFlags (DynFlags) + import FastString import Util import Maybes ( firstJusts ) @@ -80,6 +84,23 @@ import Data.IORef import System.IO.Unsafe ( unsafePerformIO ) import Data.List +-------------------------------------------------------------------------- +-- Do not use unsafeGlobalDynFlags! +-- +-- unsafeGlobalDynFlags is a hack, necessary because we need to be able +-- to show SDocs when tracing, but we don't always have DynFlags +-- available. +-- +-- Do not use it if you can help it. You may get the wrong value! + +GLOBAL_VAR(v_unsafeGlobalDynFlags, panic "v_unsafeGlobalDynFlags: not initialised", DynFlags) + +unsafeGlobalDynFlags :: DynFlags +unsafeGlobalDynFlags = unsafePerformIO $ readIORef v_unsafeGlobalDynFlags + +setUnsafeGlobalDynFlags :: DynFlags -> IO () +setUnsafeGlobalDynFlags = writeIORef v_unsafeGlobalDynFlags + ----------------------------------------------------------------------------- -- Static flags |
