From: simonpj@microsoft.com Date: Fri, 16 Nov 2007 15:24:46 +0000 (+0000) Subject: Add DEBUG-only flag -dsuppress-uniques to suppress printing of uniques X-Git-Tag: 2008-05-28~1088 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=9226af9eef1cc45dd745ce21ddeb36a0be0da708 Add DEBUG-only flag -dsuppress-uniques to suppress printing of uniques This is intended only for debugging use: it makes it easier to compare two variants without the variations between uniques mattering. (Of course, you can't actually feed the output to the C compiler or assembler and expect anything sensible to happen!) --- diff --git a/compiler/basicTypes/Unique.lhs b/compiler/basicTypes/Unique.lhs index 1926f5c..5f9f668 100644 --- a/compiler/basicTypes/Unique.lhs +++ b/compiler/basicTypes/Unique.lhs @@ -57,6 +57,7 @@ module Unique ( #include "HsVersions.h" +import StaticFlags import BasicTypes import FastString import Outputable @@ -197,6 +198,11 @@ We do sometimes make strings with @Uniques@ in them: \begin{code} pprUnique :: Unique -> SDoc pprUnique uniq +#ifdef DEBUG + | opt_SuppressUniques + = empty -- Used exclusively to suppress uniques so you + | otherwise -- can compare output easily +#endif = case unpkUnique uniq of (tag, u) -> finish_ppr tag u (text (iToBase62 u)) diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 43f630c..039051b 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -26,6 +26,7 @@ module StaticFlags ( -- Output style options opt_PprUserLength, + opt_SuppressUniques, opt_PprStyle_Debug, -- profiling opts @@ -169,8 +170,9 @@ static_flags = [ -- ToDo: user ways ------ Debugging ---------------------------------------------------- - , ( "dppr-debug", PassFlag addOpt ) - , ( "dppr-user-length", AnySuffix addOpt ) + , ( "dppr-debug", PassFlag addOpt ) + , ( "dsuppress-uniques", PassFlag addOpt ) + , ( "dppr-user-length", AnySuffix addOpt ) -- rest of the debugging flags are dynamic --------- Profiling -------------------------------------------------- @@ -282,6 +284,7 @@ unpacked_opts = opt_IgnoreDotGhci = lookUp FSLIT("-ignore-dot-ghci") -- debugging opts +opt_SuppressUniques = lookUp FSLIT("-dsuppress-uniques") opt_PprStyle_Debug = lookUp FSLIT("-dppr-debug") opt_PprUserLength = lookup_def_int "-dppr-user-length" 5 --ToDo: give this a name