Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / attributes / class-attribute-1.m
blob252932363787d48f46315a374f28d614356cae40
1 /* { dg-do compile } */
3 /* Test deprecate attribute with an @interface declaration.  */
5 #include <objc/objc.h>
6 #include <objc/runtime.h>
8 __attribute__ ((deprecated)) 
9 @interface DeprecatedClass
11   Class isa;
13 + (id) classObject;
14 + (id) new;
15 @end
17 @implementation DeprecatedClass
18 + (id) classObject { return self; }
19 + (id) new { return nil; }
20 @end
22 @interface DeprecatedClass (Category)
23 @end /* { dg-warning "is deprecated" } */
25 @interface Subclass : DeprecatedClass
26 @end /* { dg-warning "is deprecated" } */
28 DeprecatedClass *object; /* { dg-warning "is deprecated" } */
30 int function (DeprecatedClass *object) /* { dg-warning "is deprecated" } */
32   /* Note how the following deprecation warning is generated by
33      "DeprecatedClass *", not by "[DeprecatedClass ...].  */
34   DeprecatedClass *x = [DeprecatedClass new]; /* { dg-warning "is deprecated" } */
36   if (x == object)
37     return 0;
38   else
39     return 1;
42 id function2 (void)
44   return DeprecatedClass.classObject; /* { dg-warning "is deprecated" } */
47 @interface NormalClass
49   Class isa;
50   DeprecatedClass *object; /* { dg-warning "is deprecated" } */
52 - (DeprecatedClass *)method; /* { dg-warning "is deprecated" } */
53 @end
55 @implementation NormalClass
56 - (DeprecatedClass *)method /* { dg-warning "is deprecated" } */
58   return nil;
60 @end