Changes to support clang's __attribute__((objc_root_class)).

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35412 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
thebeing 2012-08-16 12:31:16 +00:00
parent 218132903e
commit d10498bd01
11 changed files with 10549 additions and 7607 deletions

View file

@ -1,3 +1,21 @@
2012-08-16 Niels Grewe <niels.grewe@halbordnung.de>
* configure.ac: Check for objc_root_class attribute
* configure: Regenerate
* config/objc-common.g: Annotate root classes.
* Headers/GNUstepBase/config.h.in: Regenerate
* Headers/GNUstepBase/GSConfig.h.in: Add macro for root class
attribute availability.
* Headers/GNUstepBase/GSVersionMacros.h: Define GS_ROOT_CLASS
depending on whether the compiler supports it.
* Headers/Foundation/NSObject.h: Mark NSObject as a root class.
* Headers/Foundation/NSProxy.h: Mark NSProxy as a root class.
* Source/NSDistantObject: Mark GSDistantObjectPlaceholder as a
root class.
* Source/NSObject.m: Mark NSZombie as a root class.
Changes to support clang's __attribute__((objc_root_class)).
2012-08-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSScanner.m: Fix error in comment

View file

@ -283,7 +283,7 @@ extern "C" {
@end
@interface NSObject <NSObject>
GS_ROOT_CLASS @interface NSObject <NSObject>
{
/**
* Points to instance's class. Used by runtime to access method

View file

@ -32,7 +32,7 @@
extern "C" {
#endif
@interface NSProxy <NSObject>
GS_ROOT_CLASS @interface NSProxy <NSObject>
{
@public
Class isa;

View file

@ -227,6 +227,7 @@ typedef struct {
#define GS_USE_MDNS @HAVE_MDNS@
#define GS_USE_ICU @HAVE_ICU@
#define GS_USE_LIBDISPATCH @HAVE_LIBDISPATCH@
#define GS_HAVE_OBJC_ROOT_CLASS_ATTR @GS_HAVE_OBJC_ROOT_CLASS_ATTR@
#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__)
# if !defined(__WIN32__)

View file

@ -342,4 +342,16 @@ static inline void gs_consumed(id NS_CONSUMED __attribute__ ((unused))o) { retur
#endif
/*
* Attribute definition for root classes, annotates the interface declaration of
* the class.
*/
#ifndef GS_ROOT_CLASS
# if GS_HAVE_OBJC_ROOT_CLASS_ATTR || __has_feature(attribute_objc_root_class)
# define GS_ROOT_CLASS __attribute__((objc_root_class))
# else
# define GS_ROOT_CLASS
# endif
#endif
#endif /* __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ */

View file

@ -388,6 +388,9 @@
/* Define to 1 if you have the <objc/objc.h> header file. */
#undef HAVE_OBJC_OBJC_H
/* Says whether the objc_root_class attribute works */
#undef HAVE_OBJC_ROOT_CLASS_ATTRIBUTE
/* Define to 1 if you have the <objc/runtime.h> header file. */
#undef HAVE_OBJC_RUNTIME_H

View file

@ -129,7 +129,7 @@ enum proxyLocation
* instance, we will get a pre-existing one, so we don't want to go
* allocating the memory for a new instance unless absolutely necessary.
*/
@interface GSDistantObjectPlaceHolder
GS_ROOT_CLASS @interface GSDistantObjectPlaceHolder
+ (id) initWithCoder: (NSCoder*)aCoder;
+ (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection;
+ (id) initWithTarget: (unsigned)target connection: (NSConnection*)aConnection;

View file

@ -108,7 +108,7 @@ static Class NSConstantStringClass;
@class NSDataMalloc;
@class NSMutableDataMalloc;
@interface NSZombie
GS_ROOT_CLASS @interface NSZombie
{
Class isa;
}

View file

@ -16,10 +16,17 @@
#include <objc/hooks.h>
#endif
#if HAVE_OBJC_ROOT_CLASS_ATTRIBUTE
#define GS_OBJC_ROOT_CLASS __attribute__((objc_root_class))
#else
#define GS_OBJC_ROOT_CLASS
#endif
/* Provide an implementation of NXConstantString for an old libobjc when
built stand-alone without an NXConstantString implementation. */
#if !defined(NeXT_RUNTIME) && !defined(__GNUSTEP_RUNTIME__)
@implementation NXConstantString
GS_OBJC_ROOT_CLASS @implementation NXConstantString
- (const char*) cString
{
return 0;
@ -34,7 +41,7 @@
/* Provide dummy implementations for NSObject and NSConstantString
* for libobjc2 which needs them.
*/
@interface NSObject
GS_OBJC_ROOT_CLASS @interface NSObject
{
id isa;
}

17783
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -1669,6 +1669,26 @@ AC_CHECK_LIB(rt, sched_yield)
#--------------------------------------------------------------------
AC_CHECK_FUNCS(nanosleep usleep Sleep)
AC_MSG_CHECKING(for objc_root_class attribute support)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror $OBJCFLAGS -x objective-c"
AC_COMPILE_IFELSE([
__attribute__((objc_root_class)) @interface RootObject
@end
@implementation RootObject
@end],
AC_MSG_RESULT([found])
gs_objc_root_class_attr=1,
AC_MSG_RESULT([not present])
gs_objc_root_class_attr=0
)
GS_HAVE_OBJC_ROOT_CLASS_ATTR=$gs_objc_root_class_attr
AC_SUBST(GS_HAVE_OBJC_ROOT_CLASS_ATTR)
AC_DEFINE_UNQUOTED(HAVE_OBJC_ROOT_CLASS_ATTRIBUTE,$gs_objc_root_class_attr,
[Says whether the objc_root_class attribute works])
CFLAGS=$saved_CFLAGS
#--------------------------------------------------------------------
# Check whether Objective-C /really/ works
#--------------------------------------------------------------------