Standard scheme for maintainer-only debugging code?

Joe Buck jbuck@synopsys.com
Tue Jun 10 22:32:00 GMT 2003





On Tue, 10 Jun 2003, Nathanael Nerode wrote:
> > How about simply a convention: debugging code should be guarded by
> > 
> > if (debug_XYZ)
> > 
> > and debug_XYZ should be defined, for all XYZ, in some way which makes
> > it a constant 0, optimizable out, unless it's altered by a maintainer.

On Tue, Jun 10, 2003 at 11:13:18PM +0100, Joseph S. Myers wrote:
> Why does this code need to be compiled out?

So that the compiler doesn't get even slower?  Some of these flags might
be tested in inner loops.

> I suggest including the code
> unconditionally, controlled by some command-line option, as with the
> existing debugging RTL dumps. 

Of course, there's a way to achieve both: debug_XYZ could be defined to
any of 0, 1, or flag_debug_XYZ, and there could be a single #ifdef to
make all of the flags variable.



More information about the Gcc mailing list