| 1 |
/* Contributed by Nicola Pero <[email protected]>, November 2010. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
#include <objc/objc.h> |
| 5 |
|
| 6 |
/* Test that if you have a property declared in a class and a |
| 7 |
category, the attributes match. This is almost the same as |
| 8 |
at-property-16.m, but for a category. It is a separate file |
| 9 |
because it is difficult to test multiple messages for the same |
| 10 |
line. */ |
| 11 |
|
| 12 |
@interface MyRootClass |
| 13 |
{ |
| 14 |
Class isa; |
| 15 |
} |
| 16 |
@property (assign) id a; /* { dg-line MyRootClass_property_a } */ |
| 17 |
@property (retain) id b; /* { dg-line MyRootClass_property_b } */ |
| 18 |
@property int c; /* { dg-line MyRootClass_property_c } */ |
| 19 |
@property (nonatomic) int d; /* { dg-line MyRootClass_property_d } */ |
| 20 |
@property int e; /* { dg-line MyRootClass_property_e } */ |
| 21 |
@property int f; /* { dg-line MyRootClass_property_f } */ |
| 22 |
@property int g; /* { dg-line MyRootClass_property_g } */ |
| 23 |
@property (readonly) int h; |
| 24 |
@property (readonly,getter=getMe) int i; /* { dg-line MyRootClass_property_i } */ |
| 25 |
@property (nonatomic) float j; |
| 26 |
@end |
| 27 |
|
| 28 |
@interface MyRootClass (Category) |
| 29 |
@property (retain) id a; /* { dg-warning "assign semantics attributes of property .a. conflict with previous declaration" } */ |
| 30 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_a } */ |
| 31 |
@property (assign) id b; /* { dg-warning "assign semantics attributes of property .b. conflict with previous declaration" } */ |
| 32 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_b } */ |
| 33 |
@property (nonatomic) int c; /* { dg-warning ".nonatomic. attribute of property .c. conflicts with previous declaration" } */ |
| 34 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_c } */ |
| 35 |
@property int d; /* { dg-warning ".nonatomic. attribute of property .d. conflicts with previous declaration" } */ |
| 36 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_d } */ |
| 37 |
@property (setter=setX:) int e; /* { dg-warning ".setter. attribute of property .e. conflicts with previous declaration" } */ |
| 38 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_e } */ |
| 39 |
@property (getter=x) int f; /* { dg-warning ".getter. attribute of property .f. conflicts with previous declaration" } */ |
| 40 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_f } */ |
| 41 |
@property (readonly) int g; /* { dg-warning ".readonly. attribute of property .g. conflicts with previous declaration" } */ |
| 42 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_g } */ |
| 43 |
@property (readwrite) int h; /* Ok */ |
| 44 |
@property (readonly) int i; /* { dg-warning ".getter. attribute of property .i. conflicts with previous declaration" } */ |
| 45 |
/* { dg-message "originally specified here" "" { target *-*-* } MyRootClass_property_i } */ |
| 46 |
@property (nonatomic) float j; /* Ok */ |
| 47 |
@end |