[commit: packages/Cabal] ghc-head: For cabal repl, filter out flags that cause warnings (3a1ed8d)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:29:44 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=3a1ed8d16958d1175ca31fa4b997041e725878c9

>---------------------------------------------------------------

commit 3a1ed8d16958d1175ca31fa4b997041e725878c9
Author: Duncan Coutts <duncan at community.haskell.org>
Date:   Mon Aug 12 02:11:25 2013 +0100

    For cabal repl, filter out flags that cause warnings
    
    Like -O -threaded -prof -debug etc.


>---------------------------------------------------------------

3a1ed8d16958d1175ca31fa4b997041e725878c9
 Cabal/Distribution/Simple/GHC.hs |   23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs
index a05e39b..04d4704 100644
--- a/Cabal/Distribution/Simple/GHC.hs
+++ b/Cabal/Distribution/Simple/GHC.hs
@@ -713,7 +713,10 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do
                       ghcOptExtra       = ghcSharedOptions libBi
                     }
       
-      replOpts    = vanillaOpts `mappend` mempty {
+      replOpts    = vanillaOpts {
+                      ghcOptExtra        = filterGhciFlags (ghcOptExtra vanillaOpts)
+                    }
+                    `mappend` mempty {
                       ghcOptMode         = toFlag GhcModeInteractive,
                       ghcOptOptimisation = toFlag GhcNoOptimisation
                     }
@@ -944,7 +947,10 @@ buildOrReplExe forRepl verbosity _pkg_descr lbi
                       ghcOptDynHiSuffix    = toFlag "dyn_hi",
                       ghcOptDynObjSuffix   = toFlag "dyn_o"
                     }
-      replOpts   = baseOpts `mappend` mempty {
+      replOpts   = baseOpts {
+                      ghcOptExtra          = filterGhciFlags (ghcOptExtra baseOpts)
+                   }
+                   `mappend` mempty {
                       ghcOptMode           = toFlag GhcModeInteractive,
                       ghcOptOptimisation   = toFlag GhcNoOptimisation
                    }
@@ -1032,6 +1038,19 @@ hackThreadedFlag verbosity comp prof bi
       [ (hc, if hc == GHC then filter p opts else opts)
       | (hc, opts) <- hcoptss ]
 
+-- | Strip out flags that are not supported in ghci
+filterGhciFlags :: [String] -> [String]
+filterGhciFlags = filter supported
+  where
+    supported ('-':'O':_) = False
+    supported "-debug"    = False
+    supported "-threaded" = False
+    supported "-ticky"    = False
+    supported "-eventlog" = False
+    supported "-prof"     = False
+    supported "-unreg"    = False
+    supported _           = True
+
 -- when using -split-objs, we need to search for object files in the
 -- Module_split directory for each module.
 getHaskellObjects :: Library -> LocalBuildInfo





More information about the ghc-commits mailing list