Ruby
2.7.6p219 (2022-04-12 revision c9c2245c0a25176072e02db9254f0e0c84c805cd)
ext
fiddle
libffi-3.2.1
testsuite
libffi.call
err_bad_abi.c
Go to the documentation of this file.
1
/* Area: ffi_prep_cif, ffi_prep_closure
2
Purpose: Test error return for bad ABIs.
3
Limitations: none.
4
PR: none.
5
Originator: Blake Chaffin 6/6/2007 */
6
7
/* { dg-do run } */
8
9
#include "
ffitest.h
"
10
11
static
void
12
dummy_fn(ffi_cif* cif
__UNUSED__
,
void
* resp
__UNUSED__
,
13
void
** args
__UNUSED__
,
void
* userdata
__UNUSED__
)
14
{}
15
16
int
main
(
void
)
17
{
18
ffi_cif cif;
19
void
*code;
20
ffi_closure *pcl = ffi_closure_alloc(
sizeof
(ffi_closure), &code);
21
ffi_type* arg_types[1];
22
23
arg_types[0] =
NULL
;
24
25
CHECK
(
ffi_prep_cif
(&cif, 255, 0, &
ffi_type_void
,
26
arg_types) == FFI_BAD_ABI);
27
28
CHECK
(
ffi_prep_cif
(&cif,
FFI_DEFAULT_ABI
, 0, &
ffi_type_void
,
29
arg_types) == FFI_OK);
30
31
cif.abi= 255;
32
33
CHECK
(
ffi_prep_closure_loc
(pcl, &cif, dummy_fn,
NULL
, code) == FFI_BAD_ABI);
34
35
exit
(0);
36
}
ffi_prep_closure_loc
ffi_status ffi_prep_closure_loc(ffi_closure *closure, ffi_cif *cif, void(*fun)(ffi_cif *, void *, void **, void *), void *user_data, void *codeloc)
Definition:
ffi.c:928
FFI_DEFAULT_ABI
@ FFI_DEFAULT_ABI
Definition:
ffitarget.h:38
CHECK
#define CHECK(sub)
Definition:
compile.c:448
main
int main(void)
Definition:
err_bad_abi.c:16
ffitest.h
__UNUSED__
#define __UNUSED__
Definition:
ffitest.h:28
ffi_prep_cif
ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, ffi_type *rtype, ffi_type **atypes)
Definition:
prep_cif.c:226
NULL
#define NULL
Definition:
rb_mjit_min_header-2.7.6.h:11172
exit
void exit(int __status) __attribute__((__noreturn__))
ffi_type_void
const ffi_type ffi_type_void
Definition:
types.c:63
Generated by
1.9.2