| 1 |
/* Test for handling of struct-returning methods |
| 2 |
for the Mac OS X ("NeXT") runtime (which uses specialized entry |
| 3 |
points). */ |
| 4 |
/* Contributed by Ziemowit Laski <[email protected]>. */ |
| 5 |
/* { dg-do compile { target *-*-darwin* } } */ |
| 6 |
/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ |
| 7 |
/* { dg-require-effective-target ilp32 } */ |
| 8 |
|
| 9 |
#include "../objc-obj-c++-shared/TestsuiteObject.h" |
| 10 |
|
| 11 |
struct astruct { |
| 12 |
float a, b; |
| 13 |
char c; |
| 14 |
} glob = { 1.0, 2.0, 'a' }; |
| 15 |
|
| 16 |
struct bstruct { |
| 17 |
float a, b, c, d, e, f; |
| 18 |
} globb = { 1, 2, 3, 4, 5, 6 }; |
| 19 |
|
| 20 |
@interface foo : TestsuiteObject |
| 21 |
- (struct astruct) stret; |
| 22 |
- (struct bstruct) stretb; |
| 23 |
@end |
| 24 |
|
| 25 |
@implementation foo : TestsuiteObject |
| 26 |
- (struct astruct) stret { return glob; } |
| 27 |
- (struct bstruct) stretb { return globb; } |
| 28 |
@end |
| 29 |
|
| 30 |
@interface bar: foo |
| 31 |
- (struct astruct) stret; |
| 32 |
- (struct bstruct) stretb; |
| 33 |
@end |
| 34 |
|
| 35 |
@implementation bar |
| 36 |
- (struct astruct) stret { return [super stret]; } |
| 37 |
- (struct bstruct) stretb { return [super stretb]; } |
| 38 |
@end |
| 39 |
|
| 40 |
struct astruct afunc(foo *foo_obj) { |
| 41 |
return [foo_obj stret]; |
| 42 |
} |
| 43 |
|
| 44 |
/* { dg-final { scan-assembler "objc_msgSend_stret" } } */ |
| 45 |
/* { dg-final { scan-assembler "objc_msgSendSuper_stret" } } */ |
| 46 |
|
| 47 |
/* { dg-final { scan-assembler-not "objc_msgSend\[^_S\]" } } */ |
| 48 |
/* { dg-final { scan-assembler-not "objc_msgSendSuper\[^_\]" } } */ |