Merge from gcc
This commit is contained in:
@@ -9,6 +9,16 @@
|
||||
/* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
|
||||
#include "ffitest.h"
|
||||
|
||||
#if LONG_MAX == 2147483647
|
||||
#define ffi_type_mylong ffi_type_uint32
|
||||
#else
|
||||
#if LONG_MAX == 9223372036854775807
|
||||
#define ffi_type_mylong ffi_type_uint64
|
||||
#else
|
||||
#error "Error, size LONG not defined as expected"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct A {
|
||||
unsigned long a;
|
||||
unsigned char b;
|
||||
@@ -27,15 +37,14 @@ B B_fn(struct A b0, struct B b1)
|
||||
result.x.b = b0.b + b1.x.b + b1.y;
|
||||
result.y = b0.b + b1.x.b;
|
||||
|
||||
printf("%lu %d %lu %d %d: %lu %d %d\n", b0.a, b0.b, b1.x.a, b1.x.b, b1.y,
|
||||
printf("%d %d %d %d %d: %d %d %d\n", b0.a, b0.b, b1.x.a, b1.x.b, b1.y,
|
||||
result.x.a, result.x.b, result.y);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
void* userdata __UNUSED__)
|
||||
B_gn(ffi_cif* cif, void* resp, void** args, void* userdata)
|
||||
{
|
||||
struct A b0;
|
||||
struct B b1;
|
||||
@@ -106,6 +115,7 @@ int main (void)
|
||||
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
|
||||
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
|
||||
|
||||
|
||||
CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
|
||||
|
||||
res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
|
||||
@@ -113,6 +123,5 @@ int main (void)
|
||||
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
|
||||
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
|
||||
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user