summaryrefslogtreecommitdiff
path: root/ghc/InteractiveUI.hs
diff options
context:
space:
mode:
authorLennart Kolmodin <kolmodin@gmail.com>2014-11-20 23:28:34 -0600
committerAustin Seipp <austin@well-typed.com>2014-11-20 23:32:16 -0600
commit417809baaf7d1fc6a7c708fa195ace277059c3d3 (patch)
tree850eca2017a80024cbe41115590aa0c955bffceb /ghc/InteractiveUI.hs
parentc6322eebea61dd29d0dab698cb89334596851b9d (diff)
downloadhaskell-wip/merge.tar.gz
ghc allow --show-options and --interactive togetherwip/merge
Summary: Previously --show-options showed all options that GHC accepts. Now, it'll only show the options that have effect in non-interactive modes. This change also adds support for using --interactive together with --show-options, making it show all options that have effect in the interactive mode. The CmdLineParser is updated to know about ghc modes, and then each flag is annotated with which mode it has effect. This fixes #9259. Test Plan: Try out --show-options with --interactive on the command line. With and without --interactive should give different results. Reviewers: austin Reviewed By: austin Subscribers: jstolarek, thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D337 GHC Trac Issues: #9259 Conflicts: compiler/main/DynFlags.hs
Diffstat (limited to 'ghc/InteractiveUI.hs')
-rw-r--r--ghc/InteractiveUI.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 03a67905a7..35a86a5e5a 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -2021,11 +2021,13 @@ showDynFlags show_all dflags = do
text "warning settings:" $$
nest 2 (vcat (map (setting wopt) DynFlags.fWarningFlags))
where
- setting test (str, f, _)
+ setting test flag
| quiet = empty
- | is_on = fstr str
- | otherwise = fnostr str
- where is_on = test f dflags
+ | is_on = fstr name
+ | otherwise = fnostr name
+ where name = flagSpecName flag
+ f = flagSpecFlag flag
+ is_on = test f dflags
quiet = not show_all && test f default_dflags == is_on
default_dflags = defaultDynFlags (settings dflags)
@@ -2033,7 +2035,7 @@ showDynFlags show_all dflags = do
fstr str = text "-f" <> text str
fnostr str = text "-fno-" <> text str
- (ghciFlags,others) = partition (\(_, f, _) -> f `elem` flgs)
+ (ghciFlags,others) = partition (\f -> flagSpecFlag f `elem` flgs)
DynFlags.fFlags
flgs = [ Opt_PrintExplicitForalls
, Opt_PrintExplicitKinds
@@ -2382,11 +2384,13 @@ showLanguages' show_all dflags =
nest 2 (vcat (map (setting xopt) DynFlags.xFlags))
]
where
- setting test (str, f, _)
+ setting test flag
| quiet = empty
- | is_on = text "-X" <> text str
- | otherwise = text "-XNo" <> text str
- where is_on = test f dflags
+ | is_on = text "-X" <> text name
+ | otherwise = text "-XNo" <> text name
+ where name = flagSpecName flag
+ f = flagSpecFlag flag
+ is_on = test f dflags
quiet = not show_all && test f default_dflags == is_on
default_dflags =