From 71847273007b8346735f6ec34bfcc8750e2c6ecd Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 29 Mar 2008 13:57:55 +0000 Subject: [PATCH] Put debugIsOn in Util, rather than rely on it being CPPed in --- compiler/HsVersions.h | 2 -- compiler/cmm/MkZipCfg.hs | 1 + compiler/cmm/ZipCfgCmmRep.hs | 1 + compiler/utils/Util.lhs | 16 ++++++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h index c8c09e6..034a9bc 100644 --- a/compiler/HsVersions.h +++ b/compiler/HsVersions.h @@ -40,7 +40,6 @@ name = Util.global (value); #define COMMA , #ifdef DEBUG -#define debugIsOn True #define ASSERT(e) if (not (e)) then (assertPanic __FILE__ __LINE__) else #define ASSERT2(e,msg) if (not (e)) then (assertPprPanic __FILE__ __LINE__ (msg)) else #define MASSERT(e) ASSERT(e) return () @@ -49,7 +48,6 @@ name = Util.global (value); #define ASSERTM(mbool) do { bool <- mbool; ASSERT(bool) return () } #define ASSERTM2(mbool,msg) do { bool <- mbool; ASSERT2(bool,msg) return () } #else -#define debugIsOn False -- We have to actually use all the variables we are given or we may get -- unused variable warnings when DEBUG is off. #define ASSERT(e) if False && (not (e)) then panic "ASSERT" else diff --git a/compiler/cmm/MkZipCfg.hs b/compiler/cmm/MkZipCfg.hs index 6019549..484068a 100644 --- a/compiler/cmm/MkZipCfg.hs +++ b/compiler/cmm/MkZipCfg.hs @@ -15,6 +15,7 @@ import Outputable import Unique import UniqFM import UniqSupply +import Util import Prelude hiding (zip, unzip, last) diff --git a/compiler/cmm/ZipCfgCmmRep.hs b/compiler/cmm/ZipCfgCmmRep.hs index 8c1b461..9193a95 100644 --- a/compiler/cmm/ZipCfgCmmRep.hs +++ b/compiler/cmm/ZipCfgCmmRep.hs @@ -28,6 +28,7 @@ import MachOp import qualified ZipDataflow0 as DF import ZipCfg import MkZipCfg +import Util import Maybes import Outputable diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 59f3b47..9537ae1 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -6,6 +6,7 @@ \begin{code} module Util ( + debugIsOn, -- general list processing zipEqual, zipWithEqual, zipWith3Equal, zipWith4Equal, @@ -107,6 +108,21 @@ infixr 9 `thenCmp` %************************************************************************ %* * +\subsection{-DDEBUG} +%* * +%************************************************************************ + +\begin{code} +debugIsOn :: Bool +#ifdef DEBUG +debugIsOn = True +#else +debugIsOn = False +#endif +\end{code} + +%************************************************************************ +%* * \subsection{A for loop} %* * %************************************************************************ -- 1.7.10.4