]>
Commit | Line | Data |
---|---|---|
26877873 NP |
1 | /* Check if array and function parameters get decayed to pointers as |
2 | they should. */ | |
3 | /* { dg-do run } */ | |
4 | /* { dg-options "-O2" } */ | |
fb9061be | 5 | /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ |
26877873 | 6 | |
88b470b8 | 7 | #include "../objc-obj-c++-shared/TestsuiteObject.m" |
26877873 NP |
8 | #include <string.h> |
9 | #include <stdlib.h> | |
10 | ||
11 | static char global_buf[20]; | |
12 | ||
13 | char *strcpy_like_callee(const char *s) { | |
14 | strcpy(global_buf, s); | |
15 | return global_buf; | |
16 | } | |
17 | ||
18 | typedef char io_string_t[512]; | |
19 | typedef char *(func_type)(const char *); | |
20 | ||
88b470b8 | 21 | @interface DeviceObject: TestsuiteObject |
26877873 NP |
22 | - (void) func:(func_type)func stucPathInIORegistry:(io_string_t)ioRegPath; |
23 | @end | |
24 | @implementation DeviceObject | |
25 | - (void) func:(func_type)func stucPathInIORegistry:(io_string_t)ioRegPath | |
26 | { | |
27 | func(ioRegPath); | |
28 | } | |
29 | @end | |
30 | ||
31 | int main (void) { | |
32 | io_string_t my_string; | |
33 | DeviceObject *obj = [DeviceObject new]; | |
34 | ||
35 | strcpy (my_string, "Hello!"); | |
36 | strcpy (global_buf, "Good-bye!"); | |
37 | ||
38 | [obj func:strcpy_like_callee stucPathInIORegistry:my_string]; | |
39 | ||
40 | if (strcmp (global_buf, "Hello!")) | |
41 | abort (); | |
42 | ||
43 | return 0; | |
44 | } |