annotate clang/test/SemaObjC/property-10.m @ 180:680fa57a2f20

fix compile errors.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 30 May 2020 17:44:06 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 // Check property attribute consistency.
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 @interface I0
anatofuz
parents:
diff changeset
6 @property(readonly, readwrite) int p0; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}}
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 @property(retain) int p1; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
anatofuz
parents:
diff changeset
9 @property(strong) int s1; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 @property(copy) int p2; // expected-error {{property with 'copy' attribute must be of object type}}
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 @property(assign, copy) id p3_0; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}}
anatofuz
parents:
diff changeset
14 @property(assign, retain) id p3_1; // expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}}
anatofuz
parents:
diff changeset
15 @property(assign, strong) id s3_1; // expected-error {{property attributes 'assign' and 'strong' are mutually exclusive}}
anatofuz
parents:
diff changeset
16 @property(copy, retain) id p3_2; // expected-error {{property attributes 'copy' and 'retain' are mutually exclusive}}
anatofuz
parents:
diff changeset
17 @property(copy, strong) id s3_2; // expected-error {{property attributes 'copy' and 'strong' are mutually exclusive}}
anatofuz
parents:
diff changeset
18 @property(assign, copy, retain) id p3_3; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}}
anatofuz
parents:
diff changeset
19 @property(assign, copy, strong) id s3_3; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'assign' and 'strong' are mutually exclusive}}
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 @property(unsafe_unretained, copy) id p4_0; // expected-error {{property attributes 'unsafe_unretained' and 'copy' are mutually exclusive}}
anatofuz
parents:
diff changeset
22 @property(unsafe_unretained, retain) id p4_1; // expected-error {{property attributes 'unsafe_unretained' and 'retain' are mutually exclusive}}
anatofuz
parents:
diff changeset
23 @property(unsafe_unretained, strong) id s4_1; // expected-error {{property attributes 'unsafe_unretained' and 'strong' are mutually exclusive}}
anatofuz
parents:
diff changeset
24 @property(unsafe_unretained, copy, retain) id p4_3; // expected-error {{property attributes 'unsafe_unretained' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'unsafe_unretained' and 'retain' are mutually exclusive}}
anatofuz
parents:
diff changeset
25 @property(unsafe_unretained, copy, strong) id s4_3; // expected-error {{property attributes 'unsafe_unretained' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'unsafe_unretained' and 'strong' are mutually exclusive}}
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 @property id p4; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}}, expected-warning {{default property attribute 'assign' not appropriate for object}}
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 @property(nonatomic,copy) int (^includeMailboxCondition)();
anatofuz
parents:
diff changeset
30 @property(nonatomic,copy) int (*includeMailboxCondition2)(); // expected-error {{property with 'copy' attribute must be of object type}}
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 @end
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 @interface I0()
anatofuz
parents:
diff changeset
35 @property (retain) int PROP; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
anatofuz
parents:
diff changeset
36 @property (strong) int SPROP; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
anatofuz
parents:
diff changeset
37 @property(nonatomic,copy) int (*PROP1)(); // expected-error {{property with 'copy' attribute must be of object type}}
anatofuz
parents:
diff changeset
38 @property(nonatomic,weak) int (*PROP2)(); // expected-error {{property with 'weak' attribute must be of object type}}
anatofuz
parents:
diff changeset
39 @end
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 // rdar://10357768
anatofuz
parents:
diff changeset
42 @interface rdar10357768
anatofuz
parents:
diff changeset
43 {
anatofuz
parents:
diff changeset
44 int n1;
anatofuz
parents:
diff changeset
45 }
anatofuz
parents:
diff changeset
46 @property (readonly, setter=crushN1:) int n1; // expected-warning {{setter cannot be specified for a readonly property}}
anatofuz
parents:
diff changeset
47 @end
anatofuz
parents:
diff changeset
48