Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/class-attribute-1.mm

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