Commit 667ef993 authored by Simon Marlow's avatar Simon Marlow

New flag: -dno-debug-output

From the docs:
   <para>Suppress any unsolicited debugging output.  When GHC
     has been built with the <literal>DEBUG</literal> 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.</para>
parent b1455fa5
...@@ -152,6 +152,7 @@ data DynFlag ...@@ -152,6 +152,7 @@ data DynFlag
| Opt_D_dump_view_pattern_commoning | Opt_D_dump_view_pattern_commoning
| Opt_D_faststring_stats | Opt_D_faststring_stats
| Opt_DumpToFile -- ^ Append dump output to files instead of stdout. | Opt_DumpToFile -- ^ Append dump output to files instead of stdout.
| Opt_D_no_debug_output
| Opt_DoCoreLinting | Opt_DoCoreLinting
| Opt_DoStgLinting | Opt_DoStgLinting
| Opt_DoCmmLinting | Opt_DoCmmLinting
......
...@@ -21,6 +21,7 @@ module StaticFlags ( ...@@ -21,6 +21,7 @@ module StaticFlags (
opt_PprUserLength, opt_PprUserLength,
opt_SuppressUniques, opt_SuppressUniques,
opt_PprStyle_Debug, opt_PprStyle_Debug,
opt_NoDebugOutput,
-- profiling opts -- profiling opts
opt_AutoSccsOnAllToplevs, opt_AutoSccsOnAllToplevs,
...@@ -166,6 +167,7 @@ static_flags = [ ...@@ -166,6 +167,7 @@ static_flags = [
, ( "dsuppress-uniques", PassFlag addOpt ) , ( "dsuppress-uniques", PassFlag addOpt )
, ( "dppr-user-length", AnySuffix addOpt ) , ( "dppr-user-length", AnySuffix addOpt )
, ( "dopt-fuel", AnySuffix addOpt ) , ( "dopt-fuel", AnySuffix addOpt )
, ( "dno-debug-output", PassFlag addOpt )
-- rest of the debugging flags are dynamic -- rest of the debugging flags are dynamic
--------- Profiling -------------------------------------------------- --------- Profiling --------------------------------------------------
...@@ -289,6 +291,9 @@ opt_PprUserLength :: Int ...@@ -289,6 +291,9 @@ opt_PprUserLength :: Int
opt_PprUserLength = lookup_def_int "-dppr-user-length" 5 --ToDo: give this a name opt_PprUserLength = lookup_def_int "-dppr-user-length" 5 --ToDo: give this a name
opt_Fuel :: Int opt_Fuel :: Int
opt_Fuel = lookup_def_int "-dopt-fuel" maxBound opt_Fuel = lookup_def_int "-dopt-fuel" maxBound
opt_NoDebugOutput :: Bool
opt_NoDebugOutput = lookUp (fsLit "-dno-debug-output")
-- profiling opts -- profiling opts
opt_AutoSccsOnAllToplevs :: Bool opt_AutoSccsOnAllToplevs :: Bool
......
...@@ -53,7 +53,7 @@ module Outputable ( ...@@ -53,7 +53,7 @@ module Outputable (
import {-# SOURCE #-} Module( Module, ModuleName, moduleName ) import {-# SOURCE #-} Module( Module, ModuleName, moduleName )
import {-# SOURCE #-} OccName( OccName ) import {-# SOURCE #-} OccName( OccName )
import StaticFlags ( opt_PprStyle_Debug, opt_PprUserLength ) import StaticFlags
import FastString import FastString
import FastTypes import FastTypes
import qualified Pretty import qualified Pretty
...@@ -622,7 +622,9 @@ pprPanic = pprAndThen panic -- Throw an exn saying "bug in GHC" ...@@ -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" pprPgmError = pprAndThen pgmError -- Throw an exn saying "bug in pgm being compiled"
-- (used for unusual pgm errors) -- (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 :: String -> SDoc -> FastInt
pprPanicFastInt heading pretty_msg = panicFastInt (show (doc PprDebug)) pprPanicFastInt heading pretty_msg = panicFastInt (show (doc PprDebug))
...@@ -644,6 +646,7 @@ assertPprPanic file line msg ...@@ -644,6 +646,7 @@ assertPprPanic file line msg
msg] msg]
warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a
warnPprTrace _ _file _line _msg x | opt_NoDebugOutput = x
warnPprTrace False _file _line _msg x = x warnPprTrace False _file _line _msg x = x
warnPprTrace True file line msg x warnPprTrace True file line msg x
= trace (show (doc PprDebug)) x = trace (show (doc PprDebug)) x
......
...@@ -435,14 +435,18 @@ ...@@ -435,14 +435,18 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>-dshow-unused-imports</option> <option>-dno-debug-output</option>
<indexterm><primary><option>-dshow-unused-imports</option></primary></indexterm> <indexterm><primary><option>-dno-debug-output</option></primary></indexterm>
</term> </term>
<listitem> <listitem>
<para>Have the renamer report what imports does not <para>Suppress any unsolicited debugging output. When GHC
contribute.</para> has been built with the <literal>DEBUG</literal> option it
</listitem> 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.</para>
</listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</sect2> </sect2>
......
...@@ -2213,6 +2213,12 @@ ...@@ -2213,6 +2213,12 @@
<entry>dynamic</entry> <entry>dynamic</entry>
<entry>-</entry> <entry>-</entry>
</row> </row>
<row>
<entry><option>-dno-debug-output</option></entry>
<entry>Suppress unsolicited debugging output</entry>
<entry>static</entry>
<entry>-</entry>
</row>
<row> <row>
<entry><option>-dppr-debug</option></entry> <entry><option>-dppr-debug</option></entry>
<entry>Turn on debug printing (more verbose)</entry> <entry>Turn on debug printing (more verbose)</entry>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment