summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Errors.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-06-06 12:31:28 +0100
committerZubin Duggal <zubin.duggal@gmail.com>2022-07-14 14:39:37 +0530
commit494aa15430be8578f8dfd2ccf4b1e40ca0711959 (patch)
tree02f3eadc6d0b8ae6faf28d971aa7aa81bec3f61e /compiler/GHC/Driver/Errors.hs
parentbb7b2e6f876806e65ec07d1d8638dde54c34ded4 (diff)
downloadhaskell-494aa15430be8578f8dfd2ccf4b1e40ca0711959.tar.gz
9.2: Fix -Werror=unrecognised-warning-flags
The code path was failing to check if the errors had been turned into fatal errors. (cherry picked from commit 6edf34e41bffcd0bed61629f8c215465d866fdcc)
Diffstat (limited to 'compiler/GHC/Driver/Errors.hs')
-rw-r--r--compiler/GHC/Driver/Errors.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/Driver/Errors.hs b/compiler/GHC/Driver/Errors.hs
index d779fc06f8..546bade5e4 100644
--- a/compiler/GHC/Driver/Errors.hs
+++ b/compiler/GHC/Driver/Errors.hs
@@ -46,10 +46,14 @@ handleFlagWarnings :: Logger -> DynFlags -> [CmdLine.Warn] -> IO ()
handleFlagWarnings logger dflags warns = do
let warns' = filter (shouldPrintWarning dflags . CmdLine.warnReason) warns
+ toWarnReason CmdLine.ReasonDeprecatedFlag = Reason Opt_WarnDeprecatedFlags
+ toWarnReason CmdLine.ReasonUnrecognisedFlag = Reason Opt_WarnUnrecognisedWarningFlags
+ toWarnReason CmdLine.NoReason = NoReason
+
-- It would be nicer if warns :: [Located SDoc], but that
-- has circular import problems.
- bag = listToBag [ mkPlainWarnMsg loc (text warn)
- | CmdLine.Warn _ (L loc warn) <- warns' ]
+ bag = listToBag [ makeIntoWarning (toWarnReason reason) (mkPlainWarnMsg loc (text warn))
+ | CmdLine.Warn reason (L loc warn) <- warns' ]
printOrThrowWarnings logger dflags bag