summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Grenrus <oleg.grenrus@iki.fi>2023-05-14 21:00:56 +0300
committerOleg Grenrus <oleg.grenrus@iki.fi>2023-05-17 16:58:37 +0300
commit2b04bce3a94e3b191a5c43414b7f76d144f0d1f6 (patch)
tree1c61ad2c6390799859e48bf9cd52b2902b01982d
parent2972fd66f91cb51426a1df86b8166a067015e231 (diff)
downloadhaskell-wip/warns-to-drivermessages.tar.gz
Make Warn = Located DriverMessagewip/warns-to-drivermessages
Resolves #23261 This change makes command line argument parsing use diagnostic framework for producing warnings.
-rw-r--r--compiler/GHC.hs5
-rw-r--r--compiler/GHC/Driver/Backpack.hs2
-rw-r--r--compiler/GHC/Driver/CmdLine.hs56
-rw-r--r--compiler/GHC/Driver/Errors.hs17
-rw-r--r--compiler/GHC/Driver/Errors/Ppr.hs33
-rw-r--r--compiler/GHC/Driver/Errors/Types.hs11
-rw-r--r--compiler/GHC/Driver/Main.hs4
-rw-r--r--compiler/GHC/Driver/Pipeline.hs2
-rw-r--r--compiler/GHC/Driver/Pipeline/Execute.hs3
-rw-r--r--compiler/GHC/Driver/Pipeline/Phases.hs3
-rw-r--r--compiler/GHC/Driver/Session.hs66
-rw-r--r--compiler/GHC/Types/Error/Codes.hs5
-rw-r--r--ghc/GHCi/UI.hs3
-rw-r--r--ghc/Main.hs8
-rw-r--r--testsuite/tests/backpack/should_compile/bkp09.stderr2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp15.stderr2
-rw-r--r--testsuite/tests/deSugar/should_compile/ds041.stderr2
-rw-r--r--testsuite/tests/deriving/should_compile/T20501.stderr2
-rw-r--r--testsuite/tests/deriving/should_compile/T4325.stderr2
-rw-r--r--testsuite/tests/deriving/should_compile/T4966.stderr2
-rw-r--r--testsuite/tests/deriving/should_compile/drv-foldable-traversable1.stderr2
-rw-r--r--testsuite/tests/deriving/should_compile/drv-functor1.stderr2
-rw-r--r--testsuite/tests/deriving/should_fail/drvfail-functor2.stderr2
-rw-r--r--testsuite/tests/driver/T11429a.stderr2
-rw-r--r--testsuite/tests/driver/T11429c.stderr2
-rw-r--r--testsuite/tests/driver/T12056b.stderr2
-rw-r--r--testsuite/tests/driver/T12056c.stderr8
-rw-r--r--testsuite/tests/driver/T20436/T20436.stderr2
-rw-r--r--testsuite/tests/driver/T21682.stderr2
-rw-r--r--testsuite/tests/driver/T2464.stderr2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_0.stderr2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_1.stderr2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_1.stderr2
-rw-r--r--testsuite/tests/ghc-api/T10052/T10052.stderr2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print007.stderr2
-rw-r--r--testsuite/tests/ghci/scripts/ghci031.stderr2
-rw-r--r--testsuite/tests/ghci/should_fail/T10549.stderr2
-rw-r--r--testsuite/tests/ghci/should_fail/T10549a.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_compile/T3418.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_compile/T3787.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/T16619.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/read018.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/T16270.stderr2
-rw-r--r--testsuite/tests/partial-sigs/should_fail/WildcardInADTContext1.stderr2
-rw-r--r--testsuite/tests/partial-sigs/should_fail/WildcardInADTContext2.stderr2
-rw-r--r--testsuite/tests/rename/should_fail/RnStupidThetaInGadt.stderr2
-rw-r--r--testsuite/tests/rename/should_fail/rnfail055.stderr4
-rw-r--r--testsuite/tests/roles/should_compile/T8958.stderr2
-rw-r--r--testsuite/tests/safeHaskell/check/Check05.stderr4
-rw-r--r--testsuite/tests/safeHaskell/flags/SafeFlags18.stderr2
-rw-r--r--testsuite/tests/safeHaskell/ghci/p1.stderr4
-rw-r--r--testsuite/tests/safeHaskell/ghci/p14.stderr2
-rw-r--r--testsuite/tests/safeHaskell/ghci/p16.stderr2
-rw-r--r--testsuite/tests/safeHaskell/safeInfered/SafeInfered05.stderr2
-rw-r--r--testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr2
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang01.stderr2
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr4
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr2
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr4
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang16.stderr2
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr2
-rw-r--r--testsuite/tests/stranal/should_compile/str001.stderr3
-rw-r--r--testsuite/tests/th/T8333.stderr2
-rw-r--r--testsuite/tests/typecheck/should_compile/T17567StupidThetaB.stderr2
-rw-r--r--testsuite/tests/typecheck/should_compile/T2478.stderr2
-rw-r--r--testsuite/tests/typecheck/should_compile/T4355.stderr2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc182.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail067.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail102.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail125.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail133.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail137.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail151.stderr2
-rw-r--r--testsuite/tests/typecheck/should_run/T3731.stderr2
-rw-r--r--testsuite/tests/warnings/should_compile/T20312.stderr4
76 files changed, 194 insertions, 167 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index 0182b5a2a1..49c94930ae 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -838,7 +838,7 @@ parseDynamicFlags
=> Logger
-> DynFlags
-> [Located String]
- -> m (DynFlags, [Located String], [Warn])
+ -> m (DynFlags, [Located String], Messages DriverMessage)
parseDynamicFlags logger dflags cmdline = do
(dflags1, leftovers, warns) <- parseDynamicFlagsCmdLine dflags cmdline
-- flags that have just been read are used by the logger when loading package
@@ -940,7 +940,8 @@ checkNewDynFlags logger dflags = do
let (dflags', warnings) = makeDynFlagsConsistent dflags
let diag_opts = initDiagOpts dflags
print_config = initPrintConfig dflags
- liftIO $ handleFlagWarnings logger print_config diag_opts (map (Warn WarningWithoutFlag) warnings)
+ liftIO $ printOrThrowDiagnostics logger print_config diag_opts
+ $ fmap GhcDriverMessage $ warnsToMessages diag_opts warnings
return dflags'
checkNewInteractiveDynFlags :: MonadIO m => Logger -> DynFlags -> m DynFlags
diff --git a/compiler/GHC/Driver/Backpack.hs b/compiler/GHC/Driver/Backpack.hs
index 9ca39b68ae..46aca5a99b 100644
--- a/compiler/GHC/Driver/Backpack.hs
+++ b/compiler/GHC/Driver/Backpack.hs
@@ -108,7 +108,7 @@ doBackpack [src_filename] = do
liftIO $ checkProcessArgsResult unhandled_flags
let print_config = initPrintConfig dflags
liftIO $ printOrThrowDiagnostics logger print_config (initDiagOpts dflags) (GhcPsMessage <$> p_warns)
- liftIO $ handleFlagWarnings logger print_config (initDiagOpts dflags) warns
+ liftIO $ printOrThrowDiagnostics logger print_config (initDiagOpts dflags) (GhcDriverMessage <$> warns)
-- TODO: Preprocessing not implemented
buf <- liftIO $ hGetStringBuffer src_filename
diff --git a/compiler/GHC/Driver/CmdLine.hs b/compiler/GHC/Driver/CmdLine.hs
index e7d734bb42..57ad36431b 100644
--- a/compiler/GHC/Driver/CmdLine.hs
+++ b/compiler/GHC/Driver/CmdLine.hs
@@ -17,22 +17,23 @@ module GHC.Driver.CmdLine
Flag(..), defFlag, defGhcFlag, defGhciFlag, defHiddenFlag, hoistFlag,
errorsToGhcException,
- Err(..), Warn(..), WarnReason(..),
+ Err(..), Warn, warnsToMessages,
- EwM, runEwM, addErr, addWarn, addFlagWarn, getArg, getCurLoc, liftEwM
+ EwM, runEwM, addErr, addWarn, addFlagWarn, getArg, getCurLoc, liftEwM,
) where
import GHC.Prelude
import GHC.Utils.Misc
-import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
import GHC.Data.Bag
import GHC.Types.SrcLoc
-import GHC.Utils.Json
-
-import GHC.Types.Error ( DiagnosticReason(..) )
+import GHC.Types.Error
+import GHC.Utils.Error
+import GHC.Driver.Errors.Types
+import GHC.Driver.Errors.Ppr ()
+import GHC.Utils.Outputable (text)
import Data.Function
import Data.List (sortBy, intercalate, stripPrefix)
@@ -107,32 +108,16 @@ data OptKind m -- Suppose the flag is -f
-- The EwM monad
--------------------------------------------------------
--- | Used when filtering warnings: if a reason is given
--- it can be filtered out when displaying.
-data WarnReason
- = NoReason
- | ReasonDeprecatedFlag
- | ReasonUnrecognisedFlag
- deriving (Eq, Show)
-
-instance Outputable WarnReason where
- ppr = text . show
-
-instance ToJson WarnReason where
- json NoReason = JSNull
- json reason = JSString $ show reason
-
-- | A command-line error message
newtype Err = Err { errMsg :: Located String }
-- | A command-line warning message and the reason it arose
-data Warn = Warn
- { warnReason :: DiagnosticReason,
- warnMsg :: Located String
- }
+--
+-- This used to be own type, but now it's just @'MsgEnvelope' 'DriverMessage'@.
+type Warn = Located DriverMessage
type Errs = Bag Err
-type Warns = Bag Warn
+type Warns = [Warn]
-- EwM ("errors and warnings monad") is a monad
-- transformer for m that adds an (err, warn) state
@@ -152,7 +137,7 @@ instance MonadIO m => MonadIO (EwM m) where
liftIO = liftEwM . liftIO
runEwM :: EwM m a -> m (Errs, Warns, a)
-runEwM action = unEwM action (panic "processArgs: no arg yet") emptyBag emptyBag
+runEwM action = unEwM action (panic "processArgs: no arg yet") emptyBag mempty
setArg :: Located String -> EwM m () -> EwM m ()
setArg l (EwM f) = EwM (\_ es ws -> f l es ws)
@@ -161,11 +146,12 @@ addErr :: Monad m => String -> EwM m ()
addErr e = EwM (\(L loc _) es ws -> return (es `snocBag` Err (L loc e), ws, ()))
addWarn :: Monad m => String -> EwM m ()
-addWarn = addFlagWarn WarningWithoutFlag
+addWarn msg = addFlagWarn $ DriverUnknownMessage $ UnknownDiagnostic $
+ mkPlainDiagnostic WarningWithoutFlag noHints $ text msg
-addFlagWarn :: Monad m => DiagnosticReason -> String -> EwM m ()
-addFlagWarn reason msg = EwM $
- (\(L loc _) es ws -> return (es, ws `snocBag` Warn reason (L loc msg), ()))
+addFlagWarn :: Monad m => DriverMessage -> EwM m ()
+addFlagWarn msg = EwM
+ (\(L loc _) es ws -> return (es, L loc msg : ws, ()))
getArg :: Monad m => EwM m String
getArg = EwM (\(L _ arg) es ws -> return (es, ws, arg))
@@ -176,6 +162,10 @@ getCurLoc = EwM (\(L loc _) es ws -> return (es, ws, loc))
liftEwM :: Monad m => m a -> EwM m a
liftEwM action = EwM (\_ es ws -> do { r <- action; return (es, ws, r) })
+warnsToMessages :: DiagOpts -> [Warn] -> Messages DriverMessage
+warnsToMessages diag_opts = foldr
+ (\(L loc w) ws -> addMessage (mkPlainMsgEnvelope diag_opts loc w) ws)
+ emptyMessages
--------------------------------------------------------
-- Processing arguments
@@ -187,10 +177,10 @@ processArgs :: Monad m
-> (FilePath -> EwM m [Located String]) -- ^ response file handler
-> m ( [Located String], -- spare args
[Err], -- errors
- [Warn] ) -- warnings
+ Warns ) -- warnings
processArgs spec args handleRespFile = do
(errs, warns, spare) <- runEwM action
- return (spare, bagToList errs, bagToList warns)
+ return (spare, bagToList errs, warns)
where
action = process args []
diff --git a/compiler/GHC/Driver/Errors.hs b/compiler/GHC/Driver/Errors.hs
index ab62682517..fc19e15494 100644
--- a/compiler/GHC/Driver/Errors.hs
+++ b/compiler/GHC/Driver/Errors.hs
@@ -2,20 +2,16 @@
module GHC.Driver.Errors (
printOrThrowDiagnostics
, printMessages
- , handleFlagWarnings
, mkDriverPsHeaderMessage
) where
import GHC.Driver.Errors.Types
-import GHC.Data.Bag
import GHC.Prelude
-import GHC.Types.SrcLoc
import GHC.Types.SourceError
import GHC.Types.Error
import GHC.Utils.Error
import GHC.Utils.Outputable (hang, ppr, ($$), text, mkErrStyle, sdocStyle, updSDocContext )
import GHC.Utils.Logger
-import qualified GHC.Driver.CmdLine as CmdLine
printMessages :: forall a . Diagnostic a => Logger -> DiagnosticOpts a -> DiagOpts -> Messages a -> IO ()
printMessages logger msg_opts opts msgs
@@ -38,19 +34,6 @@ printMessages logger msg_opts opts msgs
hs -> main_msg $$ hang (text "Suggested fixes:") 2
(formatBulleted $ mkDecorated . map ppr $ hs)
-handleFlagWarnings :: Logger -> GhcMessageOpts -> DiagOpts -> [CmdLine.Warn] -> IO ()
-handleFlagWarnings logger print_config opts warns = do
- let -- It would be nicer if warns :: [Located SDoc], but that
- -- has circular import problems.
- bag = listToBag [ mkPlainMsgEnvelope opts loc $
- GhcDriverMessage $
- DriverUnknownMessage $
- UnknownDiagnostic $
- mkPlainDiagnostic reason noHints $ text warn
- | CmdLine.Warn reason (L loc warn) <- warns ]
-
- printOrThrowDiagnostics logger print_config opts (mkMessages bag)
-
-- | Given a bag of diagnostics, turn them into an exception if
-- any has 'SevError', or print them out otherwise.
printOrThrowDiagnostics :: Logger -> GhcMessageOpts -> DiagOpts -> Messages GhcMessage -> IO ()
diff --git a/compiler/GHC/Driver/Errors/Ppr.hs b/compiler/GHC/Driver/Errors/Ppr.hs
index a7a3135b13..89dd28eb74 100644
--- a/compiler/GHC/Driver/Errors/Ppr.hs
+++ b/compiler/GHC/Driver/Errors/Ppr.hs
@@ -222,6 +222,19 @@ instance Diagnostic DriverMessage where
++ map (\uid -> text "-" <+> ppr uid) needed_unit_ids)
DriverInterfaceError reason -> diagnosticMessage (ifaceDiagnosticOpts opts) reason
+ DriverInconsistentDynFlags msg
+ -> mkSimpleDecorated $ text msg
+ DriverSafeHaskellIgnoredExtension ext
+ -> let arg = text "-X" <> ppr ext
+ in mkSimpleDecorated $ arg <+> text "is not allowed in Safe Haskell; ignoring" <+> arg
+ DriverPackageTrustIgnored
+ -> mkSimpleDecorated $ text "-fpackage-trust ignored; must be specified with a Safe Haskell flag"
+
+ DriverUnrecognisedFlag arg
+ -> mkSimpleDecorated $ text $ "unrecognised warning flag: -" ++ arg
+ DriverDeprecatedFlag arg msg
+ -> mkSimpleDecorated $ text $ arg ++ " is deprecated: " ++ msg
+
diagnosticReason = \case
DriverUnknownMessage m
-> diagnosticReason m
@@ -276,6 +289,16 @@ instance Diagnostic DriverMessage where
DriverHomePackagesNotClosed {}
-> ErrorWithoutFlag
DriverInterfaceError reason -> diagnosticReason reason
+ DriverInconsistentDynFlags {}
+ -> WarningWithoutFlag
+ DriverSafeHaskellIgnoredExtension {}
+ -> WarningWithoutFlag
+ DriverPackageTrustIgnored {}
+ -> WarningWithoutFlag
+ DriverUnrecognisedFlag {}
+ -> WarningWithFlag Opt_WarnUnrecognisedWarningFlags
+ DriverDeprecatedFlag {}
+ -> WarningWithFlag Opt_WarnDeprecatedFlags
diagnosticHints = \case
DriverUnknownMessage m
@@ -333,5 +356,15 @@ instance Diagnostic DriverMessage where
DriverHomePackagesNotClosed {}
-> noHints
DriverInterfaceError reason -> diagnosticHints reason
+ DriverInconsistentDynFlags {}
+ -> noHints
+ DriverSafeHaskellIgnoredExtension {}
+ -> noHints
+ DriverPackageTrustIgnored {}
+ -> noHints
+ DriverUnrecognisedFlag {}
+ -> noHints
+ DriverDeprecatedFlag {}
+ -> noHints
diagnosticCode = constructorCode
diff --git a/compiler/GHC/Driver/Errors/Types.hs b/compiler/GHC/Driver/Errors/Types.hs
index 2e116bd8b6..a7b955267e 100644
--- a/compiler/GHC/Driver/Errors/Types.hs
+++ b/compiler/GHC/Driver/Errors/Types.hs
@@ -35,6 +35,7 @@ import GHC.HsToCore.Errors.Types ( DsMessage )
import GHC.Hs.Extension (GhcTc)
import Language.Haskell.Syntax.Decls (RuleDecl)
+import qualified GHC.LanguageExtensions as LangExt
import GHC.Generics ( Generic )
@@ -372,6 +373,16 @@ data DriverMessage where
DriverInterfaceError :: !IfaceMessage -> DriverMessage
+ DriverInconsistentDynFlags :: String -> DriverMessage
+
+ DriverSafeHaskellIgnoredExtension :: !LangExt.Extension -> DriverMessage
+
+ DriverPackageTrustIgnored :: DriverMessage
+
+ DriverUnrecognisedFlag :: String -> DriverMessage
+
+ DriverDeprecatedFlag :: String -> String -> DriverMessage
+
deriving instance Generic DriverMessage
data DriverMessageOpts =
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs
index 3321d1203f..e795b5cd55 100644
--- a/compiler/GHC/Driver/Main.hs
+++ b/compiler/GHC/Driver/Main.hs
@@ -1710,9 +1710,9 @@ markUnsafeInfer tcg_env whyUnsafe = do
(vcat $ badInsts $ tcg_insts tcg_env)
]
badFlags df = concatMap (badFlag df) unsafeFlagsForInfer
- badFlag df (str,loc,on,_)
+ badFlag df (ext,loc,on,_)
| on df = [mkLocMessage MCOutput (loc df) $
- text str <+> text "is not allowed in Safe Haskell"]
+ text "-X" <> ppr ext <+> text "is not allowed in Safe Haskell"]
| otherwise = []
badInsts insts = concatMap badInst insts
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
index cb4aa6d8a2..6e398af51e 100644
--- a/compiler/GHC/Driver/Pipeline.hs
+++ b/compiler/GHC/Driver/Pipeline.hs
@@ -737,7 +737,7 @@ preprocessPipeline pipe_env hsc_env input_fn = do
let print_config = initPrintConfig dflags3
liftIO (printOrThrowDiagnostics (hsc_logger hsc_env) print_config (initDiagOpts dflags3) (GhcPsMessage <$> p_warns3))
- liftIO (handleFlagWarnings (hsc_logger hsc_env) print_config (initDiagOpts dflags3) warns3)
+ liftIO (printOrThrowDiagnostics (hsc_logger hsc_env) print_config (initDiagOpts dflags3) (GhcDriverMessage <$> warns3))
return (dflags3, pp_fn)
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs
index fb3de7925a..ebfb90a76d 100644
--- a/compiler/GHC/Driver/Pipeline/Execute.hs
+++ b/compiler/GHC/Driver/Pipeline/Execute.hs
@@ -28,7 +28,6 @@ import GHC.Unit.Module.Status
import GHC.Unit.Module.ModIface
import GHC.Driver.Backend
import GHC.Driver.Session
-import GHC.Driver.CmdLine
import GHC.Unit.Module.ModSummary
import qualified GHC.LanguageExtensions as LangExt
import GHC.Types.SrcLoc
@@ -683,7 +682,7 @@ runUnlitPhase hsc_env input_fn output_fn = do
return output_fn
-getFileArgs :: HscEnv -> FilePath -> IO ((DynFlags, Messages PsMessage, [Warn]))
+getFileArgs :: HscEnv -> FilePath -> IO ((DynFlags, Messages PsMessage, Messages DriverMessage))
getFileArgs hsc_env input_fn = do
let dflags0 = hsc_dflags hsc_env
parser_opts = initParserOpts dflags0
diff --git a/compiler/GHC/Driver/Pipeline/Phases.hs b/compiler/GHC/Driver/Pipeline/Phases.hs
index 01a507be67..410d488773 100644
--- a/compiler/GHC/Driver/Pipeline/Phases.hs
+++ b/compiler/GHC/Driver/Pipeline/Phases.hs
@@ -7,7 +7,6 @@ import GHC.Prelude
import GHC.Driver.Pipeline.Monad
import GHC.Driver.Env.Types
import GHC.Driver.Session
-import GHC.Driver.CmdLine
import GHC.Types.SourceFile
import GHC.Unit.Module.ModSummary
import GHC.Unit.Module.Status
@@ -29,7 +28,7 @@ import GHC.Unit.Home.ModInfo
-- phase if the inputs have been modified.
data TPhase res where
T_Unlit :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
- T_FileArgs :: HscEnv -> FilePath -> TPhase (DynFlags, Messages PsMessage, [Warn])
+ T_FileArgs :: HscEnv -> FilePath -> TPhase (DynFlags, Messages PsMessage, Messages DriverMessage)
T_Cpp :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
T_HsPp :: PipeEnv -> HscEnv -> FilePath -> FilePath -> TPhase FilePath
T_HscRecomp :: PipeEnv -> HscEnv -> FilePath -> HscSource -> TPhase (HscEnv, ModSummary, HscRecompStatus)
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index dd5bb6b7cb..115a55d1ed 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -235,8 +235,10 @@ import GHC.Unit.Parser
import GHC.Unit.Module
import GHC.Unit.Module.Warnings
import GHC.Driver.DynFlags
+import GHC.Driver.Config.Diagnostic
import GHC.Driver.Flags
import GHC.Driver.Backend
+import GHC.Driver.Errors.Types
import GHC.Driver.Plugins.External
import GHC.Settings.Config
import GHC.Core.Unfold
@@ -247,6 +249,7 @@ import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.GlobalVars
import GHC.Data.Maybe
import GHC.Data.Bool
+import GHC.Types.Error
import GHC.Utils.Monad
import GHC.Types.SrcLoc
import GHC.Types.SafeHaskell
@@ -357,7 +360,6 @@ import qualified GHC.LanguageExtensions as LangExt
-- -----------------------------------------------------------------------------
-- DynFlags
-
{- Note [RHS Floating]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We provide both 'Opt_LocalFloatOut' and 'Opt_LocalFloatOutTopLevel' to correspond to
@@ -545,14 +547,14 @@ combineSafeFlags a b | a == Sf_None = return b
-- * function to test if the flag is on
-- * function to turn the flag off
unsafeFlags, unsafeFlagsForInfer
- :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)]
-unsafeFlags = [ ("-XGeneralizedNewtypeDeriving", newDerivOnLoc,
+ :: [(LangExt.Extension, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)]
+unsafeFlags = [ (LangExt.GeneralizedNewtypeDeriving, newDerivOnLoc,
xopt LangExt.GeneralizedNewtypeDeriving,
flip xopt_unset LangExt.GeneralizedNewtypeDeriving)
- , ("-XDerivingVia", deriveViaOnLoc,
+ , (LangExt.DerivingVia, deriveViaOnLoc,
xopt LangExt.DerivingVia,
flip xopt_unset LangExt.DerivingVia)
- , ("-XTemplateHaskell", thOnLoc,
+ , (LangExt.TemplateHaskell, thOnLoc,
xopt LangExt.TemplateHaskell,
flip xopt_unset LangExt.TemplateHaskell)
]
@@ -753,7 +755,7 @@ updOptLevel n = fst . updOptLevelChanged n
-- Throws a 'UsageError' if errors occurred during parsing (such as unknown
-- flags or missing arguments).
parseDynamicFlagsCmdLine :: MonadIO m => DynFlags -> [Located String]
- -> m (DynFlags, [Located String], [Warn])
+ -> m (DynFlags, [Located String], Messages DriverMessage)
-- ^ Updated 'DynFlags', left-over arguments, and
-- list of warnings.
parseDynamicFlagsCmdLine = parseDynamicFlagsFull flagsAll True
@@ -763,7 +765,7 @@ parseDynamicFlagsCmdLine = parseDynamicFlagsFull flagsAll True
-- (-package, -hide-package, -ignore-package, -hide-all-packages, -package-db).
-- Used to parse flags set in a modules pragma.
parseDynamicFilePragma :: MonadIO m => DynFlags -> [Located String]
- -> m (DynFlags, [Located String], [Warn])
+ -> m (DynFlags, [Located String], Messages DriverMessage)
-- ^ Updated 'DynFlags', left-over arguments, and
-- list of warnings.
parseDynamicFilePragma = parseDynamicFlagsFull flagsDynamic False
@@ -803,6 +805,7 @@ processCmdLineP activeFlags s0 args =
getCmdLineP :: CmdLineP s a -> StateT s m a
getCmdLineP (CmdLineP k) = k
+
-- | Parses the dynamically set flags for GHC. This is the most general form of
-- the dynamic flag parser that the other methods simply wrap. It allows
-- saying which flags are valid flags and indicating if we are parsing
@@ -813,9 +816,9 @@ parseDynamicFlagsFull
-> Bool -- ^ are the arguments from the command line?
-> DynFlags -- ^ current dynamic flags
-> [Located String] -- ^ arguments to parse
- -> m (DynFlags, [Located String], [Warn])
+ -> m (DynFlags, [Located String], Messages DriverMessage)
parseDynamicFlagsFull activeFlags cmdline dflags0 args = do
- ((leftover, errs, warns), dflags1) <- processCmdLineP activeFlags dflags0 args
+ ((leftover, errs, cli_warns), dflags1) <- processCmdLineP activeFlags dflags0 args
-- See Note [Handling errors when parsing command-line flags]
let rdr = renderWithContext (initSDocContext dflags0 defaultUserStyle)
@@ -840,28 +843,29 @@ parseDynamicFlagsFull activeFlags cmdline dflags0 args = do
liftIO $ setUnsafeGlobalDynFlags dflags3
- let warns' = map (Warn WarningWithoutFlag) (consistency_warnings ++ sh_warns)
+ -- create message envelopes using final DynFlags: #23402
+ let diag_opts = initDiagOpts dflags3
+ warns = warnsToMessages diag_opts $ mconcat [consistency_warnings, sh_warns, cli_warns]
- return (dflags3, leftover, warns' ++ warns)
+ return (dflags3, leftover, warns)
-- | Check (and potentially disable) any extensions that aren't allowed
-- in safe mode.
--
-- The bool is to indicate if we are parsing command line flags (false means
-- file pragma). This allows us to generate better warnings.
-safeFlagCheck :: Bool -> DynFlags -> (DynFlags, [Located String])
+safeFlagCheck :: Bool -> DynFlags -> (DynFlags, [Warn])
safeFlagCheck _ dflags | safeLanguageOn dflags = (dflagsUnset, warns)
where
-- Handle illegal flags under safe language.
- (dflagsUnset, warns) = foldl' check_method (dflags, []) unsafeFlags
+ (dflagsUnset, warns) = foldl' check_method (dflags, mempty) unsafeFlags
- check_method (df, warns) (str,loc,test,fix)
- | test df = (fix df, warns ++ safeFailure (loc df) str)
+ check_method (df, warns) (ext,loc,test,fix)
+ | test df = (fix df, safeFailure (loc df) ext : warns)
| otherwise = (df, warns)
- safeFailure loc str
- = [L loc $ str ++ " is not allowed in Safe Haskell; ignoring "
- ++ str]
+ safeFailure loc ext
+ = L loc $ DriverSafeHaskellIgnoredExtension ext
safeFlagCheck cmdl dflags =
case safeInferOn dflags of
@@ -874,11 +878,10 @@ safeFlagCheck cmdl dflags =
(dflags', warn)
| not (safeHaskellModeEnabled dflags) && not cmdl && packageTrustOn dflags
= (gopt_unset dflags Opt_PackageTrust, pkgWarnMsg)
- | otherwise = (dflags, [])
+ | otherwise = (dflags, mempty)
- pkgWarnMsg = [L (pkgTrustOnLoc dflags') $
- "-fpackage-trust ignored;" ++
- " must be specified with a Safe Haskell flag"]
+ pkgWarnMsg :: [Warn]
+ pkgWarnMsg = [ L (pkgTrustOnLoc dflags') DriverPackageTrustIgnored ]
-- Have we inferred Unsafe? See Note [Safe Haskell Inference] in GHC.Driver.Main
-- Force this to avoid retaining reference to old DynFlags value
@@ -1894,7 +1897,7 @@ warningControls set unset set_werror unset_fatal xs =
customOrUnrecognisedWarning :: String -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning prefix custom = defHiddenFlag prefix (Prefix action)
where
- action :: String -> EwM (CmdLineP DynFlags) ()
+ action :: String -> DynP ()
action flag
| validWarningCategory cat = custom cat
| otherwise = unrecognised flag
@@ -1902,9 +1905,11 @@ customOrUnrecognisedWarning prefix custom = defHiddenFlag prefix (Prefix action)
cat = mkWarningCategory (mkFastString flag)
unrecognised flag = do
+ -- #23402 and #12056
+ -- for unrecognised flags we consider current dynflags, not the final one.
+ -- But if final state says to not report unrecognised flags, they won't anyway.
f <- wopt Opt_WarnUnrecognisedWarningFlags <$> liftEwM getCmdLineState
- when f $ addFlagWarn (WarningWithFlag Opt_WarnUnrecognisedWarningFlags) $
- "unrecognised warning flag: -" ++ prefix ++ flag
+ when f $ addFlagWarn (DriverUnrecognisedFlag (prefix ++ flag))
-- See Note [Supporting CLI completion]
package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
@@ -2089,11 +2094,10 @@ mkFlag turn_on flagPrefix f (dep, (FlagSpec name flag extra_action mode))
= (dep,
Flag (flagPrefix ++ name) (NoArg (f flag >> extra_action turn_on)) mode)
--- here to avoid module cycle with GHC.Driver.CmdLine
-deprecate :: Monad m => String -> EwM m ()
+deprecate :: String -> DynP ()
deprecate s = do
arg <- getArg
- addFlagWarn (WarningWithFlag Opt_WarnDeprecatedFlags) (arg ++ " is deprecated: " ++ s)
+ addFlagWarn (DriverDeprecatedFlag arg s)
deprecatedForExtension :: String -> TurnOnFlag -> String
deprecatedForExtension lang turn_on
@@ -3589,7 +3593,7 @@ T10052 and #10052).
-- | Resolve any internal inconsistencies in a set of 'DynFlags'.
-- Returns the consistent 'DynFlags' as well as a list of warnings
-- to report to the user.
-makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String])
+makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Warn])
-- Whenever makeDynFlagsConsistent does anything, it starts over, to
-- ensure that a later change doesn't invalidate an earlier check.
-- Be careful not to introduce potential loops!
@@ -3674,11 +3678,11 @@ makeDynFlagsConsistent dflags
, Nothing <- outputFile dflags
= pgmError "--output must be specified when using --merge-objs"
- | otherwise = (dflags, [])
+ | otherwise = (dflags, mempty)
where loc = mkGeneralSrcSpan (fsLit "when making flags consistent")
loop updated_dflags warning
= case makeDynFlagsConsistent updated_dflags of
- (dflags', ws) -> (dflags', L loc warning : ws)
+ (dflags', ws) -> (dflags', L loc (DriverInconsistentDynFlags warning) : ws)
platform = targetPlatform dflags
arch = platformArch platform
os = platformOS platform
diff --git a/compiler/GHC/Types/Error/Codes.hs b/compiler/GHC/Types/Error/Codes.hs
index 25f78f9fbd..fd96b13c7d 100644
--- a/compiler/GHC/Types/Error/Codes.hs
+++ b/compiler/GHC/Types/Error/Codes.hs
@@ -297,6 +297,11 @@ type family GhcDiagnosticCode c = n | n -> c where
GhcDiagnosticCode "DriverCannotImportFromUntrustedPackage" = 75165
GhcDiagnosticCode "DriverRedirectedNoMain" = 95379
GhcDiagnosticCode "DriverHomePackagesNotClosed" = 03271
+ GhcDiagnosticCode "DriverInconsistentDynFlags" = 74335
+ GhcDiagnosticCode "DriverSafeHaskellIgnoredExtension" = 98887
+ GhcDiagnosticCode "DriverPackageTrustIgnored" = 83552
+ GhcDiagnosticCode "DriverUnrecognisedFlag" = 93741
+ GhcDiagnosticCode "DriverDeprecatedFlag" = 53692
-- Constraint solver diagnostic codes
GhcDiagnosticCode "BadTelescope" = 97739
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 287b3d8788..6ce804ea3e 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -46,6 +46,7 @@ import GHC.Core.DataCon
import GHC.Core.ConLike
import GHC.Core.PatSyn
import GHC.Driver.Errors
+import GHC.Driver.Errors.Types
import GHC.Driver.Phases
import GHC.Driver.Session as DynFlags
import GHC.Driver.Ppr hiding (printForUser)
@@ -3145,7 +3146,7 @@ newDynFlags interactive_only minus_opts = do
idflags0 <- GHC.getInteractiveDynFlags
(idflags1, leftovers, warns) <- DynFlags.parseDynamicFlagsCmdLine idflags0 lopts
- liftIO $ handleFlagWarnings logger (initPrintConfig idflags1) (initDiagOpts idflags1) warns
+ liftIO $ printOrThrowDiagnostics logger (initPrintConfig idflags1) (initDiagOpts idflags1) (GhcDriverMessage <$> warns)
when (not $ null leftovers)
(throwGhcException . CmdLineError
$ "Some flags have not been recognized: "
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 5b1f33bb4e..5a65b36306 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -23,6 +23,7 @@ import GHC.Driver.Backend
import GHC.Driver.CmdLine
import GHC.Driver.Env
import GHC.Driver.Errors
+import GHC.Driver.Errors.Types
import GHC.Driver.Phases
import GHC.Driver.Session
import GHC.Driver.Ppr
@@ -243,12 +244,13 @@ main' postLoadMode units dflags0 args flagWarnings = do
GHC.prettyPrintGhcErrors logger4 $ do
- let flagWarnings' = flagWarnings ++ dynamicFlagWarnings
+ let diag_opts = initDiagOpts dflags4
+ let flagWarnings' = GhcDriverMessage <$> mconcat [warnsToMessages diag_opts flagWarnings, dynamicFlagWarnings]
handleSourceError (\e -> do
GHC.printException e
liftIO $ exitWith (ExitFailure 1)) $ do
- liftIO $ handleFlagWarnings logger4 (initPrintConfig dflags4) (initDiagOpts dflags4) flagWarnings'
+ liftIO $ printOrThrowDiagnostics logger4 (initPrintConfig dflags4) diag_opts flagWarnings'
liftIO $ showBanner postLoadMode dflags4
@@ -787,7 +789,7 @@ initMulti unitArgsFiles = do
handleSourceError (\e -> do
GHC.printException e
liftIO $ exitWith (ExitFailure 1)) $ do
- liftIO $ handleFlagWarnings logger (initPrintConfig dflags2) (initDiagOpts dflags2) warns
+ liftIO $ printOrThrowDiagnostics logger (initPrintConfig dflags2) (initDiagOpts dflags2) (GhcDriverMessage <$> warns)
let (dflags3, srcs, objs) = parseTargetFiles dflags2 (map unLoc fileish_args)
dflags4 = offsetDynFlags dflags3
diff --git a/testsuite/tests/backpack/should_compile/bkp09.stderr b/testsuite/tests/backpack/should_compile/bkp09.stderr
index 1cb9ac5819..c7cca0a7da 100644
--- a/testsuite/tests/backpack/should_compile/bkp09.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp09.stderr
@@ -1,5 +1,5 @@
-bkp09.bkp:1:26: warning: [-Wdeprecated-flags (in -Wdefault)]
+bkp09.bkp:1:26: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
[1 of 5] Processing p
[1 of 1] Compiling H[sig] ( p/H.hsig, nothing )
diff --git a/testsuite/tests/backpack/should_compile/bkp15.stderr b/testsuite/tests/backpack/should_compile/bkp15.stderr
index a3c1b83851..6ee4e42d46 100644
--- a/testsuite/tests/backpack/should_compile/bkp15.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp15.stderr
@@ -1,5 +1,5 @@
-bkp15.bkp:1:26: warning: [-Wdeprecated-flags (in -Wdefault)]
+bkp15.bkp:1:26: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
[1 of 5] Processing p
[1 of 1] Compiling H[sig] ( p/H.hsig, nothing )
diff --git a/testsuite/tests/deSugar/should_compile/ds041.stderr b/testsuite/tests/deSugar/should_compile/ds041.stderr
index 125d364a06..b13de60281 100644
--- a/testsuite/tests/deSugar/should_compile/ds041.stderr
+++ b/testsuite/tests/deSugar/should_compile/ds041.stderr
@@ -1,5 +1,5 @@
-ds041.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+ds041.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
ds041.hs:16:7: warning: [GHC-20125] [-Wmissing-fields (in -Wdefault)]
diff --git a/testsuite/tests/deriving/should_compile/T20501.stderr b/testsuite/tests/deriving/should_compile/T20501.stderr
index acb15a7255..40f1e4d5e8 100644
--- a/testsuite/tests/deriving/should_compile/T20501.stderr
+++ b/testsuite/tests/deriving/should_compile/T20501.stderr
@@ -1,3 +1,3 @@
-T20501.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+T20501.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/deriving/should_compile/T4325.stderr b/testsuite/tests/deriving/should_compile/T4325.stderr
index 2fd71e37f8..ab10dc0d16 100644
--- a/testsuite/tests/deriving/should_compile/T4325.stderr
+++ b/testsuite/tests/deriving/should_compile/T4325.stderr
@@ -1,3 +1,3 @@
-T4325.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+T4325.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/deriving/should_compile/T4966.stderr b/testsuite/tests/deriving/should_compile/T4966.stderr
index fb516b6334..436efb83e3 100644
--- a/testsuite/tests/deriving/should_compile/T4966.stderr
+++ b/testsuite/tests/deriving/should_compile/T4966.stderr
@@ -1,5 +1,5 @@
-T4966.hs:3:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+T4966.hs:3:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
T4966.hs:35:30: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)]
diff --git a/testsuite/tests/deriving/should_compile/drv-foldable-traversable1.stderr b/testsuite/tests/deriving/should_compile/drv-foldable-traversable1.stderr
index fa9c0b82c1..fdfb8323b6 100644
--- a/testsuite/tests/deriving/should_compile/drv-foldable-traversable1.stderr
+++ b/testsuite/tests/deriving/should_compile/drv-foldable-traversable1.stderr
@@ -1,3 +1,3 @@
-drv-foldable-traversable1.hs:4:32: warning: [-Wdeprecated-flags (in -Wdefault)]
+drv-foldable-traversable1.hs:4:32: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/deriving/should_compile/drv-functor1.stderr b/testsuite/tests/deriving/should_compile/drv-functor1.stderr
index 015dc28f87..c5b2119091 100644
--- a/testsuite/tests/deriving/should_compile/drv-functor1.stderr
+++ b/testsuite/tests/deriving/should_compile/drv-functor1.stderr
@@ -1,3 +1,3 @@
-drv-functor1.hs:6:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+drv-functor1.hs:6:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/deriving/should_fail/drvfail-functor2.stderr b/testsuite/tests/deriving/should_fail/drvfail-functor2.stderr
index cc3cf26dd7..aefc4bcd89 100644
--- a/testsuite/tests/deriving/should_fail/drvfail-functor2.stderr
+++ b/testsuite/tests/deriving/should_fail/drvfail-functor2.stderr
@@ -1,5 +1,5 @@
-drvfail-functor2.hs:2:29: warning: [-Wdeprecated-flags (in -Wdefault)]
+drvfail-functor2.hs:2:29: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
drvfail-functor2.hs:8:14: error: [GHC-16437]
diff --git a/testsuite/tests/driver/T11429a.stderr b/testsuite/tests/driver/T11429a.stderr
index 4c41f5ed6b..f2c36ce931 100644
--- a/testsuite/tests/driver/T11429a.stderr
+++ b/testsuite/tests/driver/T11429a.stderr
@@ -1,3 +1,3 @@
-on the commandline: warning: [-Wunrecognised-warning-flags (in -Wdefault)]
+on the commandline: warning: [GHC-93741] [-Wunrecognised-warning-flags (in -Wdefault)]
unrecognised warning flag: -Wfoobar
diff --git a/testsuite/tests/driver/T11429c.stderr b/testsuite/tests/driver/T11429c.stderr
index 89deb22101..98b0987110 100644
--- a/testsuite/tests/driver/T11429c.stderr
+++ b/testsuite/tests/driver/T11429c.stderr
@@ -1,3 +1,3 @@
-on the commandline: error: [-Wunrecognised-warning-flags, Werror=unrecognised-warning-flags]
+on the commandline: error: [GHC-93741] [-Wunrecognised-warning-flags, Werror=unrecognised-warning-flags]
unrecognised warning flag: -Wfoobar
diff --git a/testsuite/tests/driver/T12056b.stderr b/testsuite/tests/driver/T12056b.stderr
index bd475e4d1e..cc2e494d65 100644
--- a/testsuite/tests/driver/T12056b.stderr
+++ b/testsuite/tests/driver/T12056b.stderr
@@ -1,3 +1,3 @@
-on the commandline: warning: [-Wunrecognised-warning-flags (in -Wdefault)]
+on the commandline: warning: [GHC-93741] [-Wunrecognised-warning-flags (in -Wdefault)]
unrecognised warning flag: -Wbar
diff --git a/testsuite/tests/driver/T12056c.stderr b/testsuite/tests/driver/T12056c.stderr
index 3a924a38da..2591d64eeb 100644
--- a/testsuite/tests/driver/T12056c.stderr
+++ b/testsuite/tests/driver/T12056c.stderr
@@ -1,6 +1,6 @@
-on the commandline: warning: [-Wdeprecated-flags (in -Wdefault)]
- -XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
-
-on the commandline: warning: [-Wunrecognised-warning-flags (in -Wdefault)]
+on the commandline: warning: [GHC-93741] [-Wunrecognised-warning-flags (in -Wdefault)]
unrecognised warning flag: -Wbar
+
+on the commandline: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
+ -XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
diff --git a/testsuite/tests/driver/T20436/T20436.stderr b/testsuite/tests/driver/T20436/T20436.stderr
index 1fda220263..66b0af04c6 100644
--- a/testsuite/tests/driver/T20436/T20436.stderr
+++ b/testsuite/tests/driver/T20436/T20436.stderr
@@ -1,3 +1,3 @@
-when making flags consistent: warning:
+when making flags consistent: warning: [GHC-74335]
-dynamic-too is ignored when using -dynamic
diff --git a/testsuite/tests/driver/T21682.stderr b/testsuite/tests/driver/T21682.stderr
index d41a1b8ca3..6b74da267c 100644
--- a/testsuite/tests/driver/T21682.stderr
+++ b/testsuite/tests/driver/T21682.stderr
@@ -1,3 +1,3 @@
-on the commandline: error: [-Wunrecognised-warning-flags, Werror=unrecognised-warning-flags]
+on the commandline: error: [GHC-93741] [-Wunrecognised-warning-flags, Werror=unrecognised-warning-flags]
unrecognised warning flag: -Wfoo
diff --git a/testsuite/tests/driver/T2464.stderr b/testsuite/tests/driver/T2464.stderr
index bba952fd30..02bcaa4f40 100644
--- a/testsuite/tests/driver/T2464.stderr
+++ b/testsuite/tests/driver/T2464.stderr
@@ -1,3 +1,3 @@
-T2464.hs:3:17: warning: [-Wdeprecated-flags (in -Wdefault)]
+T2464.hs:3:17: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-fffi is deprecated: use -XForeignFunctionInterface or pragma {-# LANGUAGE ForeignFunctionInterface #-} instead
diff --git a/testsuite/tests/generics/GenCannotDoRep0_0.stderr b/testsuite/tests/generics/GenCannotDoRep0_0.stderr
index 04c03697b3..427bccef6c 100644
--- a/testsuite/tests/generics/GenCannotDoRep0_0.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep0_0.stderr
@@ -1,5 +1,5 @@
-GenCannotDoRep0_0.hs:6:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+GenCannotDoRep0_0.hs:6:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
GenCannotDoRep0_0.hs:13:45: error: [GHC-16437]
diff --git a/testsuite/tests/generics/GenCannotDoRep0_1.stderr b/testsuite/tests/generics/GenCannotDoRep0_1.stderr
index d6167ae61b..6e6d26321b 100644
--- a/testsuite/tests/generics/GenCannotDoRep0_1.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep0_1.stderr
@@ -1,5 +1,5 @@
-GenCannotDoRep0_1.hs:1:29: warning: [-Wdeprecated-flags (in -Wdefault)]
+GenCannotDoRep0_1.hs:1:29: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
GenCannotDoRep0_1.hs:8:49: error: [GHC-30367]
diff --git a/testsuite/tests/generics/GenCannotDoRep1_1.stderr b/testsuite/tests/generics/GenCannotDoRep1_1.stderr
index 9e009398cc..c7b38ba37f 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_1.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep1_1.stderr
@@ -1,5 +1,5 @@
-GenCannotDoRep1_1.hs:1:29: warning: [-Wdeprecated-flags (in -Wdefault)]
+GenCannotDoRep1_1.hs:1:29: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
GenCannotDoRep1_1.hs:8:49: error: [GHC-30367]
diff --git a/testsuite/tests/ghc-api/T10052/T10052.stderr b/testsuite/tests/ghc-api/T10052/T10052.stderr
index 14d76b9f49..e39720016b 100644
--- a/testsuite/tests/ghc-api/T10052/T10052.stderr
+++ b/testsuite/tests/ghc-api/T10052/T10052.stderr
@@ -1,3 +1,3 @@
-when making flags consistent: warning:
+when making flags consistent: warning: [GHC-74335]
Optimization flags are incompatible with the byte-code interpreter; optimization flags ignored.
diff --git a/testsuite/tests/ghci.debugger/scripts/print007.stderr b/testsuite/tests/ghci.debugger/scripts/print007.stderr
index 14d76b9f49..e39720016b 100644
--- a/testsuite/tests/ghci.debugger/scripts/print007.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/print007.stderr
@@ -1,3 +1,3 @@
-when making flags consistent: warning:
+when making flags consistent: warning: [GHC-74335]
Optimization flags are incompatible with the byte-code interpreter; optimization flags ignored.
diff --git a/testsuite/tests/ghci/scripts/ghci031.stderr b/testsuite/tests/ghci/scripts/ghci031.stderr
index 7fce54a8f1..40323bbdcf 100644
--- a/testsuite/tests/ghci/scripts/ghci031.stderr
+++ b/testsuite/tests/ghci/scripts/ghci031.stderr
@@ -1,3 +1,3 @@
-ghci031.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+ghci031.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/ghci/should_fail/T10549.stderr b/testsuite/tests/ghci/should_fail/T10549.stderr
index 14d76b9f49..e39720016b 100644
--- a/testsuite/tests/ghci/should_fail/T10549.stderr
+++ b/testsuite/tests/ghci/should_fail/T10549.stderr
@@ -1,3 +1,3 @@
-when making flags consistent: warning:
+when making flags consistent: warning: [GHC-74335]
Optimization flags are incompatible with the byte-code interpreter; optimization flags ignored.
diff --git a/testsuite/tests/ghci/should_fail/T10549a.stderr b/testsuite/tests/ghci/should_fail/T10549a.stderr
index 14d76b9f49..e39720016b 100644
--- a/testsuite/tests/ghci/should_fail/T10549a.stderr
+++ b/testsuite/tests/ghci/should_fail/T10549a.stderr
@@ -1,3 +1,3 @@
-when making flags consistent: warning:
+when making flags consistent: warning: [GHC-74335]
Optimization flags are incompatible with the byte-code interpreter; optimization flags ignored.
diff --git a/testsuite/tests/indexed-types/should_compile/T3418.stderr b/testsuite/tests/indexed-types/should_compile/T3418.stderr
index 918d8b0723..26822fa6ec 100644
--- a/testsuite/tests/indexed-types/should_compile/T3418.stderr
+++ b/testsuite/tests/indexed-types/should_compile/T3418.stderr
@@ -1,3 +1,3 @@
-T3418.hs:1:28: warning: [-Wdeprecated-flags (in -Wdefault)]
+T3418.hs:1:28: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/indexed-types/should_compile/T3787.stderr b/testsuite/tests/indexed-types/should_compile/T3787.stderr
index 0d451f3704..3b9aa92aea 100644
--- a/testsuite/tests/indexed-types/should_compile/T3787.stderr
+++ b/testsuite/tests/indexed-types/should_compile/T3787.stderr
@@ -1,3 +1,3 @@
-T3787.hs:20:51: warning: [-Wdeprecated-flags (in -Wdefault)]
+T3787.hs:20:51: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
diff --git a/testsuite/tests/parser/should_compile/T16619.stderr b/testsuite/tests/parser/should_compile/T16619.stderr
index aab7175abd..f2c2b40472 100644
--- a/testsuite/tests/parser/should_compile/T16619.stderr
+++ b/testsuite/tests/parser/should_compile/T16619.stderr
@@ -1,3 +1,3 @@
-T16619.hs:2:13: warning: [-Wdeprecated-flags (in -Wdefault)]
+T16619.hs:2:13: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-Wmissing-space-after-bang is deprecated: bang patterns can no longer be written with a space
diff --git a/testsuite/tests/parser/should_compile/read018.stderr b/testsuite/tests/parser/should_compile/read018.stderr
index ca3e87e266..b3b9e367d5 100644
--- a/testsuite/tests/parser/should_compile/read018.stderr
+++ b/testsuite/tests/parser/should_compile/read018.stderr
@@ -1,3 +1,3 @@
-read018.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+read018.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/parser/should_fail/T16270.stderr b/testsuite/tests/parser/should_fail/T16270.stderr
index 8ecb9a3e84..92da6ea3b2 100644
--- a/testsuite/tests/parser/should_fail/T16270.stderr
+++ b/testsuite/tests/parser/should_fail/T16270.stderr
@@ -1,5 +1,5 @@
-T16270.hs:3:13: warning: [-Wdeprecated-flags (in -Wdefault)]
+T16270.hs:3:13: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-Werror=missing-space-after-bang is deprecated: bang patterns can no longer be written with a space
T16270.hs:8:1: warning: [GHC-94817] [-Wtabs (in -Wdefault)]
diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext1.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext1.stderr
index 730bc1b147..df97cc4971 100644
--- a/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext1.stderr
+++ b/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext1.stderr
@@ -1,5 +1,5 @@
-WildcardInADTContext1.hs:1:37: warning: [-Wdeprecated-flags (in -Wdefault)]
+WildcardInADTContext1.hs:1:37: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
WildcardInADTContext1.hs:4:13: error: [GHC-65507]
diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext2.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext2.stderr
index 8333aa4a14..12f918e5e1 100644
--- a/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext2.stderr
+++ b/testsuite/tests/partial-sigs/should_fail/WildcardInADTContext2.stderr
@@ -1,5 +1,5 @@
-WildcardInADTContext2.hs:1:53: warning: [-Wdeprecated-flags (in -Wdefault)]
+WildcardInADTContext2.hs:1:53: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
WildcardInADTContext2.hs:4:10: error: [GHC-76037]
diff --git a/testsuite/tests/rename/should_fail/RnStupidThetaInGadt.stderr b/testsuite/tests/rename/should_fail/RnStupidThetaInGadt.stderr
index f1bf190b6e..78dedf0088 100644
--- a/testsuite/tests/rename/should_fail/RnStupidThetaInGadt.stderr
+++ b/testsuite/tests/rename/should_fail/RnStupidThetaInGadt.stderr
@@ -1,5 +1,5 @@
-RnStupidThetaInGadt.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+RnStupidThetaInGadt.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
RnStupidThetaInGadt.hs:5:1: error: [GHC-18403]
diff --git a/testsuite/tests/rename/should_fail/rnfail055.stderr b/testsuite/tests/rename/should_fail/rnfail055.stderr
index 1077a6eb10..437da668e1 100644
--- a/testsuite/tests/rename/should_fail/rnfail055.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail055.stderr
@@ -1,8 +1,8 @@
-RnFail055.hs:2:73: warning: [-Wdeprecated-flags (in -Wdefault)]
+RnFail055.hs:2:73: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
-RnFail055.hs-boot:2:73: warning: [-Wdeprecated-flags (in -Wdefault)]
+RnFail055.hs-boot:2:73: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
RnFail055.hs-boot:5:1: error: [GHC-11890]
diff --git a/testsuite/tests/roles/should_compile/T8958.stderr b/testsuite/tests/roles/should_compile/T8958.stderr
index 9a8e781e67..dd716c6dd4 100644
--- a/testsuite/tests/roles/should_compile/T8958.stderr
+++ b/testsuite/tests/roles/should_compile/T8958.stderr
@@ -1,5 +1,5 @@
-T8958.hs:2:31: warning: [-Wdeprecated-flags (in -Wdefault)]
+T8958.hs:2:31: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
TYPE CONSTRUCTORS
newtype Map{2} :: * -> * -> *
diff --git a/testsuite/tests/safeHaskell/check/Check05.stderr b/testsuite/tests/safeHaskell/check/Check05.stderr
index c14f8c02b2..920b0ee762 100644
--- a/testsuite/tests/safeHaskell/check/Check05.stderr
+++ b/testsuite/tests/safeHaskell/check/Check05.stderr
@@ -1,3 +1,3 @@
-Check05.hs:1:17:
- Warning: -fpackage-trust ignored; must be specified with a Safe Haskell flag
+Check05.hs:1:17: warning: [GHC-83552]
+ -fpackage-trust ignored; must be specified with a Safe Haskell flag
diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr
index 603cb636a7..95c5e4e940 100644
--- a/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr
+++ b/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr
@@ -1,3 +1,3 @@
-SafeFlags18.hs:1:17: error: [-Werror]
+SafeFlags18.hs:1:17: error: [GHC-83552] [-Werror]
-fpackage-trust ignored; must be specified with a Safe Haskell flag
diff --git a/testsuite/tests/safeHaskell/ghci/p1.stderr b/testsuite/tests/safeHaskell/ghci/p1.stderr
index 9446e1df16..aada12ed37 100644
--- a/testsuite/tests/safeHaskell/ghci/p1.stderr
+++ b/testsuite/tests/safeHaskell/ghci/p1.stderr
@@ -1,6 +1,6 @@
-<no location info>: Warning:
+<no location info>: warning: [GHC-98887]
-XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
-<no location info>: Warning:
+<no location info>: warning: [GHC-98887]
-XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
diff --git a/testsuite/tests/safeHaskell/ghci/p14.stderr b/testsuite/tests/safeHaskell/ghci/p14.stderr
index 0f6f65975c..85c5672a1b 100644
--- a/testsuite/tests/safeHaskell/ghci/p14.stderr
+++ b/testsuite/tests/safeHaskell/ghci/p14.stderr
@@ -1,5 +1,5 @@
-when making flags consistent: warning:
+when making flags consistent: warning: [GHC-74335]
Optimization flags are incompatible with the byte-code interpreter; optimization flags ignored.
<interactive>:10:25: error: [GHC-39999]
diff --git a/testsuite/tests/safeHaskell/ghci/p16.stderr b/testsuite/tests/safeHaskell/ghci/p16.stderr
index f915af1f1b..47972a4e5a 100644
--- a/testsuite/tests/safeHaskell/ghci/p16.stderr
+++ b/testsuite/tests/safeHaskell/ghci/p16.stderr
@@ -1,5 +1,5 @@
-<no location info>: warning:
+<no location info>: warning: [GHC-98887]
-XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
<interactive>:16:29: error: [GHC-82023]
diff --git a/testsuite/tests/safeHaskell/safeInfered/SafeInfered05.stderr b/testsuite/tests/safeHaskell/safeInfered/SafeInfered05.stderr
index e9e186fdeb..122a6b827f 100644
--- a/testsuite/tests/safeHaskell/safeInfered/SafeInfered05.stderr
+++ b/testsuite/tests/safeHaskell/safeInfered/SafeInfered05.stderr
@@ -1,5 +1,5 @@
-SafeInfered05.hs:3:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+SafeInfered05.hs:3:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
SafeInfered05_A.hs:3:17: warning: [GHC-58656] [-Wsafe]
diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr
index 80b8cb2637..cdf91513db 100644
--- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr
+++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr
@@ -1,3 +1,3 @@
-UnsafeInfered18.hs:4:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+UnsafeInfered18.hs:4:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang01.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang01.stderr
index 1fb5ec66bb..458b753806 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang01.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang01.stderr
@@ -1,3 +1,3 @@
-SafeLang01.hs:2:20: warning:
+SafeLang01.hs:2:20: warning: [GHC-98887]
-XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr
index 069e5be4e9..8cb7a14e60 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr
@@ -1,3 +1,3 @@
-SafeLang02.hs:1:20:
- Warning: -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
+SafeLang02.hs:1:20: warning: [GHC-98887]
+ -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr
index 7d26176149..08f41b47fc 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr
@@ -1,5 +1,5 @@
-SafeLang07.hs:2:14: warning:
+SafeLang07.hs:2:14: warning: [GHC-98887]
-XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
SafeLang07.hs:15:1: error: [GHC-87110]
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr
index 2239f73d8f..ce72d25d86 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr
@@ -1,8 +1,8 @@
-SafeLang12.hs:3:14: warning:
+SafeLang12.hs:3:14: warning: [GHC-98887]
-XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
-SafeLang12_B.hs:3:14: warning:
+SafeLang12_B.hs:3:14: warning: [GHC-98887]
-XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
[1 of 4] Compiling SafeLang12_A ( SafeLang12_A.hs, SafeLang12_A.o )
[2 of 4] Compiling SafeLang12_B ( SafeLang12_B.hs, SafeLang12_B.o )
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang16.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang16.stderr
index 5aaab72d8a..d9b04676a2 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang16.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang16.stderr
@@ -1,3 +1,3 @@
-SafeLang16.hs:2:14: warning:
+SafeLang16.hs:2:14: warning: [GHC-98887]
-XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr
index 1dbe65d156..8e61820aaf 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang19.stderr
@@ -1,3 +1,3 @@
-SafeLang19.hs:2:20: warning:
+SafeLang19.hs:2:20: warning: [GHC-98887]
-XDerivingVia is not allowed in Safe Haskell; ignoring -XDerivingVia
diff --git a/testsuite/tests/stranal/should_compile/str001.stderr b/testsuite/tests/stranal/should_compile/str001.stderr
index 99575b8449..2100cbeac6 100644
--- a/testsuite/tests/stranal/should_compile/str001.stderr
+++ b/testsuite/tests/stranal/should_compile/str001.stderr
@@ -1,4 +1,3 @@
-str001.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+str001.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
-
diff --git a/testsuite/tests/th/T8333.stderr b/testsuite/tests/th/T8333.stderr
index 14d76b9f49..e39720016b 100644
--- a/testsuite/tests/th/T8333.stderr
+++ b/testsuite/tests/th/T8333.stderr
@@ -1,3 +1,3 @@
-when making flags consistent: warning:
+when making flags consistent: warning: [GHC-74335]
Optimization flags are incompatible with the byte-code interpreter; optimization flags ignored.
diff --git a/testsuite/tests/typecheck/should_compile/T17567StupidThetaB.stderr b/testsuite/tests/typecheck/should_compile/T17567StupidThetaB.stderr
index ce337297cc..7f1d36fab3 100644
--- a/testsuite/tests/typecheck/should_compile/T17567StupidThetaB.stderr
+++ b/testsuite/tests/typecheck/should_compile/T17567StupidThetaB.stderr
@@ -1,3 +1,3 @@
-T17567StupidThetaB.hs:2:37: warning: [-Wdeprecated-flags (in -Wdefault)]
+T17567StupidThetaB.hs:2:37: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/typecheck/should_compile/T2478.stderr b/testsuite/tests/typecheck/should_compile/T2478.stderr
index cd9ab65c12..4ef85d7266 100644
--- a/testsuite/tests/typecheck/should_compile/T2478.stderr
+++ b/testsuite/tests/typecheck/should_compile/T2478.stderr
@@ -1,3 +1,3 @@
-T2478.hs:1:41: warning: [-Wdeprecated-flags (in -Wdefault)]
+T2478.hs:1:41: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/typecheck/should_compile/T4355.stderr b/testsuite/tests/typecheck/should_compile/T4355.stderr
index 6530013f1c..91c443c922 100644
--- a/testsuite/tests/typecheck/should_compile/T4355.stderr
+++ b/testsuite/tests/typecheck/should_compile/T4355.stderr
@@ -1,3 +1,3 @@
-T4355.hs:3:172: warning: [-Wdeprecated-flags (in -Wdefault)]
+T4355.hs:3:172: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/typecheck/should_compile/tc182.stderr b/testsuite/tests/typecheck/should_compile/tc182.stderr
index 07c3e2ef32..91de8b6b66 100644
--- a/testsuite/tests/typecheck/should_compile/tc182.stderr
+++ b/testsuite/tests/typecheck/should_compile/tc182.stderr
@@ -1,3 +1,3 @@
-tc182.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+tc182.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
diff --git a/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr b/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr
index 376f9733c0..835488935e 100644
--- a/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr
+++ b/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr
@@ -1,5 +1,5 @@
-T17567StupidTheta.hs:1:37: warning: [-Wdeprecated-flags (in -Wdefault)]
+T17567StupidTheta.hs:1:37: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
T17567StupidTheta.hs:6:1: error: [GHC-16220]
diff --git a/testsuite/tests/typecheck/should_fail/tcfail067.stderr b/testsuite/tests/typecheck/should_fail/tcfail067.stderr
index fffdfaf6f7..7ac3485248 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail067.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail067.stderr
@@ -1,5 +1,5 @@
-tcfail067.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+tcfail067.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
tcfail067.hs:12:16: error: [GHC-39999]
diff --git a/testsuite/tests/typecheck/should_fail/tcfail102.stderr b/testsuite/tests/typecheck/should_fail/tcfail102.stderr
index 53a8b5dfec..bb96aa86a4 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail102.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail102.stderr
@@ -1,5 +1,5 @@
-tcfail102.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+tcfail102.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
tcfail102.hs:9:7: error: [GHC-39999]
diff --git a/testsuite/tests/typecheck/should_fail/tcfail125.stderr b/testsuite/tests/typecheck/should_fail/tcfail125.stderr
index 897ef88af1..fe55a033b5 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail125.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail125.stderr
@@ -1,5 +1,5 @@
-tcfail125.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+tcfail125.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
tcfail125.hs:11:4: error: [GHC-39999]
diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
index ff2a76fec7..3c6028b362 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
@@ -1,5 +1,5 @@
-tcfail133.hs:2:61: warning: [-Wdeprecated-flags (in -Wdefault)]
+tcfail133.hs:2:61: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
tcfail133.hs:70:7: error: [GHC-39999]
diff --git a/testsuite/tests/typecheck/should_fail/tcfail137.stderr b/testsuite/tests/typecheck/should_fail/tcfail137.stderr
index 673f50dfa0..d230050049 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail137.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail137.stderr
@@ -1,5 +1,5 @@
-tcfail137.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+tcfail137.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
tcfail137.hs:8:5: error: [GHC-39999]
diff --git a/testsuite/tests/typecheck/should_fail/tcfail151.stderr b/testsuite/tests/typecheck/should_fail/tcfail151.stderr
index 7ffb421471..6c411adb5b 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail151.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail151.stderr
@@ -1,5 +1,5 @@
-tcfail151.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
+tcfail151.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
tcfail151.hs:8:6: error: [GHC-83865]
diff --git a/testsuite/tests/typecheck/should_run/T3731.stderr b/testsuite/tests/typecheck/should_run/T3731.stderr
index d66f9f9a74..02f891fe95 100644
--- a/testsuite/tests/typecheck/should_run/T3731.stderr
+++ b/testsuite/tests/typecheck/should_run/T3731.stderr
@@ -1,5 +1,5 @@
-T3731.hs:4:15: warning: [-Wdeprecated-flags (in -Wdefault)]
+T3731.hs:4:15: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
T3731.hs:122:32: error: [GHC-39999]
diff --git a/testsuite/tests/warnings/should_compile/T20312.stderr b/testsuite/tests/warnings/should_compile/T20312.stderr
index fb4cf338a6..f9071fb319 100644
--- a/testsuite/tests/warnings/should_compile/T20312.stderr
+++ b/testsuite/tests/warnings/should_compile/T20312.stderr
@@ -1,3 +1,3 @@
-T20312.hs:1:14: warning: [-Wdeprecated-flags (in -Wdefault)]
- -XTypeInType is deprecated: use -XDataKinds and -XPolyKinds instead
+T20312.hs:1:14: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
+ -XTypeInType is deprecated: use -XDataKinds and -XPolyKinds instead