From: Simon Marlow Date: Tue, 3 Jun 2008 08:29:24 +0000 (+0000) Subject: New flag: -dno-debug-output X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=667ef993b225a3a7d1163612f5ded7e5b69b4ad3 New flag: -dno-debug-output From the docs: Suppress any unsolicited debugging output. When GHC has been built with the DEBUG option it occasionally emits debug output of interest to developers. The extra output can confuse the testing framework and cause bogus test failures, so this flag is provided to turn it off. --- diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 5425ace..dbf5ff9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -152,6 +152,7 @@ data DynFlag | Opt_D_dump_view_pattern_commoning | Opt_D_faststring_stats | Opt_DumpToFile -- ^ Append dump output to files instead of stdout. + | Opt_D_no_debug_output | Opt_DoCoreLinting | Opt_DoStgLinting | Opt_DoCmmLinting diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 538fe33..6fa6032 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -21,6 +21,7 @@ module StaticFlags ( opt_PprUserLength, opt_SuppressUniques, opt_PprStyle_Debug, + opt_NoDebugOutput, -- profiling opts opt_AutoSccsOnAllToplevs, @@ -166,6 +167,7 @@ static_flags = [ , ( "dsuppress-uniques", PassFlag addOpt ) , ( "dppr-user-length", AnySuffix addOpt ) , ( "dopt-fuel", AnySuffix addOpt ) + , ( "dno-debug-output", PassFlag addOpt ) -- rest of the debugging flags are dynamic --------- Profiling -------------------------------------------------- @@ -289,6 +291,9 @@ opt_PprUserLength :: Int opt_PprUserLength = lookup_def_int "-dppr-user-length" 5 --ToDo: give this a name opt_Fuel :: Int opt_Fuel = lookup_def_int "-dopt-fuel" maxBound +opt_NoDebugOutput :: Bool +opt_NoDebugOutput = lookUp (fsLit "-dno-debug-output") + -- profiling opts opt_AutoSccsOnAllToplevs :: Bool diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs index b5d451a..61ad4dd 100644 --- a/compiler/utils/Outputable.lhs +++ b/compiler/utils/Outputable.lhs @@ -53,7 +53,7 @@ module Outputable ( import {-# SOURCE #-} Module( Module, ModuleName, moduleName ) import {-# SOURCE #-} OccName( OccName ) -import StaticFlags ( opt_PprStyle_Debug, opt_PprUserLength ) +import StaticFlags import FastString import FastTypes import qualified Pretty @@ -622,7 +622,9 @@ pprPanic = pprAndThen panic -- Throw an exn saying "bug in GHC" pprPgmError = pprAndThen pgmError -- Throw an exn saying "bug in pgm being compiled" -- (used for unusual pgm errors) -pprTrace = pprAndThen trace +pprTrace str doc x + | opt_NoDebugOutput = x + | otherwise = pprAndThen trace str doc x pprPanicFastInt :: String -> SDoc -> FastInt pprPanicFastInt heading pretty_msg = panicFastInt (show (doc PprDebug)) @@ -644,6 +646,7 @@ assertPprPanic file line msg msg] warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a +warnPprTrace _ _file _line _msg x | opt_NoDebugOutput = x warnPprTrace False _file _line _msg x = x warnPprTrace True file line msg x = trace (show (doc PprDebug)) x diff --git a/docs/users_guide/debugging.xml b/docs/users_guide/debugging.xml index 638ab7a..e00cd8f 100644 --- a/docs/users_guide/debugging.xml +++ b/docs/users_guide/debugging.xml @@ -435,14 +435,18 @@ - - - + + + - - Have the renamer report what imports does not - contribute. - + + Suppress any unsolicited debugging output. When GHC + has been built with the DEBUG option it + occasionally emits debug output of interest to developers. + The extra output can confuse the testing framework and + cause bogus test failures, so this flag is provided to + turn it off. + diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 7de1ae8..9b1e272 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -2214,6 +2214,12 @@ - + + Suppress unsolicited debugging output + static + - + + Turn on debug printing (more verbose) static