Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm

raw
1 /* Contributed by Nicola Pero <[email protected]>, October 2010. */
2 /* { dg-do compile } */
3 /* { dg-additional-options "-Wno-objc-root-class" } */
4
5 #include <objc/objc.h>
6
7 @interface MyClass
8 {
9 Class isa;
10 }
11 + (int) method;
12 - (int) method;
13 + (int) deprecatedClassMethod __attribute__((deprecated));
14 - (int) deprecatedInstanceMethod __attribute__((deprecated));
15 @end
16
17 /* Test that deprecation warnings are produced, but not if the
18 receiver is of type 'id'. */
19 void foo (void)
20 {
21 Class c;
22 id object;
23 MyClass *another_object;
24
25 [c method];
26 [object method];
27 [c deprecatedClassMethod];
28 [object deprecatedInstanceMethod];
29
30 [object method];
31 [another_object method];
32 [MyClass deprecatedClassMethod]; /* { dg-warning "is deprecated" } */
33 [another_object deprecatedInstanceMethod]; /* { dg-warning "is deprecated" } */
34 }