OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [method-23.mm] - Blame information for rev 750

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Check if array and function parameters get decayed to pointers as
2
   they should.  */
3
/* { dg-do run } */
4
/* { dg-options "-O2" } */
5
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6
 
7
#include "../objc-obj-c++-shared/TestsuiteObject.m"
8
#include 
9
#include 
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
 
21
@interface DeviceObject: TestsuiteObject
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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.