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

Re: [RFC] Preprocessor flags to target code to a specific API version

From: Dani Church <dchurch_at_cheri.shyou.org>
Date: Sat, 25 Sep 2010 21:07:13 -0400 (EDT)

On Fri, 24 Sep 2010, Greg Stein wrote:

> That would be a pretty big patch. I see almost 400 deprecated
> functions in our headers. Each of those would need to be touched.
>
> I'm not against the concept in general, but would like to see how all
> those DEPRECATED macros would turn out, concretely.

You're certainly right, it is a big patch-- updating all of the
SVN_DEPRECATED macros is around a 100KB patch. I went through and updated
them all based on the @deprecated tag version, and for the functions that
were deprecated by a similarly-named one (like svn_client_info =>
svn_client_info2) or that were related to a deprecated type (like
svn_client_commit_item_create => svn_client_commit_item3_create) I also
checked it against the version where the newer function or type was
actually introduced, and updated the doc comment where there was a
mismatch. It's still possible that some functions got the wrong
SVN_DEPRECATED tag, but that's hardly the end of the world; it just means
that sometimes the compiler won't spit out the right deprecation warnings
if you've set SVN_TARGET_API.

I also looked into the other idea I mentioned, tuning the API to give
errors when you use a function or a type that was introduced in a later
API than the one you're targeting. I used ctags and a whole bunch of text
processing to determine which functions, types, defines, and members were
introduced in which API version, and put
#if SVN_TARGET_API >= x ... #endif blocks around all of them. I can't say
that the notation was absolutely perfect, but there is this: gcc will
compile all of the headers without error using any SVN_TARGET_API from 0
to 7, and using 7 (or omitting it entirely) produces a set of preprocessed
headers that are identical to the originals, so at the very least anyone
not using API targeting won't be affected by the changes. The patch for
this is a lot bigger, about 500KB.

I may have gone a bit overboard.

Anyway, I have a couple patches here if anyone wants to look at them, but
they're probably a bit large to attach to an email. What should I do with
them?

-Dani Church
Received on 2010-09-26 03:07:56 CEST

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