[Git][ghc/ghc][master] 2 commits: Fix -ddump-to-file and -ddump-timings interaction (#20316)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Aug 14 08:42:41 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
52f5e8fb by cydparser at 2023-08-14T04:42:20-04:00
Fix -ddump-to-file and -ddump-timings interaction (#20316)

- - - - -
1274c5d6 by cydparser at 2023-08-14T04:42:20-04:00
Update release notes (#20316)

- - - - -


3 changed files:

- compiler/GHC/Utils/Error.hs
- docs/users_guide/9.10.1-notes.rst
- − testsuite/tests/driver/T20316.stderr


Changes:

=====================================
compiler/GHC/Utils/Error.hs
=====================================
@@ -414,7 +414,7 @@ withTiming' :: MonadIO m
             -> m a
 withTiming' logger what force_result prtimings action
   = if logVerbAtLeast logger 2 || logHasDumpFlag logger Opt_D_dump_timings
-    then do whenPrintTimings $
+    then do when printTimingsNotDumpToFile $ liftIO $
               logInfo logger $ withPprStyle defaultUserStyle $
                 text "***" <+> what <> colon
             let ctx = log_default_user_context (logFlags logger)
@@ -432,7 +432,7 @@ withTiming' logger what force_result prtimings action
             let alloc = alloc0 - alloc1
                 time = realToFrac (end - start) * 1e-9
 
-            when (logVerbAtLeast logger 2 && prtimings == PrintTimings)
+            when (logVerbAtLeast logger 2 && printTimingsNotDumpToFile)
                 $ liftIO $ logInfo logger $ withPprStyle defaultUserStyle
                     (text "!!!" <+> what <> colon <+> text "finished in"
                      <+> doublePrec 2 time
@@ -452,7 +452,16 @@ withTiming' logger what force_result prtimings action
             pure r
      else action
 
-    where whenPrintTimings = liftIO . when (prtimings == PrintTimings)
+    where whenPrintTimings =
+            liftIO . when printTimings
+
+          printTimings =
+            prtimings == PrintTimings
+
+          -- Avoid both printing to console and dumping to a file (#20316).
+          printTimingsNotDumpToFile =
+            printTimings
+            && not (log_dump_to_file (logFlags logger))
 
           recordAllocs alloc =
             liftIO $ traceMarkerIO $ "GHC:allocs:" ++ show alloc


=====================================
docs/users_guide/9.10.1-notes.rst
=====================================
@@ -48,6 +48,9 @@ Compiler
   <https://github.com/agda/agda>`_, the size of the build results was reduced by
   about 10% when these info tables were omitted.
 
+- Fixed a bug where compiling with both :ghc-flag:`-ddump-timings` and :ghc-flag:`-ddump-to-file` did not
+  suppress printing timings to the console. See :ghc-ticket:`20316`.
+
 GHCi
 ~~~~
 


=====================================
testsuite/tests/driver/T20316.stderr deleted
=====================================
@@ -1,6 +0,0 @@
-*** initializing unit database:
-*** Chasing dependencies:
-*** Parser [Main]:
-*** Renamer/typechecker [Main]:
-*** Desugar [Main]:
-*** CoreTidy [Main]:



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d7047e0dc066ae06de8104a31ffa9c56d3f03bfe...1274c5d626fec3d65b3eb3cce890e6fa4e06b587

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d7047e0dc066ae06de8104a31ffa9c56d3f03bfe...1274c5d626fec3d65b3eb3cce890e6fa4e06b587
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/20230814/1797f22a/attachment-0001.html>


More information about the ghc-commits mailing list