summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm
blob: f02149e3332722083b386c0dc6d59f807f7e4a19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* { dg-do compile } */

#include <objc/objc.h>
#include "../../objc-obj-c++-shared/Object1.h"

@interface obj : Object {
@public 
  int var; 
} 
- (int) depmtharg:(int) iarg __attribute__((deprecated)); /* { dg-warning "method attributes are not available in this version" } */
- (int) unusedarg:(int) __attribute__((unused)) uarg ; /* { dg-warning "method parameter attributes are not available in this version" } */
- (int) depunusedarg:(int) __attribute__((unused)) uarg __attribute__((deprecated)) ; /* { dg-warning "method attributes are not available in this version" } */
				/* { dg-warning "method parameter attributes are not available in this version" "" { target *-*-* } 12 } */
@end

@implementation obj
- (int) depmtharg:(int) iarg { return var + iarg ; };
- (int) unusedarg:(int) __attribute__((unused)) uarg { return var; } ; /* { dg-warning "method parameter attributes are not available in this version" } */
- (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; }; /* { dg-warning "method parameter attributes are not available in this version" } */
@end 

int foo (void)
{
  obj *p = [obj new];
  
  [p depmtharg:1];
  [p unusedarg:2];
  [p depunusedarg:3 ];

  return [p depmtharg:0];    
}