Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
bf03bbaa
by Simon Hengel at 2025-08-01T04:39:05-04:00
-
a889ec75
by Simon Hengel at 2025-08-01T04:39:05-04:00
5 changed files:
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/SysTools/Tasks.hs
- compiler/GHC/Utils/Error.hs
- testsuite/tests/corelint/T21115b.stderr
Changes:
... | ... | @@ -1552,7 +1552,7 @@ wrapAction msg_wrapper hsc_env k = do |
1552 | 1552 | -- ThreadKilled in particular needs to actually kill the thread.
|
1553 | 1553 | -- So rethrow that and the other async exceptions
|
1554 | 1554 | Just (err :: SomeAsyncException) -> throwIO err
|
1555 | - _ -> errorMsg lcl_logger (text (show exc))
|
|
1555 | + _ -> reportError lcl_logger neverQualify emptyDiagOpts noSrcSpan (text (show exc))
|
|
1556 | 1556 | return Nothing
|
1557 | 1557 | |
1558 | 1558 |
... | ... | @@ -43,6 +43,7 @@ import GHC.Settings |
43 | 43 | import GHC.Platform
|
44 | 44 | import GHC.Platform.Ways
|
45 | 45 | |
46 | +import GHC.Driver.Errors
|
|
46 | 47 | import GHC.Driver.Phases
|
47 | 48 | import GHC.Driver.Env
|
48 | 49 | import GHC.Driver.Session
|
... | ... | @@ -50,7 +51,7 @@ import GHC.Driver.Ppr |
50 | 51 | import GHC.Driver.Config.Diagnostic
|
51 | 52 | import GHC.Driver.Config.Finder
|
52 | 53 | |
53 | -import GHC.Tc.Utils.Monad
|
|
54 | +import GHC.Tc.Utils.Monad hiding (reportDiagnostic)
|
|
54 | 55 | |
55 | 56 | import GHC.Runtime.Interpreter
|
56 | 57 | import GHCi.BreakArray
|
... | ... | @@ -1309,9 +1310,9 @@ load_dyn interp hsc_env crash_early dll = do |
1309 | 1310 | then cmdLineErrorIO err
|
1310 | 1311 | else do
|
1311 | 1312 | when (diag_wopt Opt_WarnMissedExtraSharedLib diag_opts)
|
1312 | - $ logMsg logger
|
|
1313 | - (mkMCDiagnostic diag_opts (WarningWithFlag Opt_WarnMissedExtraSharedLib) Nothing)
|
|
1314 | - noSrcSpan $ withPprStyle defaultUserStyle (note err)
|
|
1313 | + $ reportDiagnostic logger
|
|
1314 | + neverQualify diag_opts
|
|
1315 | + noSrcSpan (WarningWithFlag Opt_WarnMissedExtraSharedLib) $ withPprStyle defaultUserStyle (note err)
|
|
1315 | 1316 | pure Nothing
|
1316 | 1317 | where
|
1317 | 1318 | diag_opts = initDiagOpts (hsc_dflags hsc_env)
|
... | ... | @@ -1499,8 +1500,7 @@ locateLib interp hsc_env is_hs lib_dirs gcc_dirs lib0 |
1499 | 1500 | , not loading_dynamic_hs_libs
|
1500 | 1501 | , interpreterProfiled interp
|
1501 | 1502 | = do
|
1502 | - let diag = mkMCDiagnostic diag_opts WarningWithoutFlag Nothing
|
|
1503 | - logMsg logger diag noSrcSpan $ withPprStyle defaultErrStyle $
|
|
1503 | + reportDiagnostic logger neverQualify diag_opts noSrcSpan WarningWithoutFlag $ withPprStyle defaultErrStyle $
|
|
1504 | 1504 | text "Interpreter failed to load profiled static library" <+> text lib <> char '.' $$
|
1505 | 1505 | text " \tTrying dynamic library instead. If this fails try to rebuild" <+>
|
1506 | 1506 | text "libraries with profiling support."
|
... | ... | @@ -55,7 +55,7 @@ import GHC.Driver.Config.Diagnostic |
55 | 55 | import GHC.Driver.Errors
|
56 | 56 | import GHC.Driver.Errors.Types (GhcMessage(..), DriverMessage (DriverNoConfiguredLLVMToolchain))
|
57 | 57 | import GHC.Driver.CmdLine (warnsToMessages)
|
58 | -import GHC.Types.SrcLoc (noLoc)
|
|
58 | +import GHC.Types.SrcLoc (noLoc, noSrcSpan)
|
|
59 | 59 | |
60 | 60 | {-
|
61 | 61 | ************************************************************************
|
... | ... | @@ -346,7 +346,7 @@ figureLlvmVersion logger dflags = traceSystoolCommand logger "llc" $ do |
346 | 346 | debugTraceMsg logger 2
|
347 | 347 | (text "Error (figuring out LLVM version):" <+>
|
348 | 348 | text (show err))
|
349 | - errorMsg logger $ vcat
|
|
349 | + reportError logger neverQualify emptyDiagOpts noSrcSpan $ vcat
|
|
350 | 350 | [ text "Warning:", nest 9 $
|
351 | 351 | text "Couldn't figure out LLVM version!" $$
|
352 | 352 | text ("Make sure you have installed LLVM between ["
|
... | ... | @@ -32,7 +32,7 @@ module GHC.Utils.Error ( |
32 | 32 | emptyMessages, mkDecorated, mkLocMessage,
|
33 | 33 | mkMsgEnvelope, mkPlainMsgEnvelope, mkPlainErrorMsgEnvelope,
|
34 | 34 | mkErrorMsgEnvelope,
|
35 | - mkMCDiagnostic, errorDiagnostic, diagReasonSeverity,
|
|
35 | + mkMCDiagnostic, diagReasonSeverity,
|
|
36 | 36 | |
37 | 37 | mkPlainError,
|
38 | 38 | mkPlainDiagnostic,
|
... | ... | @@ -46,7 +46,6 @@ module GHC.Utils.Error ( |
46 | 46 | -- * Issuing messages during compilation
|
47 | 47 | putMsg, printInfoForUser, printOutputForUser,
|
48 | 48 | logInfo, logOutput,
|
49 | - errorMsg,
|
|
50 | 49 | fatalErrorMsg,
|
51 | 50 | compilationProgressMsg,
|
52 | 51 | showPass,
|
... | ... | @@ -168,11 +167,6 @@ mkMCDiagnostic opts reason code = MCDiagnostic sev reason' code |
168 | 167 | where
|
169 | 168 | (sev, reason') = diag_reason_severity opts reason
|
170 | 169 | |
171 | --- | Varation of 'mkMCDiagnostic' which can be used when we are /sure/ the
|
|
172 | --- input 'DiagnosticReason' /is/ 'ErrorWithoutFlag' and there is no diagnostic code.
|
|
173 | -errorDiagnostic :: MessageClass
|
|
174 | -errorDiagnostic = MCDiagnostic SevError (ResolvedDiagnosticReason ErrorWithoutFlag) Nothing
|
|
175 | - |
|
176 | 170 | --
|
177 | 171 | -- Creating MsgEnvelope(s)
|
178 | 172 | --
|
... | ... | @@ -318,17 +312,12 @@ sortMsgBag mopts = maybeLimit . sortBy (cmp `on` errMsgSpan) . bagToList |
318 | 312 | ghcExit :: Logger -> Int -> IO ()
|
319 | 313 | ghcExit logger val
|
320 | 314 | | val == 0 = exitWith ExitSuccess
|
321 | - | otherwise = do errorMsg logger (text "\nCompilation had errors\n\n")
|
|
315 | + | otherwise = do fatalErrorMsg logger (text "\nCompilation had errors\n\n")
|
|
322 | 316 | exitWith (ExitFailure val)
|
323 | 317 | |
324 | 318 | -- -----------------------------------------------------------------------------
|
325 | 319 | -- Outputting messages from the compiler
|
326 | 320 | |
327 | -errorMsg :: Logger -> SDoc -> IO ()
|
|
328 | -errorMsg logger msg
|
|
329 | - = logMsg logger errorDiagnostic noSrcSpan $
|
|
330 | - withPprStyle defaultErrStyle msg
|
|
331 | - |
|
332 | 321 | fatalErrorMsg :: Logger -> SDoc -> IO ()
|
333 | 322 | fatalErrorMsg logger msg =
|
334 | 323 | logMsg logger MCFatal noSrcSpan $ withPprStyle defaultErrStyle msg
|
... | ... | @@ -30,6 +30,6 @@ end Rec } |
30 | 30 | |
31 | 31 | *** End of Offense ***
|
32 | 32 | |
33 | - |
|
34 | -<no location info>: error:
|
|
35 | 33 | Compilation had errors
|
34 | + |
|
35 | + |