X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FErrUtils.lhs;h=5d3609cb769569b13ed4e0f91ead190eba437609;hb=17629712b35948e3751a39747dcc9ee0cbfb72aa;hp=a566b6e213052e1dd5d1efdafa968ecf0ca24bcd;hpb=aadb6d6d40a7e8b74a482ffa3a0777dd0b754c4f;p=ghc-hetmet.git diff --git a/ghc/compiler/main/ErrUtils.lhs b/ghc/compiler/main/ErrUtils.lhs index a566b6e..5d3609c 100644 --- a/ghc/compiler/main/ErrUtils.lhs +++ b/ghc/compiler/main/ErrUtils.lhs @@ -12,8 +12,11 @@ module ErrUtils ( printErrorsAndWarnings, pprBagOfErrors, pprBagOfWarnings, + printError, ghcExit, - doIfSet, doIfSet_dyn, dumpIfSet, dumpIfSet_core, dumpIfSet_dyn, showPass + doIfSet, doIfSet_dyn, + dumpIfSet, dumpIfSet_core, dumpIfSet_dyn, dumpIfSet_dyn_or, + showPass ) where #include "HsVersions.h" @@ -25,7 +28,7 @@ import Outputable import CmdLineOpts ( DynFlags(..), DynFlag(..), dopt ) import System ( ExitCode(..), exitWith ) -import IO ( hPutStr, stderr ) +import IO ( hPutStr, hPutStrLn, stderr ) \end{code} \begin{code} @@ -67,6 +70,10 @@ dontAddErrLoc msg = (noSrcLoc, msg) \end{code} +\begin{code} +printError :: String -> IO () +printError str = hPutStrLn stderr str +\end{code} \begin{code} type Messages = (Bag WarnMsg, Bag ErrMsg) @@ -141,6 +148,13 @@ dumpIfSet_dyn dflags flag hdr doc | dopt flag dflags || verbosity dflags >= 4 = printDump (dump hdr doc) | otherwise = return () +dumpIfSet_dyn_or :: DynFlags -> [DynFlag] -> String -> SDoc -> IO () +dumpIfSet_dyn_or dflags flags hdr doc + | or [dopt flag dflags | flag <- flags] + || verbosity dflags >= 4 + = printDump (dump hdr doc) + | otherwise = return () + dump hdr doc = vcat [text "", line <+> text hdr <+> line,