[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: APR_POOL_DEBUG: minor bug

From: Sander Striker <striker_at_apache.org>
Date: 2003-10-30 13:18:09 CET

> From: Julian Foad [mailto:julianfoad@btopenworld.com]
> Sent: Wednesday, October 29, 2003 11:12 PM

> In apr/include/apr_pools.h:
>
> * When no debug level was specified, assume general debug mode.
> * If level 0 was specified, debugging is switched off
> * </pre>
> */
> #if defined(APR_POOL_DEBUG)
> #if (APR_POOL_DEBUG != 0) && (APR_POOL_DEBUG - 0 == 0)
> #undef APR_POOL_DEBUG
> #define APR_POOL_DEBUG 1
> #endif
> #else
> #define APR_POOL_DEBUG 0
> #endif
>
> The second #if is trying to say "if APR_POOL_DEBUG is blank" but it
> doesn't work: if it is blank, then the preprocessor
> complains with "operator '!=' has no left operand" (GCC 3.2).
>
> #if (APR_POOL_DEBUG != 0) && (APR_POOL_DEBUG - 0 == 0)
>
> I think the following is one correct solution:
>
> #if (APR_POOL_DEBUG - APR_POOL_DEBUG - 1) == +1
> /* If APR_POOL_DEBUG is blank, we get +1; if it is a number, we get -1. */

Makes sense. This is really for the dev@apr list, I'll pick it up and apply
it though. Thanks for the patch.

> (Of course there is a simple way to work around the bug: just use
> #define APR_POOL_DEBUG=1
> instead of
> #define APR_POOL_DEBUG
> )

Yes, but this preprocessor magic was put in place so that people could do:

CPPFLAGS=-DAPR_POOL_DEBUG make

without being confronted with the fact that they should have used
-DAPR_POOL_DEBUG=1

Note that the usage of ./configure --enable-pool-debug=... is encouraged.

Sander

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 30 13:18:57 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.