forked from gnustep/libobjc2
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Protocol2.m
36 lines (33 loc) · 1.07 KB
/
Protocol2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "objc/runtime.h"
#include "protocol.h"
#include "class.h"
#include <stdio.h>
#include <string.h>
@implementation Protocol
// FIXME: This needs removing, but it's included for now because GNUstep's
// implementation of +[NSObject conformsToProtocol:] calls it.
- (BOOL)conformsTo: (Protocol*)p
{
return protocol_conformsToProtocol(self, p);
}
- (id)retain
{
return self;
}
- (void)release {}
+ (Class)class { return self; }
- (id)self { return self; }
@end
@implementation Protocol2 @end
@interface __IncompleteProtocol : Protocol2 @end
@implementation __IncompleteProtocol @end
/**
* This class exists for the sole reason that the legacy GNU ABI did not
* provide a way of registering protocols with the runtime. With the new ABI,
* every protocol in a compilation unit that is not referenced should be added
* in a category on this class. This ensures that the runtime sees every
* protocol at least once and can perform uniquing.
*/
@interface __ObjC_Protocol_Holder_Ugly_Hack { id isa; } @end
@implementation __ObjC_Protocol_Holder_Ugly_Hack @end
@implementation Object @end