diff options
Diffstat (limited to 'compiler/GHC/Driver/Errors.hs')
-rw-r--r-- | compiler/GHC/Driver/Errors.hs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/compiler/GHC/Driver/Errors.hs b/compiler/GHC/Driver/Errors.hs index eafcfe73f3..362282d1b9 100644 --- a/compiler/GHC/Driver/Errors.hs +++ b/compiler/GHC/Driver/Errors.hs @@ -36,22 +36,12 @@ printBagOfErrors logger dflags bag_of_errors handleFlagWarnings :: Logger -> DynFlags -> [CmdLine.Warn] -> IO () handleFlagWarnings logger dflags warns = do - let warns' = filter (should_print_warning dflags . CmdLine.warnReason) warns - -- It would be nicer if warns :: [Located SDoc], but that + let -- It would be nicer if warns :: [Located SDoc], but that -- has circular import problems. - bag = listToBag [ mkPlainMsgEnvelope dflags WarningWithoutFlag loc (text warn) - | CmdLine.Warn _ (L loc warn) <- warns' ] + bag = listToBag [ mkPlainMsgEnvelope dflags reason loc (text warn) + | CmdLine.Warn reason (L loc warn) <- warns ] printOrThrowDiagnostics logger dflags bag - where - -- Given a warn reason, check to see if it's associated -W opt is enabled - should_print_warning :: DynFlags -> DiagnosticReason -> Bool - should_print_warning dflags (WarningWithFlag Opt_WarnDeprecatedFlags) - = wopt Opt_WarnDeprecatedFlags dflags - should_print_warning dflags (WarningWithFlag Opt_WarnUnrecognisedWarningFlags) - = wopt Opt_WarnUnrecognisedWarningFlags dflags - should_print_warning _ _ - = True -- | Given a bag of diagnostics, turn them into an exception if -- any has 'SevError', or print them out otherwise. |