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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [testsuite/] [libffi.call/] [strlen2_win32.c] - Blame information for rev 732

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 732 jeremybenn
/* Area:        ffi_call
2
   Purpose:     Check fastcall strlen call on X86_WIN32 systems.
3
   Limitations: none.
4
   PR:          none.
5
   Originator:  From the original ffitest.c  */
6
 
7
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
8
 
9
#include "ffitest.h"
10
 
11
static size_t __attribute__((fastcall)) my_fastcall_strlen(char *s)
12
{
13
  return (strlen(s));
14
}
15
 
16
int d
17
int main (void)
18
{
19
  ffi_cif cif;
20
  ffi_type *args[MAX_ARGS];
21
  void *values[MAX_ARGS];
22
  ffi_arg rint;
23
  char *s;
24
  args[0] = &ffi_type_pointer;
25
  values[0] = (void*) &s;
26
 
27
  /* Initialize the cif */
28
  CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1,
29
                       &ffi_type_sint, args) == FFI_OK);
30
 
31
  s = "a";
32
  ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values);
33
  CHECK(rint == 1);
34
 
35
  s = "1234567";
36
  ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values);
37
  CHECK(rint == 7);
38
 
39
  s = "1234567890123456789012345";
40
  ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values);
41
  CHECK(rint == 25);
42
 
43
  printf("fastcall strlen tests passed\n");
44
  exit(0);
45
}

powered by: WebSVN 2.1.0

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