Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / objc.dg / attributes / class-attribute-1.m
blob3444760bc3d32db7e82545473dbb78e7a6561c8e
1 /* { dg-do compile } */
3 /* Test deprecate attribute with an @interface declaration.  */
5 #include <objc/objc.h>
7 __attribute__ ((deprecated)) 
8 @interface DeprecatedClass
10   Class isa;
12 + (id) classObject;
13 + (id) new;
14 @end
16 @implementation DeprecatedClass
17 + (id) classObject { return self; }
18 + (id) new { return nil; }
19 @end
21 @interface DeprecatedClass (Category)
22 @end /* { dg-warning "is deprecated" } */
24 @interface Subclass : DeprecatedClass
25 @end /* { dg-warning "is deprecated" } */
27 DeprecatedClass *object; /* { dg-warning "is deprecated" } */
29 int function (DeprecatedClass *object) /* { dg-warning "is deprecated" } */
31   /* Note how the following deprecation warning is generated by
32      "DeprecatedClass *", not by "[DeprecatedClass ...].  */
33   DeprecatedClass *x = [DeprecatedClass new]; /* { dg-warning "is deprecated" } */
35   if (x == object)
36     return 0;
37   else
38     return 1;
41 id function2 (void)
43   return DeprecatedClass.classObject; /* { dg-warning "is deprecated" } */
46 @interface NormalClass
48   Class isa;
49   DeprecatedClass *object; /* { dg-warning "is deprecated" } */
51 - (DeprecatedClass *)method; /* { dg-warning "is deprecated" } */
52 @end
54 @implementation NormalClass
55 - (DeprecatedClass *)method /* { dg-warning "is deprecated" } */
57   return nil;
59 @end