[commit: ghc] master: Introduce the flag -dsuppress-timestamps to avoid timestamps in dumps. (3d43fd5)

git at git.haskell.org git at git.haskell.org
Sun Feb 25 21:57:36 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3d43fd5b816a980d650d98f5822831dfce38f658/ghc

>---------------------------------------------------------------

commit 3d43fd5b816a980d650d98f5822831dfce38f658
Author: Andreas Klebinger <klebinger.andreas at gmx.at>
Date:   Tue Feb 20 13:19:19 2018 -0500

    Introduce the flag -dsuppress-timestamps to avoid timestamps in dumps.
    
    This makes it easier to diff dumps which are otherwise identical.
    
    Also updated the description of -dsuppress-all as parts of these also
    apply to stages other than core.
    
    Test Plan: Looking at dump result.
    
    Reviewers: bgamari
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4429


>---------------------------------------------------------------

3d43fd5b816a980d650d98f5822831dfce38f658
 compiler/main/DynFlags.hs      | 8 ++++++--
 compiler/main/ErrUtils.hs      | 9 ++++++---
 docs/users_guide/debugging.rst | 9 ++++++++-
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 01432b6..b7720dd 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -583,6 +583,7 @@ data GeneralFlag
    | Opt_SuppressUniques
    | Opt_SuppressStgFreeVars
    | Opt_SuppressTicks     -- Replaces Opt_PprShowTicks
+   | Opt_SuppressTimestamps -- ^ Suppress timestamps in dumps
 
    -- temporary flags
    | Opt_AutoLinkPackages
@@ -3040,7 +3041,8 @@ dynamic_flags_deps = [
                   setGeneralFlag Opt_SuppressIdInfo
                   setGeneralFlag Opt_SuppressTicks
                   setGeneralFlag Opt_SuppressStgFreeVars
-                  setGeneralFlag Opt_SuppressTypeSignatures)
+                  setGeneralFlag Opt_SuppressTypeSignatures
+                  setGeneralFlag Opt_SuppressTimestamps)
 
         ------ Debugging ----------------------------------------------------
   , make_ord_flag defGhcFlag "dstg-stats"
@@ -3835,10 +3837,12 @@ dFlagsDeps = [
   flagSpec "suppress-idinfo"            Opt_SuppressIdInfo,
   flagSpec "suppress-unfoldings"        Opt_SuppressUnfoldings,
   flagSpec "suppress-module-prefixes"   Opt_SuppressModulePrefixes,
+  flagSpec "suppress-timestamps"        Opt_SuppressTimestamps,
   flagSpec "suppress-type-applications" Opt_SuppressTypeApplications,
   flagSpec "suppress-type-signatures"   Opt_SuppressTypeSignatures,
   flagSpec "suppress-uniques"           Opt_SuppressUniques,
-  flagSpec "suppress-var-kinds"         Opt_SuppressVarKinds]
+  flagSpec "suppress-var-kinds"         Opt_SuppressVarKinds
+  ]
 
 -- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
 fFlags :: [FlagSpec GeneralFlag]
diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs
index 13ff017..c7fb8ba 100644
--- a/compiler/main/ErrUtils.hs
+++ b/compiler/main/ErrUtils.hs
@@ -500,9 +500,12 @@ dumpSDoc dflags print_unqual flag hdr doc =
         doc' <- if null hdr
                 then return doc
                 else do t <- getCurrentTime
-                        let d = text (show t)
-                              $$ blankLine
-                              $$ doc
+                        let timeStamp = if (gopt Opt_SuppressTimestamps dflags)
+                                          then empty
+                                          else text (show t)
+                        let d = timeStamp
+                                $$ blankLine
+                                $$ doc
                         return $ mkDumpDoc hdr d
         defaultLogActionHPrintDoc dflags handle doc' dump_style
 
diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst
index cf92634..d11cc04 100644
--- a/docs/users_guide/debugging.rst
+++ b/docs/users_guide/debugging.rst
@@ -612,7 +612,7 @@ are doing, not all of it will be useful. Use these flags to suppress the
 parts that you are not interested in.
 
 .. ghc-flag:: -dsuppress-all
-    :shortdesc: In core dumps, suppress everything (except for uniques) that is
+    :shortdesc: In dumps, suppress everything (except for uniques) that is
         suppressible.
     :type: dynamic
 
@@ -663,6 +663,13 @@ parts that you are not interested in.
     Suppress the printing of module qualification prefixes. This is the
     ``Data.List`` in ``Data.List.length``.
 
+.. ghc-flag:: -dsuppress-timestamps
+    :shortdesc: Suppress timestamps in dumps
+    :type: dynamic
+
+    Suppress the printing of timestamps.
+    This makes it easier to diff dumps.
+
 .. ghc-flag:: -dsuppress-type-signatures
     :shortdesc: Suppress type signatures
     :type: dynamic



More information about the ghc-commits mailing list