OSDN Git Service

implement method attributes.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / attributes / categ-attribute-1.m
1 /* { dg-do compile } */
2
3 #include <objc/objc.h>
4 #include "../../objc-obj-c++-shared/Object1.h"
5
6 @interface obj : Object { 
7 @public 
8   int var; 
9
10 - (int) mth;
11 @end
12
13 @implementation obj
14 - (int) mth {  return var; } 
15 @end
16
17 __attribute ((deprecated)) 
18 @interface obj (dep_categ) 
19 - (int) depmth;/* { dg-warning "category attributes are not available in this version" } */
20 @end
21
22 @implementation obj (dep_categ)
23 - (int) depmth { return var + 1; }
24 @end
25
26 int foo (void)
27 {
28     obj *p = [obj new];  
29     int q = [p depmth];
30     return [p mth];    
31 }