Add a predefined symbol __NEXT_RUNTIME__ to ObjC

Zack Weinberg zack@codesourcery.com
Mon Aug 26 00:24:00 GMT 2002


On Thu, Aug 15, 2002 at 02:50:06PM -0700, Stan Shebs wrote:
> One of the little peculiarities of GNU Objective-C is that it supports
> two incompatible runtimes, the original "NeXT" runtime, and a later
> workalike called the "GNU" runtime.  The two runtimes actually have
> different user-visible API, and it's been a longstanding wishlist
> item to provide a way for source code to know which is in use.  This
> patch does that by using all the nice new predefine mechy to define a
> __NEXT_RUNTIME__ macro, and includes a sample usage in one of the test
> cases that has been failing on Darwin for some time.
> 
> Since there may be better ideas about how to accomplish this, I'm going
> to let this sit for a day before committing.  (If anybody is wondering,
> I chose __NEXT_RUNTIME__ instead of __GNU_RUNTIME__ because it's the
> exceptional rather than the default situation.)

Though I have no problem with the patch itself, would it not be
sensible to modify both runtimes such that both these functions

> ! #ifdef __NEXT_RUNTIME__
> !   selname = sel_getName (selector);
> ! #else
> !   selname = sel_get_name (selector);
> ! #endif

existed in both?  If they are as functionally equivalent as this patch
implies, it would be a matter of a five-line addition to each, and
would improve code portability.

zw



More information about the Gcc-patches mailing list