PR target/84336
[official-gcc.git] / gcc / testsuite / objc.dg / attributes / method-attribute-2.m
blob90369cc66c0169430953edc871065872d7bc4130
1 /* { dg-do compile } */
3 #include <objc/objc.h>
4 #include "../../objc-obj-c++-shared/TestsuiteObject.h"
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
16 @implementation obj
17 - (int) depmth __attribute__((deprecated)) { return var; }  /* { dg-warning "method attributes can not 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 
23 int foo (void)
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" } */
32   return [p depmtharg:0]; /* { dg-warning "is deprecated" } */