libs-base/config/objc-common.g
Niels Grewe 383d5ccec2 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
2012-08-16 12:31:16 +00:00

61 lines
1.1 KiB
Text

/* Common information for all objc runtime tests.
*/
#include <stdlib.h>
#include <objc/objc.h>
#if __GNU_LIBOBJC__
# include <objc/runtime.h>
# include <objc/message.h>
#else
# include <objc/objc-api.h>
#endif
#include <objc/Object.h>
#ifdef __GNUSTEP_RUNTIME__
#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__)
GS_OBJC_ROOT_CLASS @implementation NXConstantString
- (const char*) cString
{
return 0;
}
- (unsigned int) length
{
return 0;
}
@end
#endif
/* Provide dummy implementations for NSObject and NSConstantString
* for libobjc2 which needs them.
*/
GS_OBJC_ROOT_CLASS @interface NSObject
{
id isa;
}
@end
@implementation NSObject
+ (id)new
{
NSObject *obj = calloc(sizeof(id), 1);
obj->isa = self;
return obj;
}
@end
@interface NSConstantString : NSObject
@end
@implementation NSConstantString
@end