File: return_sc.c

package info (click to toggle)
libffi 3.3-6
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 6,124 kB
  • sloc: ansic: 33,504; asm: 12,693; sh: 4,585; exp: 756; makefile: 389; perl: 171; python: 157; cpp: 128
file content (36 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (82)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Area:	ffi_call
   Purpose:	Check return value signed char.
   Limitations:	none.
   PR:		none.
   Originator:	From the original ffitest.c  */

/* { dg-do run } */
#include "ffitest.h"

static signed char return_sc(signed char sc)
{
  return sc;
}
int main (void)
{
  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  ffi_arg rint;
  signed char sc;

  args[0] = &ffi_type_schar;
  values[0] = ≻

  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
		     &ffi_type_schar, args) == FFI_OK);

  for (sc = (signed char) -127;
       sc < (signed char) 127; sc++)
    {
      ffi_call(&cif, FFI_FN(return_sc), &rint, values);
      CHECK((signed char)rint == sc);
    }
  exit(0);
}