@protocol P
- (void)proto_method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2)));
#if defined(WARN_PARTIAL)
#endif
- (void)partial_proto_method __attribute__((availability(macosx,introduced=10.8)));
@end
@interface A <P>
- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); #if defined(WARN_PARTIAL)
#endif
- (void)partialMethod __attribute__((availability(macosx,introduced=10.8)));
- (void)overridden __attribute__((availability(macosx,introduced=10.3))); - (void)overridden2 __attribute__((availability(macosx,introduced=10.3)));
- (void)overridden3 __attribute__((availability(macosx,deprecated=10.3)));
- (void)overridden4 __attribute__((availability(macosx,deprecated=10.3))); - (void)overridden5 __attribute__((availability(macosx,unavailable)));
- (void)overridden6 __attribute__((availability(macosx,introduced=10.3))); - (void)unavailableMethod __attribute__((unavailable));
@end
@interface B : A
- (void)method; - (void)partialMethod; - (void)overridden __attribute__((availability(macosx,introduced=10.4))); - (void)overridden2 __attribute__((availability(macosx,introduced=10.2)));
- (void)overridden3 __attribute__((availability(macosx,deprecated=10.4)));
- (void)overridden4 __attribute__((availability(macosx,deprecated=10.2))); - (void)overridden5 __attribute__((availability(macosx,introduced=10.3)));
- (void)overridden6 __attribute__((availability(macosx,unavailable))); - (void)unavailableMethod; @end
void f(A *a, B *b) {
[a method]; [b method]; [a proto_method]; [b proto_method];
#if defined(WARN_PARTIAL)
#endif
[a partialMethod];
[b partialMethod]; #if defined(WARN_PARTIAL)
#endif
[a partial_proto_method];
#if defined(WARN_PARTIAL)
#endif
[b partial_proto_method];
}
@interface A (NewAPI)
- (void)partialMethod;
- (void)partial_proto_method;
@end
void f_after_redecl(A *a, B *b) {
#ifdef WARN_PARTIAL
#endif
[a partialMethod];
[b partialMethod]; [a partial_proto_method]; [b partial_proto_method]; }
@interface C
- (void) method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); @end
@interface D : C
- (void) method;
@end
@interface E : D
- (void) method;
@end
@implementation D
- (void) method {
[super method]; }
@end
@implementation E
- (void) method {
[super method]; }
@end
@class NSMutableArray;
@interface NSDictionary
+ (instancetype)dictionaryWithObjectsAndKeys:(id)firstObject, ... __attribute__((sentinel(0,1)));
@end
@class NSString;
extern NSString *NSNibTopLevelObjects __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.8,message="" )));
id NSNibOwner, topNibObjects;
@interface AppDelegate (SIEImport)
-(void)__attribute__((ibaction))importFromSIE:(id)sender;
@end
@implementation AppDelegate (SIEImport)
-(void)__attribute__((ibaction))importFromSIE:(id)sender {
NSMutableArray *topNibObjects;
NSDictionary *nibLoadDict = [NSDictionary dictionaryWithObjectsAndKeys:self, NSNibOwner, topNibObjects, NSNibTopLevelObjects, ((void *)0)];
}
@end
@protocol PartialProt
- (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8)));
+ (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8)));
@end
@interface PartialI <PartialProt>
#ifdef WARN_PARTIAL
#endif
- (void)partialMethod __attribute__((availability(macosx,introduced=10.8)));
+ (void)partialMethod __attribute__((availability(macosx,introduced=10.8)));
@end
@interface PartialI ()
- (void)ipartialMethod1 __attribute__((availability(macosx,introduced=10.8)));
#if defined(WARN_PARTIAL)
#endif
- (void)ipartialMethod2 __attribute__((availability(macosx,introduced=10.8)));
+ (void)ipartialMethod1 __attribute__((availability(macosx,introduced=10.8)));
#if defined(WARN_PARTIAL)
#endif
+ (void)ipartialMethod2 __attribute__((availability(macosx,introduced=10.8)));
@end
@interface PartialI (Redecls)
- (void)partialMethod;
- (void)ipartialMethod1;
- (void)ppartialMethod;
+ (void)partialMethod;
+ (void)ipartialMethod1;
+ (void)ppartialMethod;
@end
void partialfun(PartialI* a) {
#ifdef WARN_PARTIAL
#endif
[a partialMethod];
[a ipartialMethod1]; #if defined(WARN_PARTIAL)
#endif
[a ipartialMethod2];
[a ppartialMethod]; #ifdef WARN_PARTIAL
#endif
[PartialI partialMethod];
[PartialI ipartialMethod1]; #if defined(WARN_PARTIAL)
#endif
[PartialI ipartialMethod2];
[PartialI ppartialMethod]; }
#if defined(WARN_PARTIAL)
#endif
__attribute__((availability(macosx, introduced = 10.8))) @interface PartialI2
@end
#if defined(WARN_PARTIAL)
#endif
void partialinter1(PartialI2* p) {
}
@class PartialI2;
#ifdef WARN_PARTIAL
#endif
void partialinter2(PartialI2* p) {
}
#define UNAVAILABLE __attribute__((unavailable("not available")))
typedef enum MyEnum : int MyEnum;
enum MyEnum : int { MyEnum_Blah UNAVAILABLE, } UNAVAILABLE;
void use_myEnum(void) {
MyEnum e = MyEnum_Blah;
}
@protocol AvailabilityP2
@optional
-(void)methodA __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); -(void)methodB __attribute__((unavailable)); -(void)methodC;
@end
void testAvailabilityP2(id<AvailabilityP2> obj) {
[obj methodA]; [obj methodB]; }
@interface ImplementsAvailabilityP2a <AvailabilityP2>
-(void)methodA;
-(void)methodB;
@end
void testImplementsAvailabilityP2a(ImplementsAvailabilityP2a *obj) {
[obj methodA]; [obj methodB]; }
__attribute__((objc_root_class))
@interface ImplementsAvailabilityP2b <AvailabilityP2>
@end
@implementation ImplementsAvailabilityP2b
-(void)methodA {
id<AvailabilityP2> obj = self;
[obj methodA]; [obj methodB]; }
-(void)methodB {
id<AvailabilityP2> obj = self;
[obj methodA]; [obj methodB]; }
@end
void testImplementsAvailabilityP2b(ImplementsAvailabilityP2b *obj) {
[obj methodA]; [obj methodB]; }
__attribute__((objc_root_class))
@interface ImplementsAvailabilityP2c <AvailabilityP2>
-(void)methodA __attribute__((availability(macosx,introduced=10.2)));
-(void)methodB __attribute__((unavailable));
@end
__attribute__((objc_root_class))
@interface ImplementsAvailabilityP2d <AvailabilityP2>
@end
@implementation ImplementsAvailabilityP2d
-(void)methodA __attribute__((availability(macosx,introduced=10.2)))
{
}
-(void)methodB __attribute__((unavailable)) {
}
@end
__attribute__((objc_root_class))
@interface InheritUnavailableSuper
-(void)method __attribute__((unavailable)); @end
@interface InheritUnavailableSub : InheritUnavailableSuper
-(void)method;
@end
@implementation InheritUnavailableSub
-(void)method {
InheritUnavailableSuper *obj = self;
[obj method]; }
@end
#if defined(WARN_PARTIAL)
int fn_10_5(void) __attribute__((availability(macosx, introduced=10.5)));
int fn_10_7(void) __attribute__((availability(macosx, introduced=10.7))); int fn_10_8(void) __attribute__((availability(macosx, introduced=10.8))) { return fn_10_7();
}
__attribute__((objc_root_class))
@interface LookupAvailabilityBase
-(void) method1;
@end
@implementation LookupAvailabilityBase
-(void)method1 { fn_10_7(); } @end
__attribute__((availability(macosx, introduced=10.7)))
@interface LookupAvailability : LookupAvailabilityBase
- (void)method2;
- (void)method3;
- (void)method4 __attribute__((availability(macosx, introduced=10.8)));
@end
@implementation LookupAvailability
-(void)method2 { fn_10_7(); }
-(void)method3 { fn_10_8(); } -(void)method4 { fn_10_8(); }
@end
int old_func(void) __attribute__((availability(macos, introduced=10.4))) {
fn_10_5();
}
#endif