X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2Fmain%2FDynFlags.hs;h=52e55425090765736c9e5b1fc15b57df2f6c4752;hb=78b72ed1e0ffab668e0d4bb31657942970515e4f;hp=09932b6f200d2df538fe28dacc913dc0d58f7235;hpb=395f4b287e9c679f31ef63b9f9bd11734a691776;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DynFlags.hs b/ghc/compiler/main/DynFlags.hs index 09932b6..52e5542 100644 --- a/ghc/compiler/main/DynFlags.hs +++ b/ghc/compiler/main/DynFlags.hs @@ -56,6 +56,7 @@ import Config import CmdLineParser import Panic ( panic, GhcException(..) ) import Util ( notNull, splitLongestPrefix, split, normalisePath ) +import SrcLoc ( SrcSpan ) import DATA_IOREF ( readIORef ) import EXCEPTION ( throwDyn ) @@ -65,6 +66,9 @@ import Data.List ( isPrefixOf ) #endif import Maybe ( fromJust ) import Char ( isDigit, isUpper ) +import Outputable +import System.IO ( hPutStrLn, stderr ) +import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage ) -- ----------------------------------------------------------------------------- -- DynFlags @@ -180,7 +184,7 @@ data DynFlag | Opt_KeepTmpFiles deriving (Eq) - + data DynFlags = DynFlags { ghcMode :: GhcMode, ghcLink :: GhcLink, @@ -254,7 +258,10 @@ data DynFlags = DynFlags { pkgState :: PackageState, -- hsc dynamic flags - flags :: [DynFlag] + flags :: [DynFlag], + + -- message output + log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO () } data HscTarget @@ -295,9 +302,7 @@ data PackageFlag | IgnorePackage String defaultHscTarget -#if defined(i386_TARGET_ARCH) || defined(sparc_TARGET_ARCH) || defined(powerpc_TARGET_ARCH) | cGhcWithNativeCodeGen == "YES" = HscAsm -#endif | otherwise = HscC initDynFlags dflags = do @@ -397,7 +402,13 @@ defaultDynFlags = Opt_IgnoreInterfacePragmas, Opt_OmitInterfacePragmas - ] ++ standardWarnings + ] ++ standardWarnings, + + log_action = \severity srcSpan style msg -> + case severity of + SevInfo -> hPutStrLn stderr (show (msg style)) + SevFatal -> hPutStrLn stderr (show (msg style)) + _ -> hPutStrLn stderr ('\n':show ((mkLocMessage srcSpan msg) style)) } {- @@ -604,7 +615,6 @@ getCoreToDo dflags MaxSimplifierIterations max_iter ] ] - else {- opt_level >= 1 -} [ -- initial simplify: mk specialiser happy: minimum effort please @@ -870,7 +880,7 @@ dynamic_flags = [ , ( "dsource-stats", setDumpFlag Opt_D_source_stats) , ( "dverbose-core2core", setDumpFlag Opt_D_verbose_core2core) , ( "dverbose-stg2stg", setDumpFlag Opt_D_verbose_stg2stg) - , ( "ddump-hi-diffs", setDumpFlag Opt_D_dump_hi_diffs) + , ( "ddump-hi-diffs", NoArg (setDynFlag Opt_D_dump_hi_diffs)) , ( "ddump-hi", setDumpFlag Opt_D_dump_hi) , ( "ddump-minimal-imports", setDumpFlag Opt_D_dump_minimal_imports) , ( "ddump-vect", setDumpFlag Opt_D_dump_vect) @@ -909,6 +919,7 @@ dynamic_flags = [ ------ Compiler flags ----------------------------------------------- + , ( "fno-code", NoArg (setTarget HscNothing)) , ( "fasm", AnySuffix (\_ -> setTarget HscAsm) ) , ( "fvia-c", NoArg (setTarget HscC) ) , ( "fvia-C", NoArg (setTarget HscC) ) @@ -1043,18 +1054,17 @@ setOptLevel n dflags setMainIs :: String -> DynP () setMainIs arg - | not (null main_mod) -- The arg looked like "Foo.baz" + | not (null main_fn) -- The arg looked like "Foo.baz" = upd $ \d -> d{ mainFunIs = Just main_fn, mainModIs = Just main_mod } - | isUpper (head main_fn) -- The arg looked like "Foo" - = upd $ \d -> d{ mainModIs = Just main_fn } + | isUpper (head main_mod) -- The arg looked like "Foo" + = upd $ \d -> d{ mainModIs = Just main_mod } | otherwise -- The arg looked like "baz" - = upd $ \d -> d{ mainFunIs = Just main_fn } + = upd $ \d -> d{ mainFunIs = Just main_mod } where (main_mod, main_fn) = splitLongestPrefix arg (== '.') - ----------------------------------------------------------------------------- -- Paths & Libraries @@ -1226,7 +1236,13 @@ machdepCCOpts dflags = ( [], ["-fomit-frame-pointer", "-G0"] ) #elif x86_64_TARGET_ARCH - = ( [], ["-fomit-frame-pointer"] ) + = ( [], ["-fomit-frame-pointer", + "-fno-asynchronous-unwind-tables" + -- the unwind tables are unnecessary for HC code, + -- and get in the way of -split-objs. Another option + -- would be to throw them away in the mangler, but this + -- is easier. + ] ) #elif mips_TARGET_ARCH = ( ["-static"], [] )