summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/fsf-package-0.m
blob: d6b4db21777b38bf39fac90cb06133165b765cc4 (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
34
35
36
37
/* { dg-do compile } */

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

@interface obj : Object
{
@public
  int v1;
@package	/* { dg-warning ".@package. presently has the same effect as .@public." } */
  int v2;
@protected
  int v3;
@private
  int v4;
}
- (int) value;
- (void) setValue: (int)number;
@end

@implementation obj : Object

- (int) value { return v1; }
- (void) setValue: (int)number { v1 = number; }

@end

void foo (void)
{
  obj *a;

  [a setValue:2];
  a->v2 = 1;
  a->v3 = [a value] - a->v2;	/* { dg-warning ".v3. is @protected" } */
  a->v4 = a->v3 - 1;		/* { dg-warning ".v4. is @private" } */
  				/* { dg-warning ".v3. is @protected" "" { target *-*-* } 35 } */
}