[Git][ghc/ghc][master] Output Lint errors to stderr instead of stdout
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Thu Jun 1 14:56:36 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
1c96bc3d by Krzysztof Gogolewski at 2023-06-01T10:56:11-04:00
Output Lint errors to stderr instead of stdout
This is a continuation of 7b095b99, which fixed warnings but not errors.
Refs #13342
- - - - -
3 changed files:
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Stg/Lint.hs
Changes:
=====================================
compiler/GHC/Core/Lint.hs
=====================================
@@ -302,6 +302,10 @@ path does not result in allocation in the hot path. This can be surprisingly
impactful. Changing `lint_app` reduced allocations for one test program I was
looking at by ~4%.
+Note [MCInfo for Lint]
+~~~~~~~~~~~~~~~~~~~~~~
+When printing a Lint message, use the MCInfo severity so that the
+message is printed on stderr rather than stdout (#13342).
************************************************************************
* *
@@ -425,7 +429,7 @@ displayLintResults :: Logger
-> IO ()
displayLintResults logger display_warnings pp_what pp_pgm (warns, errs)
| not (isEmptyBag errs)
- = do { logMsg logger Err.MCDump noSrcSpan
+ = do { logMsg logger Err.MCInfo noSrcSpan -- See Note [MCInfo for Lint]
$ withPprStyle defaultDumpStyle
(vcat [ lint_banner "errors" pp_what, Err.pprMessageBag errs
, text "*** Offending Program ***"
@@ -436,9 +440,7 @@ displayLintResults logger display_warnings pp_what pp_pgm (warns, errs)
| not (isEmptyBag warns)
, log_enable_debug (logFlags logger)
, display_warnings
- -- If the Core linter encounters an error, output to stderr instead of
- -- stdout (#13342)
- = logMsg logger Err.MCInfo noSrcSpan
+ = logMsg logger Err.MCInfo noSrcSpan -- See Note [MCInfo for Lint]
$ withPprStyle defaultDumpStyle
(lint_banner "warnings" pp_what $$ Err.pprMessageBag (mapBag ($$ blankLine) warns))
=====================================
compiler/GHC/Driver/CodeOutput.hs
=====================================
@@ -105,7 +105,7 @@ codeOutput logger tmpfs llvm_config dflags unit_state this_mod filenm location g
(const ()) $ do
{ case cmmLint (targetPlatform dflags) cmm of
Just err -> do { logMsg logger
- MCDump
+ MCInfo -- See Note [MCInfo for Lint] in "GHC.Core.Lint"
noSrcSpan
$ withPprStyle defaultDumpStyle err
; ghcExit logger 1
=====================================
compiler/GHC/Stg/Lint.hs
=====================================
@@ -149,7 +149,7 @@ lintStgTopBindings platform logger diag_opts opts extra_vars this_mod unarised w
Nothing ->
return ()
Just msg -> do
- logMsg logger Err.MCDump noSrcSpan
+ logMsg logger Err.MCInfo noSrcSpan -- See Note [MCInfo for Lint] in "GHC.Core.Lint"
$ withPprStyle defaultDumpStyle
(vcat [ text "*** Stg Lint ErrMsgs: in" <+>
text whodunit <+> text "***",
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1c96bc3d786b13af593c0d336772cc86ea0ac5e2
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1c96bc3d786b13af593c0d336772cc86ea0ac5e2
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230601/dd1365b1/attachment-0001.html>
More information about the ghc-commits
mailing list