]> git.saurik.com Git - apple/objc4.git/blob - test/protocol_cw.m
objc4-551.1.tar.gz
[apple/objc4.git] / test / protocol_cw.m
1 // TEST_CFLAGS -Wno-deprecated-declarations
2
3 #include "test.h"
4
5 #if __OBJC2__
6
7 int main()
8 {
9 succeed(__FILE__);
10 }
11
12 #else
13
14 // rdar://4951638
15
16 #include <string.h>
17 #include <objc/Protocol.h>
18
19 char Protocol_name[] __attribute__((section("__OBJC,__class_names"))) = "Protocol";
20
21 struct st {
22 void *isa;
23 const char *protocol_name;
24 void *protocol_list;
25 void *instance_methods;
26 void *class_methods;
27 };
28
29 struct st Foo_protocol __attribute__((section("__OBJC,__protocol"))) = { Protocol_name, "Foo", 0, 0, 0 };
30
31 int main()
32 {
33 Protocol *foo = objc_getProtocol("Foo");
34
35 testassert(foo == (Protocol *)&Foo_protocol);
36 testassert(0 == strcmp("Foo", [foo name]));
37 succeed(__FILE__);
38 }
39
40 #endif