This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Standard scheme for maintainer-only debugging code?
- From: Nathanael Nerode <neroden at twcny dot rr dot com>
- To: geoffk at geoffk dot org
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 10 Jun 2003 15:50:38 -0400
- Subject: Re: Standard scheme for maintainer-only debugging code?
>I don't think making this a single header is a good idea; it would
>mean that whenever you changed one debugging flag, the dependencies
>would cause the whole compiler to be rebuilt, which would be annoying.
Excellent point. My macro scheme has essentially the same flaw anyway.
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.
(How should this be done? In C, declaring constants which can easily be
made into variables is an odd process, and I'm not quite sure what the
right magic incantation is. "const static bool debug_XYZ = 0;" ?)
A standard prefix and declaration makes it possible to do a routine
check of the CVS tree to make sure none of them are left turned on by
accident.
I do worry that there are too many different types of things
with the debug_ prefix. I want a unique prefix. Perhaps mdbg_ for
maintainer debug? Or perhaps use the debug_ prefix for this, and stop
using it for some of the other things it's used for? ???
--Nathanael