4 #include <objc/objc-exception.h>
5 #include <Foundation/NSObject.h>
7 #if !defined(__OBJC2__)
18 @interface Foo : NSObject @end
19 @interface Bar : NSObject @end
21 @interface Foo (Unimplemented)
25 @implementation Bar @end
29 -(void)check { state++; }
30 +(void)check { testassert(!"caught class object, not instance"); }
34 static void handler(id unused, void *ctx) __attribute__((used));
35 static void handler(id unused __unused, void *ctx __unused)
37 testassert(state == 3); state++;
40 +(BOOL) resolveClassMethod:(SEL)__unused name
42 testassert(state == 1); state++;
43 #if !TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
44 objc_addExceptionHandler(&handler, 0);
45 testassert(state == 2);
47 state++; // handler would have done this
59 #if TARGET_IPHONE_SIMULATOR
60 testwarn("<rdar://problem/7965763> Simulator: cannot throw exceptions across objc_msgSend");
65 // unwind exception and alt handler through objc_msgSend()
70 for (i = 0; i < 100000; i++) {
72 testassert(state == 0); state++;
79 testassert(state == 4); state++;
80 testassert(state == 5); [e check]; // state++
87 testassert(state == 6); state++;
89 testassert(state == 7); state = 0;