[commit: ghc] master: Ignore requests to use backends that aren't available; fixes #5145 (4915e56)
Ian Lynagh
igloo at earth.li
Sun May 1 18:55:32 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/4915e566cb661aa934e133c7c9b21c0d1964490a
>---------------------------------------------------------------
commit 4915e566cb661aa934e133c7c9b21c0d1964490a
Author: Ian Lynagh <igloo at earth.li>
Date: Sun May 1 16:19:06 2011 +0100
Ignore requests to use backends that aren't available; fixes #5145
Now if you try to use "-fasm" with an unreg compiler, for example,
you just get a warning saying it's being ignored.
>---------------------------------------------------------------
compiler/main/CodeOutput.lhs | 3 +--
compiler/main/DynFlags.hs | 25 +++++++++++++++++++++----
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/compiler/main/CodeOutput.lhs b/compiler/main/CodeOutput.lhs
index 7cfc2e9..f5e3394 100644
--- a/compiler/main/CodeOutput.lhs
+++ b/compiler/main/CodeOutput.lhs
@@ -156,8 +156,7 @@ outputAsm dflags filenm flat_absC
nativeCodeGen dflags f ncg_uniqs flat_absC
| otherwise
- = pprPanic "This compiler was built without a native code generator"
- (text "Use -fvia-C instead")
+ = panic "This compiler was built without a native code generator"
\end{code}
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index c7e0465..7e15aa4 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2039,11 +2039,28 @@ setTarget l = upd set
-- not from bytecode to object-code. The idea is that -fasm/-fllvm
-- can be safely used in an OPTIONS_GHC pragma.
setObjTarget :: HscTarget -> DynP ()
-setObjTarget l = upd set
+setObjTarget l = updM set
where
- set dfs
- | isObjectTarget (hscTarget dfs) = dfs { hscTarget = l }
- | otherwise = dfs
+ set dflags
+ | isObjectTarget (hscTarget dflags)
+ = case l of
+ HscC
+ | cGhcUnregisterised /= "YES" ->
+ do addWarn ("Compiler not unregisterised, so ignoring " ++
+ showHscTargetFlag l)
+ return dflags
+ HscAsm
+ | cGhcWithNativeCodeGen /= "YES" ->
+ do addWarn ("Compiler has no native codegen, so ignoring " ++
+ showHscTargetFlag l)
+ return dflags
+ HscLlvm
+ | cGhcUnregisterised == "YES" ->
+ do addWarn ("Compiler unregisterised, so ignoring " ++
+ showHscTargetFlag l)
+ return dflags
+ _ -> return $ dflags { hscTarget = l }
+ | otherwise = return dflags
setOptLevel :: Int -> DynFlags -> DynP DynFlags
setOptLevel n dflags
More information about the Cvs-ghc
mailing list