OSDN Git Service

PR libffi/46661
[pf3gnuchains/gcc-fork.git] / libffi / testsuite / libffi.call / cls_4_1byte.c
index c4970ce..f3806d7 100644 (file)
@@ -6,7 +6,7 @@
    PR:         none.
    Originator: <andreast@gcc.gnu.org> 20030902  */
 
-/* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
+/* { dg-do run } */
 #include "ffitest.h"
 
 typedef struct cls_struct_4_1byte {
@@ -34,7 +34,8 @@ cls_struct_4_1byte cls_struct_4_1byte_fn(struct cls_struct_4_1byte a1,
 }
 
 static void
-cls_struct_4_1byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata)
+cls_struct_4_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+                     void* userdata __UNUSED__)
 {
 
   struct cls_struct_4_1byte a1, a2;
@@ -48,21 +49,13 @@ cls_struct_4_1byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata)
 int main (void)
 {
   ffi_cif cif;
-#ifndef USING_MMAP
-  static ffi_closure cl;
-#endif
-  ffi_closure *pcl;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
   void* args_dbl[5];
   ffi_type* cls_struct_fields[5];
   ffi_type cls_struct_type;
   ffi_type* dbl_arg_types[5];
 
-#ifdef USING_MMAP
-  pcl = allocate_mmap (sizeof(ffi_closure));
-#else
-  pcl = &cl;
-#endif
-
   cls_struct_type.size = 0;
   cls_struct_type.alignment = 0;
   cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -94,9 +87,9 @@ int main (void)
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 190 192 194 196" } */
 
-  CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4_1byte_gn, NULL) == FFI_OK);
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK);
 
-  res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(pcl))(g_dbl, f_dbl);
+  res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */
   printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
   /* { dg-output "\nres: 190 192 194 196" } */