\begin{code}
module ErrUtils (
- ErrMsg, WarnMsg, Message, Messages, errorsFound,
+ ErrMsg, WarnMsg, Message, Messages, errorsFound, warningsFound,
addShortErrLocLine, addShortWarnLocLine,
addErrLocHdrLine, dontAddErrLoc,
printErrorsAndWarnings, pprBagOfErrors, pprBagOfWarnings,
ghcExit,
- doIfSet, doIfSet_dyn, dumpIfSet, dumpIfSet_dyn, showPass
+ doIfSet, doIfSet_dyn, dumpIfSet, dumpIfSet_core, dumpIfSet_dyn, showPass
) where
#include "HsVersions.h"
import SrcLoc ( SrcLoc, noSrcLoc, isGoodSrcLoc )
import Util ( sortLt )
import Outputable
-import CmdLineOpts ( DynFlags, DynFlag(..), dopt )
+import CmdLineOpts ( DynFlags(..), DynFlag(..), dopt )
import System ( ExitCode(..), exitWith )
import IO ( hPutStr, stderr )
errorsFound :: Messages -> Bool
errorsFound (warns, errs) = not (isEmptyBag errs)
+warningsFound :: Messages -> Bool
+warningsFound (warns, errs) = not (isEmptyBag warns)
+
printErrorsAndWarnings :: PrintUnqualified -> Messages -> IO ()
-- Don't print any warnings if there are errors
printErrorsAndWarnings unqual (warns, errs)
\begin{code}
showPass :: DynFlags -> String -> IO ()
showPass dflags what
- | dopt Opt_D_show_passes dflags = hPutStr stderr ("*** "++what++":\n")
- | otherwise = return ()
+ | verbosity dflags >= 2 = hPutStr stderr ("*** "++what++":\n")
+ | otherwise = return ()
dumpIfSet :: Bool -> String -> SDoc -> IO ()
dumpIfSet flag hdr doc
| not flag = return ()
| otherwise = printDump (dump hdr doc)
+dumpIfSet_core :: DynFlags -> DynFlag -> String -> SDoc -> IO ()
+dumpIfSet_core dflags flag hdr doc
+ | dopt flag dflags
+ || verbosity dflags >= 4
+ || dopt Opt_D_verbose_core2core dflags = printDump (dump hdr doc)
+ | otherwise = return ()
+
dumpIfSet_dyn :: DynFlags -> DynFlag -> String -> SDoc -> IO ()
dumpIfSet_dyn dflags flag hdr doc
- | not (dopt flag dflags) = return ()
- | otherwise = printDump (dump hdr doc)
+ | dopt flag dflags || verbosity dflags >= 4 = printDump (dump hdr doc)
+ | otherwise = return ()
dump hdr doc
= vcat [text "",