CPP "DEBUG" and validate

Simon Marlow marlowsd at gmail.com
Mon Jun 2 04:19:45 EDT 2008


We've been removing most uses of DEBUG from the compiler recently, in 
favour of using Util.debugIsOn.  Also, the ASSERT macros were changed so 
that they actually compile the code of the test in both DEBUG and non-DEBUG 
modes, to avoid needing conditional imports.

The Coding Style commentary does talk about this:

http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle

So this means that we almost never need to do #ifdef DEBUG, and there 
should be no need to add DEBUG to one of the stages of validate, which is a 
good thing because that would slow down validate considerably (I'm guessing 
here, but IIRC as a rule of thumb DEBUG adds ~40% to compilation times).

Cheers,
	Simon

Simon Peyton-Jones wrote:
> Good idea!  I've been caught by this too
> 
> Simon
> 
> | -----Original Message-----
> | From: cvs-ghc-bounces at haskell.org [mailto:cvs-ghc-bounces at haskell.org] On Behalf Of Isaac Dupree
> | Sent: 02 June 2008 02:09
> | To: BuildBot Collator
> | Subject: CPP "DEBUG" and validate
> |
> | This seems to be the most common way that validate is accidentally
> | broken, these days -- not testing with both DEBUG defined and undefined.
> |   Rather than double the testing time, I suggest validate is modified to
> | either:
> |
> | - Compile one of stage1 and stage2 with DEBUG and the other without.
> | - But if you want to compile them both with DEBUG (or both without),
> | then, finish up by compiling a stage3 (or whichever "stage") with the
> | opposite sense of DEBUG, and without any optimizations because you're
> | not going to be using it.
> |
> | These won't catch behavior differences that only testing can catch --
> | but I think most of these errors are just incorrect imports etc., so I'm
> | suggesting something that seems expedient to me.  There are still
> | buildbots to help catch the rest after-the-fact.
> |
> | what do you think?
> |
> | -Isaac
> |
> | _______________________________________________
> | Cvs-ghc mailing list
> | Cvs-ghc at haskell.org
> | http://www.haskell.org/mailman/listinfo/cvs-ghc
> 
> _______________________________________________
> Cvs-ghc mailing list
> Cvs-ghc at haskell.org
> http://www.haskell.org/mailman/listinfo/cvs-ghc



More information about the Cvs-ghc mailing list