mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 09:31:07 +00:00
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:
parent
218132903e
commit
d10498bd01
11 changed files with 10549 additions and 7607 deletions
18
ChangeLog
18
ChangeLog
|
@ -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>
|
2012-08-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSScanner.m: Fix error in comment
|
* Source/NSScanner.m: Fix error in comment
|
||||||
|
|
|
@ -283,7 +283,7 @@ extern "C" {
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface NSObject <NSObject>
|
GS_ROOT_CLASS @interface NSObject <NSObject>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Points to instance's class. Used by runtime to access method
|
* Points to instance's class. Used by runtime to access method
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface NSProxy <NSObject>
|
GS_ROOT_CLASS @interface NSProxy <NSObject>
|
||||||
{
|
{
|
||||||
@public
|
@public
|
||||||
Class isa;
|
Class isa;
|
||||||
|
|
|
@ -227,6 +227,7 @@ typedef struct {
|
||||||
#define GS_USE_MDNS @HAVE_MDNS@
|
#define GS_USE_MDNS @HAVE_MDNS@
|
||||||
#define GS_USE_ICU @HAVE_ICU@
|
#define GS_USE_ICU @HAVE_ICU@
|
||||||
#define GS_USE_LIBDISPATCH @HAVE_LIBDISPATCH@
|
#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__) || defined(_WIN32) || defined(__MS_WIN32__)
|
||||||
# if !defined(__WIN32__)
|
# if !defined(__WIN32__)
|
||||||
|
|
|
@ -342,4 +342,16 @@ static inline void gs_consumed(id NS_CONSUMED __attribute__ ((unused))o) { retur
|
||||||
#endif
|
#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_ */
|
#endif /* __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ */
|
||||||
|
|
|
@ -388,6 +388,9 @@
|
||||||
/* Define to 1 if you have the <objc/objc.h> header file. */
|
/* Define to 1 if you have the <objc/objc.h> header file. */
|
||||||
#undef HAVE_OBJC_OBJC_H
|
#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. */
|
/* Define to 1 if you have the <objc/runtime.h> header file. */
|
||||||
#undef HAVE_OBJC_RUNTIME_H
|
#undef HAVE_OBJC_RUNTIME_H
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ enum proxyLocation
|
||||||
* instance, we will get a pre-existing one, so we don't want to go
|
* 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.
|
* allocating the memory for a new instance unless absolutely necessary.
|
||||||
*/
|
*/
|
||||||
@interface GSDistantObjectPlaceHolder
|
GS_ROOT_CLASS @interface GSDistantObjectPlaceHolder
|
||||||
+ (id) initWithCoder: (NSCoder*)aCoder;
|
+ (id) initWithCoder: (NSCoder*)aCoder;
|
||||||
+ (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection;
|
+ (id) initWithLocal: (id)anObject connection: (NSConnection*)aConnection;
|
||||||
+ (id) initWithTarget: (unsigned)target connection: (NSConnection*)aConnection;
|
+ (id) initWithTarget: (unsigned)target connection: (NSConnection*)aConnection;
|
||||||
|
|
|
@ -108,7 +108,7 @@ static Class NSConstantStringClass;
|
||||||
@class NSDataMalloc;
|
@class NSDataMalloc;
|
||||||
@class NSMutableDataMalloc;
|
@class NSMutableDataMalloc;
|
||||||
|
|
||||||
@interface NSZombie
|
GS_ROOT_CLASS @interface NSZombie
|
||||||
{
|
{
|
||||||
Class isa;
|
Class isa;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,17 @@
|
||||||
#include <objc/hooks.h>
|
#include <objc/hooks.h>
|
||||||
#endif
|
#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
|
/* Provide an implementation of NXConstantString for an old libobjc when
|
||||||
built stand-alone without an NXConstantString implementation. */
|
built stand-alone without an NXConstantString implementation. */
|
||||||
#if !defined(NeXT_RUNTIME) && !defined(__GNUSTEP_RUNTIME__)
|
#if !defined(NeXT_RUNTIME) && !defined(__GNUSTEP_RUNTIME__)
|
||||||
@implementation NXConstantString
|
GS_OBJC_ROOT_CLASS @implementation NXConstantString
|
||||||
- (const char*) cString
|
- (const char*) cString
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -34,7 +41,7 @@
|
||||||
/* Provide dummy implementations for NSObject and NSConstantString
|
/* Provide dummy implementations for NSObject and NSConstantString
|
||||||
* for libobjc2 which needs them.
|
* for libobjc2 which needs them.
|
||||||
*/
|
*/
|
||||||
@interface NSObject
|
GS_OBJC_ROOT_CLASS @interface NSObject
|
||||||
{
|
{
|
||||||
id isa;
|
id isa;
|
||||||
}
|
}
|
||||||
|
|
20
configure.ac
20
configure.ac
|
@ -1669,6 +1669,26 @@ AC_CHECK_LIB(rt, sched_yield)
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
AC_CHECK_FUNCS(nanosleep usleep Sleep)
|
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
|
# Check whether Objective-C /really/ works
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue