[commit: ghc] master: Set the default way correctly when dynamic-by-default (df2bcd8)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/df2bcd8a51f3b4cc4879767b99f28742917e53e5

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

commit df2bcd8a51f3b4cc4879767b99f28742917e53e5
Author: Ian Lynagh <[email protected]>
Date:   Thu Oct 25 03:01:56 2012 +0100

    Set the default way correctly when dynamic-by-default

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

 compiler/main/DynFlags.hs |   12 +++++++++---
 ghc/Main.hs               |    2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 121c85f..47756c5 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -66,6 +66,7 @@ module DynFlags (
 
         -- ** Manipulating DynFlags
         defaultDynFlags,                -- Settings -> DynFlags
+        defaultWays,
         initDynFlags,                   -- DynFlags -> IO DynFlags
         defaultFatalMessager,
         defaultLogAction,
@@ -1183,9 +1184,9 @@ defaultDynFlags mySettings =
         packageFlags            = [],
         pkgDatabase             = Nothing,
         pkgState                = panic "no package state yet: call GHC.setSessionDynFlags",
-        ways                    = [],
-        buildTag                = mkBuildTag [],
-        rtsBuildTag             = mkBuildTag [],
+        ways                    = defaultWays mySettings,
+        buildTag                = mkBuildTag (defaultWays mySettings),
+        rtsBuildTag             = mkBuildTag (defaultWays mySettings),
         splitInfo               = Nothing,
         settings                = mySettings,
         -- ghc -M values
@@ -1240,6 +1241,11 @@ defaultDynFlags mySettings =
         interactivePrint = Nothing
       }
 
+defaultWays :: Settings -> [Way]
+defaultWays settings = if pc_dYNAMIC_BY_DEFAULT (sPlatformConstants settings)
+                       then [WayDyn]
+                       else []
+
 --------------------------------------------------------------------------
 
 type FatalMessager = String -> IO ()
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 37b7f31..f05ddab 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -292,7 +292,7 @@ checkOptions mode dflags srcs objs = do
         hPutStrLn stderr ("Warning: -debug, -threaded and -ticky are ignored by GHCi")
 
         -- -prof and --interactive are not a good combination
-   when (notNull (filter (not . wayRTSOnly) (ways dflags))
+   when ((filter (not . wayRTSOnly) (ways dflags) /= defaultWays (settings dflags))
          && isInterpretiveMode mode) $
       do ghcError (UsageError
                    "--interactive can't be used with -prof or -unreg.")
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.