2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / libffi / testsuite / libffi.call / err_bad_abi.c
bloba21a3fddd047c9e32cf3bc43940c04716b241648
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 { xfail *-*-* } } */
8 #include "ffitest.h"
10 static void
11 dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__,
12 void** args __UNUSED__, void* userdata __UNUSED__)
15 int main (void)
17 ffi_cif cif;
18 void *code;
19 ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
20 void* args[1];
21 ffi_type* arg_types[1];
23 arg_types[0] = NULL;
24 args[0] = NULL;
26 CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void,
27 arg_types) == FFI_BAD_ABI);
29 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void,
30 arg_types) == FFI_OK);
32 cif.abi= 255;
34 CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI);
36 exit(0);