gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Version Macros


From: Richard Frith-Macdonald
Subject: Re: Version Macros
Date: Wed, 23 Nov 2011 06:28:18 +0000

On 23 Nov 2011, at 00:44, Stefan Bidi wrote:

> I think there's something wrong with the version macros in GSVersionMacros.h. 
>  I'm not sure how it all works, so I've tried writing different cases on 
> paper and never come out with something that seems reasonable.

The comment in the header says :

For MacOS-X compatibility, we define the MacOS-X version constants and we allow 
MAC_OS_X_VERSION_MIN_ALLOWED or MAC_OS_X_VERSION_MAX_ALLOWED instead of 
GS_OPENSTEP_V
Now, that's probably not real 'compatibility' since it most likely doesn't 
match the way those constants are used in OSX ... it simply defines the 
openstep version (GS_OPENSTEP_V) we are targeting to be one or the other.
 
> For example, if I have OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) 
> and MAC_OS_X_VERSION_MIN_ALLOWED = MAC_OS_X_VERSION_10_1, the macro returns 
> false (100100 >= 100000 && 100100 < 999999 -> false), even though it should 
> return true.  The same will happen if MAC_OS_X_VERSION_MAX_ALLOWED is 
> defined, instead.  It's even worst if both are defined because the max 
> allowed won't even be picked up.

The define is ...
#define OS_API_VERSION(ADD,REM) \
  (!defined(GS_OPENSTEP_V) || (GS_OPENSTEP_V >= ADD && GS_OPENSTEP_V < REM))

So your example where GS_OPENSTEP_V is defined as MAC_OS_X_VERSION_MIN_ALLOWED 
reduces to:
(MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_0 && 
MAC_OS_X_VERSION_MIN_ALLOWED < GS_API_LATEST)
Plugging in the numeric values gives us:
(100100 >= 100000 && 100100 < 999999)
Which I agree should be true.
Are you sure GS_OPENSTEP_V  is really being set to MAC_OS_X_VERSION_MIN_ALLOWED 
?  Perhaps something else is already setting it to a different value?
Maybe we have some mistake in setting the version we are targetting?


> There's also an issue in NSStream.h:28 with #if 
> OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST). 
>  Well, the problem here is that OS_API_VERSION and GS_API_VERSION are defined 
> exactly the same in GSVersionMacros.h,
> so if either MAC_OS_X_VERSION_MIN_ALLOWED or MAC_OS_X_VERSION_MAX_ALLOWED are 
> defined NSStream will not be available due to GS_API_VERSION( 
> 10200,GS_API_LATEST).

I think you have misread here ... the two macros are defined differently and do 
different things.  One refers to OpenStep (now OSX) versioning, and the other 
refers to the GNUstep version numbering (intended for people to use to manage 
versioning in their own projects).
100400 refers to OpenStep/OSX 10.4
10200 refers to GNUstep-base 1.2
So there's no problem here.

That being said, I think the GNUstep versioning (GS_API_VERSION)  has almost 
never been used ... so we should probably remove it and just use OS_API_VERSION 
everywhere to simplify the file.
We could probably deprecate it at the next release, and remove it the release 
after.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]