1/* { dg-do compile } */ 2/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ 3 4/* Test deprecate attribute with an @interface declaration. */ 5 6#include <objc/objc.h> 7#include <objc/runtime.h> 8 9__attribute__ ((deprecated)) 10@interface DeprecatedClass 11{ 12 Class isa; 13} 14+ (id) classObject; 15+ (id) new; 16@end 17 18@implementation DeprecatedClass 19+ (id) classObject { return self; } 20+ (id) new { return nil; } 21@end 22 23@interface DeprecatedClass (Category) /* { dg-warning "is deprecated" } */ 24@end 25 26@interface Subclass : DeprecatedClass /* { dg-warning "is deprecated" } */ 27@end 28 29DeprecatedClass *object; /* { dg-warning "is deprecated" } */ 30 31int function (DeprecatedClass *object) /* { dg-warning "is deprecated" } */ 32{ 33 /* Note how the following deprecation warning is generated by 34 "DeprecatedClass *", not by "[DeprecatedClass ...]. */ 35 DeprecatedClass *x = [DeprecatedClass new]; /* { dg-warning "is deprecated" } */ 36 37 if (x == object) 38 return 0; 39 else 40 return 1; 41} 42 43id function2 (void) 44{ 45 return DeprecatedClass.classObject; /* { dg-warning "is deprecated" } */ 46} 47 48@interface NormalClass 49{ 50 Class isa; 51 DeprecatedClass *object; /* { dg-warning "is deprecated" } */ 52} 53- (DeprecatedClass *)method; /* { dg-warning "is deprecated" } */ 54@end 55 56@implementation NormalClass 57- (DeprecatedClass *)method /* { dg-warning "is deprecated" } */ 58{ 59 return nil; 60} 61@end 62