2018-01-10 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libffi / testsuite / libffi.call / err_bad_abi.c
blobf5a73179ec96a345cc3f9f6199c54cdcb33941c0
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 */
7 /* { dg-do run } */
9 #include "ffitest.h"
11 static void
12 dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__,
13 void** args __UNUSED__, void* userdata __UNUSED__)
16 int main (void)
18 ffi_cif cif;
19 void *code;
20 ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
21 ffi_type* arg_types[1];
23 arg_types[0] = NULL;
25 CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void,
26 arg_types) == FFI_BAD_ABI);
28 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void,
29 arg_types) == FFI_OK);
31 cif.abi= 255;
33 CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI);
35 exit(0);