From: Simon Marlow Date: Tue, 8 May 2007 14:10:05 +0000 (+0000) Subject: Allow you to say :unset -f (see #1328) X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=4a6a64b9f9437e40706368bf288d62f1aa5060a5;p=ghc-hetmet.git Allow you to say :unset -f (see #1328) --- diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index ce6b69d..4fb1ad3 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -1092,8 +1092,10 @@ setOptions wds = do -- first, deal with the GHCi opts (+s, +t, etc.) let (plus_opts, minus_opts) = partition isPlus wds mapM_ setOpt plus_opts - -- then, dynamic flags + newDynFlags minus_opts + +newDynFlags minus_opts = do dflags <- getDynFlags let pkg_flags = packageFlags dflags (dflags',leftovers) <- io $ GHC.parseDynamicFlags dflags minus_opts @@ -1131,10 +1133,11 @@ unsetOptions str mapM_ unsetOpt plus_opts - -- can't do GHC flags for now - if (not (null minus_opts)) - then throwDyn (CmdLineError "can't unset GHC command-line flags") - else return () + let no_flag ('-':'f':rest) = return ("-fno-" ++ rest) + no_flag f = throwDyn (ProgramError ("don't know how to reverse " ++ f)) + + no_flags <- mapM no_flag minus_opts + newDynFlags no_flags isMinus ('-':s) = True isMinus _ = False