Make the ObjC++ interop test compile

main
David Chisnall 8 years ago
parent 9760ae8d48
commit 1f2d35006b

@ -63,9 +63,12 @@ foreach(TEST_SOURCE ${TESTS})
get_filename_component(TEST ${TEST_SOURCE} NAME_WE)
addtest_flags(${TEST} "-O0 -UNDEBUG" ${TEST_SOURCE})
addtest_flags("${TEST}_optimised" "-O3 -UNDEBUG" ${TEST_SOURCE})
target_compile_definitions(${TEST} PRIVATE SINGLE_FILE_TEST=1)
target_compile_definitions("${TEST}_optimised" PRIVATE SINGLE_FILE_TEST=1)
endforeach()
# Tests that are more than a single file.
addtest_flags(CXXExceptions "-O0" "CXXException.m;CXXException.cc")
addtest_flags(CXXExceptions_optimised "-O3" "CXXException.m;CXXException.cc")
addtest_flags(MinRep "-O0" "minRep1.mm;minRep2.mm;minRep.mm;minRepM.m;ModTest.m;MyException.m")
addtest_flags(CXXExceptions "-O0" "CXXException.m;CXXException.cc;Test.m")
addtest_flags(CXXExceptions_optimised "-O3" "CXXException.m;CXXException.cc;Test.m")
addtest_flags(ObjCXXEHInterop "-O0" "minRep1.mm;minRep2.mm;minRep.mm;minRepM.m;MyException.m;Test.m")
addtest_flags(ObjCXXEHInterop_opttimised "-O3" "minRep1.mm;minRep2.mm;minRep.mm;minRepM.m;MyException.m;Test.m")

@ -1,4 +1,4 @@
#include "ModTest.h"
#include "Test.h"
@interface MyException : Test {
@private

@ -1,21 +1,20 @@
#import "MyException.h"
#include <stdlib.h>
@implementation MyException
- (MyException *)initWithName:(char *)name
reason:(char *)reason
{
if ((self = [super init]) != nil) {
_name = name;
_reason = reason;
}
_name = name;
_reason = reason;
return self;
}
+ (void) raise: (char *)name
format: (char *)reason
{
MyException *e = [[[MyException alloc] initWithName:name
MyException *e = [[[MyException new] initWithName:name
reason:reason] autorelease];
[e raise];
}
@ -28,6 +27,7 @@
if (_reason) {
free(_reason);
}
[super dealloc];
}
- (void) raise {

@ -23,6 +23,11 @@ __attribute__((objc_root_class))
#endif
@end
@interface NSAutoreleasePool : Test
@end
#ifdef SINGLE_FILE_TEST
#if !__has_feature(objc_arc)
@implementation Test
+ (Class)class { return self; }
@ -48,10 +53,7 @@ __attribute__((objc_root_class))
}
- (void)_ARCCompliantRetainRelease {}
@end
#endif
@interface NSAutoreleasePool : Test
@end
@implementation NSAutoreleasePool
- (void)_ARCCompatibleAutoreleasePool {}
+ (void)addObject:(id)anObject
@ -59,3 +61,6 @@ __attribute__((objc_root_class))
objc_autorelease(anObject);
}
@end
#endif
#endif

@ -4,37 +4,7 @@
#undef NDEBUG
#endif
#include <assert.h>
#ifndef __has_attribute
#define __has_attribute(x) 0
#ifndef SINGLE_FILE_TEST
#define SINGLE_FILE_TEST 1
#endif
#if __has_attribute(objc_root_class)
__attribute__((objc_root_class))
#endif
@interface Test { id isa; }
@end
@implementation Test
+ (Class)class { return self; }
+ (id)new
{
return class_createInstance(self, 0);
}
- (void)dealloc
{
object_dispose(self);
}
- (id)autorelease
{
return objc_autorelease(self);
}
- (id)retain
{
return objc_retain(self);
}
- (void)release
{
objc_release(self);
}
- (void)_ARCCompliantRetainRelease {}
@end
#include "Test.h"

@ -1,4 +1,4 @@
#import "ModTest.h"
#import "Test.h"
#import "minRepM.h"

@ -1,4 +1,4 @@
#import "ModTest.h"
#import "Test.h"
#import "minRep2.h"

@ -1,4 +1,4 @@
#import "ModTest.h"
#import "Test.h"
#import "minRep1.h"

@ -1,4 +1,4 @@
#import "ModTest.h"
#import "Test.h"
@interface MinRep2 : Test {
}

@ -1,4 +1,4 @@
#import "ModTest.h"
#import "Test.h"
#import "minRep2.h"
#import "MyException.h"

@ -1,4 +1,4 @@
#import "ModTest.h"
#import "Test.h"
#import "minRep1.h"

@ -1,4 +1,4 @@
#import "ModTest.h"
#import "Test.h"
#import "minRepM.h"
#import "minRep1.h"

Loading…
Cancel
Save