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 { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ 8#include "ffitest.h" 9 10static void 11dummy_fn(ffi_cif* cif, void* resp, void** args, void* userdata) 12{} 13 14int main (void) 15{ 16 ffi_cif cif; 17#ifndef USING_MMAP 18 static ffi_closure cl; 19#endif 20 ffi_closure *pcl; 21 void* args[1]; 22 ffi_type* arg_types[1]; 23 24#ifdef USING_MMAP 25 pcl = allocate_mmap (sizeof(ffi_closure)); 26#else 27 pcl = &cl; 28#endif 29 30 arg_types[0] = NULL; 31 args[0] = NULL; 32 33 CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, 34 arg_types) == FFI_BAD_ABI); 35 36 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, 37 arg_types) == FFI_OK); 38 39 cif.abi= 255; 40 41 CHECK(ffi_prep_closure(pcl, &cif, dummy_fn, NULL) == FFI_BAD_ABI); 42 43 exit(0); 44} 45