summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/attributes/method-attribute-2.m
blob: 4a56b3aa8f6f57dad69f9418657f0bdf1be726e6 (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
32
33
/* { dg-do compile } */

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

@interface obj : Object {
@public 
  int var; 
} 
- (int) depmth __attribute__((deprecated)); 
- (int) depmtharg:(int) iarg __attribute__((deprecated)); 
- (int) unusedarg:(int) __attribute__((unused)) uarg ;
- (int) depunusedarg:(int) __attribute__((unused)) uarg __attribute__((deprecated)) ;
@end

@implementation obj
- (int) depmth __attribute__((deprecated)) { return var; }  /* { dg-warning "method attributes can not be specified in @implementation context" } */
- (int) depmtharg:(int) iarg { return var + iarg ; }
- (int) unusedarg:(int) __attribute__((unused)) uarg { return var; }
- (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; }
@end 

int foo (void)
{
  obj *p = [obj new];
  
  [p depmth];		/* { dg-warning "is deprecated" } */
  [p depmtharg:1];	/* { dg-warning "is deprecated" } */
  [p unusedarg:2];	/* { dg-bogus "is deprecated" } */
  [p depunusedarg:3 ];	/* { dg-warning "is deprecated" } */

  return [p depmtharg:0]; /* { dg-warning "is deprecated" } */   
}