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

Re: sqlite3.c won't compile with -std=c89

From: Branko Čibej <brane_at_wandisco.com>
Date: Mon, 25 Mar 2013 05:42:47 +0100

On 24.03.2013 20:59, Mattias Engdegård wrote:
> Unfortunately I missed a second compilation of sqlite3.c, in
> wc-queries-test.c. Here's an updated patch. Sorry about not getting it
> right the first time.
>
> [[[
> Work around a problem on older OS X systems: sqlite3.c includes
> <libkern/OSAtomic.h>, which uses 'inline' and thus cannot be compiled
> with -std=c89 that we are using for all files.
>
> * subversion/libsvn_subr/sqlite3wrapper.c
> (toplevel): Define 'inline' as '__inline__' (which gcc accepts even
> in c89
> mode) during a pre-emptive inclusion of <libkern/OSAtomic.h>.
> * subversion/tests/libsvn_wc/wc-queries-test.c
> (toplevel): Likewise.
> ]]]

I'm not too happy with this patch because the hack is not restricted to
only those versions of OS X that actually need it. It's not needed, to
my knowledge, at least since 10.6; the latest version of that header
uses __inline rather than inline, which apparently all recent Apple
compilers support (and, AFAIK, gcc has supported since before OS X existed).

I'd suggest to wrap this in something like:

#ifdef __APPLE__
#include <Availability.h>
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < MAC_OS_X_VERSION_10_?
...
#endif
#endif

And of course use the correct value of MAC_OS_VERSION_10_something.

-- Brane

-- 
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com
Received on 2013-03-25 05:43:26 CET

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