2 Purpose: Test anonymous unsigned char argument.
5 Originator: ARM Ltd. */
10 typedef unsigned char T
;
12 static void cls_ret_T_fn(ffi_cif
* cif __UNUSED__
, void* resp
, void** args
,
13 void* userdata __UNUSED__
)
15 *(ffi_arg
*)resp
= *(T
*)args
[0];
17 printf("%d: %d %d\n", (int)(*(ffi_arg
*)resp
), *(T
*)args
[0], *(T
*)args
[1]);
20 typedef T (*cls_ret_T
)(T
, ...);
26 ffi_closure
*pcl
= ffi_closure_alloc(sizeof(ffi_closure
), &code
);
27 ffi_type
* cl_arg_types
[3];
30 cl_arg_types
[0] = &ffi_type_uchar
;
31 cl_arg_types
[1] = &ffi_type_uchar
;
32 cl_arg_types
[2] = NULL
;
34 /* Initialize the cif */
35 CHECK(ffi_prep_cif_var(&cif
, FFI_DEFAULT_ABI
, 1, 2,
36 &ffi_type_uchar
, cl_arg_types
) == FFI_OK
);
38 CHECK(ffi_prep_closure_loc(pcl
, &cif
, cls_ret_T_fn
, NULL
, code
) == FFI_OK
);
39 res
= ((((cls_ret_T
)code
)(67, 4)));
40 /* { dg-output "67: 67 4" } */
41 printf("res: %d\n", res
);
42 /* { dg-output "\nres: 67" } */