printErrorsAndWarnings, pprBagOfErrors, pprBagOfWarnings,
+ printError,
ghcExit,
doIfSet, doIfSet_dyn,
dumpIfSet, dumpIfSet_core, dumpIfSet_dyn, dumpIfSet_dyn_or,
import Outputable
import CmdLineOpts ( DynFlags(..), DynFlag(..), dopt )
+import List ( replicate )
import System ( ExitCode(..), exitWith )
-import IO ( hPutStr, stderr )
+import IO ( hPutStr, hPutStrLn, stderr, stdout )
\end{code}
\begin{code}
\end{code}
+\begin{code}
+printError :: String -> IO ()
+printError str = hPutStrLn stderr str
+\end{code}
\begin{code}
type Messages = (Bag WarnMsg, Bag ErrMsg)
dumpIfSet_dyn :: DynFlags -> DynFlag -> String -> SDoc -> IO ()
dumpIfSet_dyn dflags flag hdr doc
- | dopt flag dflags || verbosity dflags >= 4 = printDump (dump hdr doc)
- | otherwise = return ()
+ | dopt flag dflags || verbosity dflags >= 4
+ = if flag `elem` [Opt_D_dump_stix, Opt_D_dump_asm]
+ then printForC stdout (dump hdr doc)
+ else printDump (dump hdr doc)
+ | otherwise
+ = return ()
dumpIfSet_dyn_or :: DynFlags -> [DynFlag] -> String -> SDoc -> IO ()
dumpIfSet_dyn_or dflags flags hdr doc
doc,
text ""]
where
- line = text (take 20 (repeat '='))
+ line = text (replicate 20 '=')
\end{code}