1// TEST_CFLAGS -Wno-deprecated-declarations
2
3#include "test.h"
4
5#if __OBJC2__
6
7int main()
8{
9    succeed(__FILE__);
10}
11
12#else
13
14// rdar://4951638
15
16#include <string.h>
17#include <objc/Protocol.h>
18
19char Protocol_name[] __attribute__((section("__OBJC,__class_names"))) = "Protocol";
20
21struct st {
22    void *isa; 
23    const char *protocol_name;
24    void *protocol_list;
25    void *instance_methods;
26    void *class_methods;
27};
28
29struct st Foo_protocol __attribute__((section("__OBJC,__protocol"))) = { Protocol_name, "Foo", 0, 0, 0 };
30
31int 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
41