Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/cddbf8668181306f6c2ae87ff33f1cba9f7f1f6a >--------------------------------------------------------------- commit cddbf8668181306f6c2ae87ff33f1cba9f7f1f6a Author: Ian Lynagh <i...@well-typed.com> Date: Mon Oct 1 19:32:01 2012 +0100 Allow -static to be used after -dynamic It's still the case that -dynamic -static will leave -fPIC enabled, but it's tricky to avoid that, and we already have similar situations where for example -XRankNTypes -XNoRankNTypes will leave ExplicitForAll enabled. >--------------------------------------------------------------- compiler/main/DynFlags.hs | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 5f76839..d29601b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1779,13 +1779,10 @@ dynamic_flags = [ -- is required to get the RTS ticky support. ----- Linker -------------------------------------------------------- - -- -static is the default. If -dynamic has been given then, due to the - -- way wayExtras is currently used, we've already set -DDYNAMIC etc. - -- It's too fiddly to undo that, so we just give an error if - -- Opt_Static has been unset. - , Flag "static" (noArgM (\dfs -> do unless (dopt Opt_Static dfs) (addErr "Can't use -static after -dynamic") - return dfs)) - , Flag "dynamic" (NoArg (unSetDynFlag Opt_Static >> addWay WayDyn)) + , Flag "static" (NoArg (do setDynFlag Opt_Static + removeWay WayDyn)) + , Flag "dynamic" (NoArg (do unSetDynFlag Opt_Static + addWay WayDyn)) -- ignored for compat w/ gcc: , Flag "rdynamic" (NoArg (return ())) @@ -2737,6 +2734,9 @@ addWay w = do upd (\dfs -> dfs { ways = w : ways dfs }) dfs <- liftEwM getCmdLineState wayExtras (targetPlatform dfs) w +removeWay :: Way -> DynP () +removeWay w = upd (\dfs -> dfs { ways = filter (w /=) (ways dfs) }) + -------------------------- setDynFlag, unSetDynFlag :: DynFlag -> DynP () setDynFlag f = upd (\dfs -> dopt_set dfs f) _______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc