From c1efc06cb56bc4359622918c5354b5730ea37724 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sun, 16 Mar 2008 19:56:36 +0000 Subject: [PATCH] If we are failing due to a warning and -Werror, say so Fixes trac #1893, based on a patch from Daniel Franke. --- compiler/main/ErrUtils.lhs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs index 72d0e93..455b3bf 100644 --- a/compiler/main/ErrUtils.lhs +++ b/compiler/main/ErrUtils.lhs @@ -40,6 +40,7 @@ import SrcLoc ( srcSpanStart, noSrcSpan ) import DynFlags ( DynFlags(..), DynFlag(..), dopt ) import StaticFlags ( opt_ErrorSpans ) +import Control.Monad import System.Exit ( ExitCode(..), exitWith ) import Data.Dynamic import Data.List @@ -128,10 +129,13 @@ errorsFound dflags (warns, errs) printErrorsAndWarnings :: DynFlags -> Messages -> IO () printErrorsAndWarnings dflags (warns, errs) - | no_errs && no_warns = return () - | no_errs = printBagOfWarnings dflags warns - -- Don't print any warnings if there are errors - | otherwise = printBagOfErrors dflags errs + | no_errs && no_warns = return () + | no_errs = do printBagOfWarnings dflags warns + when (dopt Opt_WarnIsError dflags) $ + errorMsg dflags $ + text "\nFailing due to -Werror.\n" + -- Don't print any warnings if there are errors + | otherwise = printBagOfErrors dflags errs where no_warns = isEmptyBag warns no_errs = isEmptyBag errs -- 1.7.10.4