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

Re: svn commit: r1182984 - /subversion/trunk/subversion/tests/libsvn_subr/cache-test.c

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 13 Oct 2011 19:18:50 +0100

Daniel Shahaf <d.s_at_daniel.shahaf.name> writes:

> Philip Martin wrote on Thu, Oct 13, 2011 at 18:44:44 +0100:
>> Daniel Shahaf <d.s_at_daniel.shahaf.name> writes:
>>
>> > First of all, I made the same patch yesterday elsewhere.
>>
>> Another bug :)
>>
>> > Second of all, the use is #if, not #ifdef, so I believe the macro is
>> > always defined (to 0 or 1).
>>
>> The one doesn't follow from the other. In either case the macro could
>> be zero, non-zero, no value or not defined:
>>
>> #if #ifdef
>> #define APR_HAS_THREADS 1 true true
>> #define APR_HAS_THREADS 0 false true
>> #define APR_HAS_THREADS true true
>> <nothing> false false
>>
>
> Is this standard behaviour?

I believe so.

>
>> So not defining APR_HAS_THREADS is a valid way to define no thread
>> support, but it means you can't use APR_HAS_THREADS directly as a
>> variable.
>>
>> It's possible that APR will always ensure that APR_HAS_THREADS is either
>> 0 or 1, but the C language does not.
>>
>
> My reading of
> http://svn.apache.org/repos/asf/apr/apr/tags/0.9.0/include/apr.h.in
> http://svn.apache.org/repos/asf/apr/apr/tags/0.9.0/include/apr.hnw
> http://svn.apache.org/repos/asf/apr/apr/tags/0.9.0/include/apr.hw
> is that APR_HAS_THREADS is always defined.

Then we would be relying on APR to do it. It's not the way all
preprocessor symbols are defined, for example svn_private_config.h
generally uses <nothing> rather than #define XXX 0 and APR does the same
for APR_IS_DEV_VERSION.

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com
Received on 2011-10-13 20:19:26 CEST

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