Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm

raw
1 /* { dg-do compile } */
2
3 #include <objc/objc.h>
4 #include "../../objc-obj-c++-shared/TestsuiteObject.h"
5
6 @interface obj : TestsuiteObject {
7 @public
8 int var;
9 }
10 - (int) depmth __attribute__((deprecated));
11 - (int) depmtharg:(int) iarg __attribute__((deprecated));
12 - (int) unusedarg:(int) __attribute__((unused)) uarg ;
13 - (int) depunusedarg:(int) __attribute__((unused)) uarg __attribute__((deprecated)) ;
14 @end
15
16 @implementation obj
17 - (int) depmth __attribute__((deprecated)) { return var; } /* { dg-warning "method attributes cannot be specified in @implementation context" } */
18 - (int) depmtharg:(int) iarg { return var + iarg ; }
19 - (int) unusedarg:(int) __attribute__((unused)) uarg { return var; }
20 - (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; }
21 @end
22
23 int foo (void)
24 {
25 obj *p = [obj new];
26
27 [p depmth]; /* { dg-warning "is deprecated" } */
28 [p depmtharg:1]; /* { dg-warning "is deprecated" } */
29 [p unusedarg:2]; /* { dg-bogus "is deprecated" } */
30 [p depunusedarg:3 ]; /* { dg-warning "is deprecated" } */
31
32 return [p depmtharg:0]; /* { dg-warning "is deprecated" } */
33 }