Back to index

python3.2  3.2.2
err_bad_abi.c
Go to the documentation of this file.
00001 /* Area:             ffi_prep_cif, ffi_prep_closure
00002    Purpose:          Test error return for bad ABIs.
00003    Limitations:      none.
00004    PR:               none.
00005    Originator:       Blake Chaffin 6/6/2007       */
00006 
00007 /* { dg-do run { xfail *-*-* } } */
00008 #include "ffitest.h"
00009 
00010 static void
00011 dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, 
00012         void** args __UNUSED__, void* userdata __UNUSED__)
00013 {}
00014 
00015 int main (void)
00016 {
00017        ffi_cif cif;
00018         void *code;
00019        ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
00020        void* args[1];
00021        ffi_type* arg_types[1];
00022 
00023        arg_types[0] = NULL;
00024        args[0] = NULL;
00025 
00026        CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void,
00027               arg_types) == FFI_BAD_ABI);
00028 
00029        CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void,
00030               arg_types) == FFI_OK);
00031 
00032        cif.abi= 255;
00033 
00034        CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI);
00035 
00036        exit(0);
00037 }