X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FErrUtils.lhs;h=b9e739f1def621353814bd3355bb3966c0eecf3e;hb=a1e077c2ecbab045b748941e5bca25c2a677eb55;hp=455b3bfe37a3fe78f6468e58906c9aa4a8f2e5cd;hpb=c1efc06cb56bc4359622918c5354b5730ea37724;p=ghc-hetmet.git diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs index 455b3bf..b9e739f 100644 --- a/compiler/main/ErrUtils.lhs +++ b/compiler/main/ErrUtils.lhs @@ -13,6 +13,7 @@ module ErrUtils ( Messages, errorsFound, emptyMessages, mkErrMsg, mkWarnMsg, mkPlainErrMsg, mkLongErrMsg, printErrorsAndWarnings, printBagOfErrors, printBagOfWarnings, + handleFlagWarnings, ghcExit, doIfSet, doIfSet_dyn, @@ -28,8 +29,6 @@ module ErrUtils ( debugTraceMsg, ) where --- XXX This define is a bit of a hack, and should be done more nicely -#define FAST_STRING_NOT_NEEDED 1 #include "HsVersions.h" import Bag ( Bag, bagToList, isEmptyBag, emptyBag ) @@ -176,7 +175,16 @@ printBagOfWarnings dflags bag_of_warns EQ -> True GT -> False - +handleFlagWarnings :: DynFlags -> [String] -> IO () +handleFlagWarnings _ [] = return () +handleFlagWarnings dflags warns + = do -- It would be nicer if warns :: [Message], but that has circular + -- import problems. + let warns' = map text warns + mapM_ (log_action dflags SevWarning noSrcSpan defaultUserStyle) warns' + when (dopt Opt_WarnIsError dflags) $ + do errorMsg dflags $ text "\nFailing due to -Werror.\n" + exitWith (ExitFailure 1) ghcExit :: DynFlags -> Int -> IO () ghcExit dflags val