summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/attributes/method-deprecated-1.m
blob: 8343856a5c6f1a610997025096744bd863e7d802 (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
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
/* { dg-do compile } */

#include <objc/objc.h>

@interface MyClass
{
  Class isa;
} 
+ (int) method;
- (int) method;
+ (int) deprecatedClassMethod __attribute__((deprecated));
- (int) deprecatedInstanceMethod __attribute__((deprecated));
@end

/* Test that deprecation warnings are produced, but not if the
   receiver is of type 'id'.  */
void foo (void)
{
  Class c;
  id object;
  MyClass *another_object;

  [c method];
  [object method];
  [c deprecatedClassMethod];
  [object deprecatedInstanceMethod];

  [object method];
  [another_object method];
  [MyClass deprecatedClassMethod];           /* { dg-warning "is deprecated" } */
  [another_object deprecatedInstanceMethod]; /* { dg-warning "is deprecated" } */ 
}