summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-06-18 21:25:14 +0100
committerIan Lynagh <igloo@earth.li>2012-06-18 21:41:09 +0100
commitee7c4f434d377396dc9054fb5c1d9c899cc3b287 (patch)
treea1c2302069ea39e9208d878cbd840cff5761f66a
parente6e3a960b23efa683bc04203d794e867a6c1bb27 (diff)
downloadhaskell-ee7c4f434d377396dc9054fb5c1d9c899cc3b287.tar.gz
Make -ignore-dot-ghci a dynamic flag
-rw-r--r--compiler/main/DynFlags.hs8
-rw-r--r--compiler/main/StaticFlags.hs4
-rw-r--r--docs/users_guide/flags.xml2
-rw-r--r--ghc/InteractiveUI.hs5
4 files changed, 11 insertions, 8 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 090748423b..5d8d379482 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -303,6 +303,7 @@ data DynFlag
| Opt_BuildingCabalPackage
| Opt_SSE2
| Opt_SSE4_2
+ | Opt_IgnoreDotGhci
| Opt_GhciSandbox
| Opt_GhciHistory
| Opt_HelpfulErrors
@@ -1798,6 +1799,8 @@ dynamic_flags = [
, Flag "fpackage-trust" (NoArg setPackageTrust)
, Flag "fno-safe-infer" (NoArg (setSafeHaskell Sf_None))
]
+ ++ map (mkFlag turnOn "" setDynFlag ) negatableFlags
+ ++ map (mkFlag turnOff "no-" unSetDynFlag) negatableFlags
++ map (mkFlag turnOn "d" setDynFlag ) dFlags
++ map (mkFlag turnOff "dno-" unSetDynFlag) dFlags
++ map (mkFlag turnOn "f" setDynFlag ) fFlags
@@ -1920,6 +1923,11 @@ fWarningFlags = [
( "warn-pointless-pragmas", Opt_WarnPointlessPragmas, nop ),
( "warn-unsupported-calling-conventions", Opt_WarnUnsupportedCallingConventions, nop ) ]
+-- | These @-\<blah\>@ flags can all be reversed with @-no-\<blah\>@
+negatableFlags :: [FlagSpec DynFlag]
+negatableFlags = [
+ ( "ignore-dot-ghci", Opt_IgnoreDotGhci, nop ) ]
+
-- | These @-d\<blah\>@ flags can all be reversed with @-dno-\<blah\>@
dFlags :: [FlagSpec DynFlag]
dFlags = [
diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs
index 94e1986f69..563ecf1766 100644
--- a/compiler/main/StaticFlags.hs
+++ b/compiler/main/StaticFlags.hs
@@ -76,7 +76,6 @@ module StaticFlags (
opt_Static,
-- misc opts
- opt_IgnoreDotGhci,
opt_ErrorSpans,
opt_GranMacros,
opt_HiVersion,
@@ -195,9 +194,6 @@ unpacked_opts =
expandAts l = [l]
-}
-opt_IgnoreDotGhci :: Bool
-opt_IgnoreDotGhci = lookUp (fsLit "-ignore-dot-ghci")
-
-- debugging options
-- | Suppress all that is suppressable in core dumps.
-- Except for uniques, as some simplifier phases introduce new varibles that
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index a862029ee2..650bf8f41f 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -489,7 +489,7 @@
<row>
<entry><option>-ignore-dot-ghci</option></entry>
<entry>Disable reading of <filename>.ghci</filename> files</entry>
- <entry>static</entry>
+ <entry>dynamic</entry>
<entry>-</entry>
</row>
<row>
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 9d3ff20b9a..c56f5067f9 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -49,7 +49,6 @@ import Linker
import Maybes ( orElse, expectJust )
import NameSet
import Panic hiding ( showException )
-import StaticFlags
import Util
-- Haskell Libraries
@@ -389,8 +388,9 @@ withGhcAppData right left = do
runGHCi :: [(FilePath, Maybe Phase)] -> Maybe [String] -> GHCi ()
runGHCi paths maybe_exprs = do
+ dflags <- getDynFlags
let
- read_dot_files = not opt_IgnoreDotGhci
+ read_dot_files = not (dopt Opt_IgnoreDotGhci dflags)
current_dir = return (Just ".ghci")
@@ -431,7 +431,6 @@ runGHCi paths maybe_exprs = do
setGHCContextFromGHCiState
- dflags <- getDynFlags
when (read_dot_files) $ do
mcfgs0 <- sequence $ [ current_dir, app_user_dir, home_dir ] ++ map (return . Just ) (ghciScripts dflags)
mcfgs <- liftIO $ mapM canonicalizePath' (catMaybes mcfgs0)