summaryrefslogtreecommitdiff
path: root/compiler/main
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-06-12 23:29:53 +0100
committerIan Lynagh <igloo@earth.li>2012-06-12 23:29:53 +0100
commit37f9861ff65552c2bb6a85c3b27e0228275bc0b6 (patch)
tree538f2a3dfd6e50733c4c1a5e700febea939129c2 /compiler/main
parent1eda228cf487643e422c20effc8163e71b46efa2 (diff)
downloadhaskell-37f9861ff65552c2bb6a85c3b27e0228275bc0b6.tar.gz
Make tracingDynFlags slightly more defined
In particular, fields like 'flags' are now set to the default, so at least they will work to some extent.
Diffstat (limited to 'compiler/main')
-rw-r--r--compiler/main/DynFlags.hs17
-rw-r--r--compiler/main/DynFlags.hs-boot2
2 files changed, 17 insertions, 2 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 8bbf364ce8..b83248064b 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -95,12 +95,15 @@ module DynFlags (
getStgToDo,
-- * Compiler configuration suitable for display to the user
- compilerInfo
+ compilerInfo,
+
#ifdef GHCI
-- Only in stage 2 can we be sure that the RTS
-- exposes the appropriate runtime boolean
- , rtsIsProfiled
+ rtsIsProfiled,
#endif
+ -- ** Only for use in the tracing functions in Outputable
+ tracingDynFlags,
) where
#include "HsVersions.h"
@@ -969,6 +972,16 @@ defaultDynFlags mySettings =
llvmVersion = panic "defaultDynFlags: No llvmVersion"
}
+-- Do not use tracingDynFlags!
+-- tracingDynFlags 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. It will not reflect options set
+-- by the commandline flags, and all fields may be either wrong or
+-- undefined.
+tracingDynFlags :: DynFlags
+tracingDynFlags = defaultDynFlags tracingSettings
+ where tracingSettings = panic "Settings not defined in tracingDynFlags"
+
type FatalMessager = String -> IO ()
type LogAction = DynFlags -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO ()
diff --git a/compiler/main/DynFlags.hs-boot b/compiler/main/DynFlags.hs-boot
index f7d17f496b..7530192e1a 100644
--- a/compiler/main/DynFlags.hs-boot
+++ b/compiler/main/DynFlags.hs-boot
@@ -2,3 +2,5 @@
module DynFlags where
data DynFlags
+tracingDynFlags :: DynFlags
+