Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / attributes / method-deprecated-1.m
blob8343856a5c6f1a610997025096744bd863e7d802
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
2 /* { dg-do compile } */
4 #include <objc/objc.h>
6 @interface MyClass
8   Class isa;
9
10 + (int) method;
11 - (int) method;
12 + (int) deprecatedClassMethod __attribute__((deprecated));
13 - (int) deprecatedInstanceMethod __attribute__((deprecated));
14 @end
16 /* Test that deprecation warnings are produced, but not if the
17    receiver is of type 'id'.  */
18 void foo (void)
20   Class c;
21   id object;
22   MyClass *another_object;
24   [c method];
25   [object method];
26   [c deprecatedClassMethod];
27   [object deprecatedInstanceMethod];
29   [object method];
30   [another_object method];
31   [MyClass deprecatedClassMethod];           /* { dg-warning "is deprecated" } */
32   [another_object deprecatedInstanceMethod]; /* { dg-warning "is deprecated" } */