clean up tests for win64 use
This commit is contained in:
@@ -1,3 +1,20 @@
|
||||
2008-12-22 Timothy Wall <twall@users.sf.net>
|
||||
|
||||
* testsuite/libffi.call/closure_fn0.c,
|
||||
testsuite/libffi.call/closure_fn1.c,
|
||||
testsuite/libffi.call/closure_fn2.c,
|
||||
testsuite/libffi.call/closure_fn3.c,
|
||||
testsuite/libffi.call/closure_fn4.c,
|
||||
testsuite/libffi.call/closure_fn5.c,
|
||||
testsuite/libffi.call/closure_fn6.c,
|
||||
testsuite/libffi.call/closure_loc_fn0.c,
|
||||
testsuite/libffi.call/closure_stdcall.c,
|
||||
testsuite/libffi.call/cls_align_pointer.c,
|
||||
testsuite/libffi.call/cls_pointer.c,
|
||||
testsuite/libffi.call/cls_pointer_stack.c: use portable cast from
|
||||
pointer to integer (intptr_t).
|
||||
* testsuite/libffi.call/cls_longdouble.c: disable for win64.
|
||||
|
||||
2008-12-19 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.8.
|
||||
|
||||
@@ -25,7 +25,7 @@ closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(double *)args[8]) + (int)*(int *)args[9] +
|
||||
(int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
|
||||
(int)*(int *)args[12] + (int)(*(int *)args[13]) +
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(unsigned long long *)args[0], (int)(*(int *)args[1]),
|
||||
@@ -37,7 +37,7 @@ closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
|
||||
(int)*(int *)args[12], (int)(*(int *)args[13]),
|
||||
(int)(*(int *)args[14]),*(int *)args[15],
|
||||
(int)(long)userdata, (int)*(ffi_arg *)resp);
|
||||
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ static void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(double*)args[8]) + (int)*(int *)args[9] +
|
||||
(int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
|
||||
(int)*(int *)args[12] + (int)(*(int *)args[13]) +
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(float *)args[0], (int)(*(float *)args[1]),
|
||||
@@ -32,7 +32,7 @@ static void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
|
||||
(int)*(int *)args[12], (int)(*(int *)args[13]),
|
||||
(int)(*(int *)args[14]), *(int *)args[15],
|
||||
(int)(long)userdata, (int)*(ffi_arg *)resp);
|
||||
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
||||
}
|
||||
|
||||
typedef int (*closure_test_type1)(float, float, float, float, signed short,
|
||||
|
||||
@@ -20,7 +20,7 @@ static void closure_test_fn2(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(double *)args[8]) + (int)*(int *)args[9] +
|
||||
(int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
|
||||
(int)*(int *)args[12] + (int)(*(float *)args[13]) +
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(double *)args[0], (int)(*(double *)args[1]),
|
||||
@@ -30,7 +30,7 @@ static void closure_test_fn2(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(double*)args[8]), (int)*(int *)args[9],
|
||||
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
|
||||
(int)*(int *)args[12], (int)(*(float *)args[13]),
|
||||
(int)(*(int *)args[14]), *(int *)args[15], (int)(long)userdata,
|
||||
(int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata,
|
||||
(int)*(ffi_arg *)resp);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ static void closure_test_fn3(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(double *)args[8]) + (int)*(int *)args[9] +
|
||||
(int)(*(float *)args[10]) + (int)(*(float *)args[11]) +
|
||||
(int)*(int *)args[12] + (int)(*(float *)args[13]) +
|
||||
(int)(*(float *)args[14]) + *(int *)args[15] + (int)(long)userdata;
|
||||
(int)(*(float *)args[14]) + *(int *)args[15] + (intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(float *)args[0], (int)(*(float *)args[1]),
|
||||
@@ -30,7 +30,7 @@ static void closure_test_fn3(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(double *)args[8]), (int)*(int *)args[9],
|
||||
(int)(*(float *)args[10]), (int)(*(float *)args[11]),
|
||||
(int)*(int *)args[12], (int)(*(float *)args[13]),
|
||||
(int)(*(float *)args[14]), *(int *)args[15], (int)(long)userdata,
|
||||
(int)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata,
|
||||
(int)*(ffi_arg *)resp);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)*(unsigned long long *)args[12] +
|
||||
(int)*(unsigned long long *)args[13] +
|
||||
(int)*(unsigned long long *)args[14] +
|
||||
*(int *)args[15] + (int)(long)userdata;
|
||||
*(int *)args[15] + (intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(unsigned long long *)args[0],
|
||||
@@ -44,7 +44,7 @@ closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)*(unsigned long long *)args[13],
|
||||
(int)*(unsigned long long *)args[14],
|
||||
*(int *)args[15],
|
||||
(int)(long)userdata, (int)*(ffi_arg *)resp);
|
||||
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ closure_test_fn5(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)*(unsigned long long *)args[12] +
|
||||
(int)*(unsigned long long *)args[13] +
|
||||
(int)*(unsigned long long *)args[14] +
|
||||
*(int *)args[15] + (int)(long)userdata;
|
||||
*(int *)args[15] + (intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(unsigned long long *)args[0],
|
||||
@@ -43,7 +43,7 @@ closure_test_fn5(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)*(unsigned long long *)args[13],
|
||||
(int)*(unsigned long long *)args[14],
|
||||
*(int *)args[15],
|
||||
(int)(long)userdata, (int)*(ffi_arg *)resp);
|
||||
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
|
||||
(int)*(int *)args[12] + (int)(*(int *)args[13]) +
|
||||
(int)(*(double *)args[14]) + (int)*(double *)args[15] +
|
||||
(int)(long)userdata;
|
||||
(intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(unsigned long long *)args[0],
|
||||
@@ -36,7 +36,7 @@ closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
|
||||
(int)*(int *)args[12], (int)(*(int *)args[13]),
|
||||
(int)(*(double *)args[14]), (int)(*(double *)args[15]),
|
||||
(int)(long)userdata, (int)*(ffi_arg *)resp);
|
||||
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ closure_loc_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(double *)args[8]) + (int)*(int *)args[9] +
|
||||
(int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
|
||||
(int)*(int *)args[12] + (int)(*(int *)args[13]) +
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
|
||||
(int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
|
||||
(int)*(unsigned long long *)args[0], (int)(*(int *)args[1]),
|
||||
@@ -37,7 +37,7 @@ closure_loc_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
|
||||
(int)*(int *)args[12], (int)(*(int *)args[13]),
|
||||
(int)(*(int *)args[14]),*(int *)args[15],
|
||||
(int)(long)userdata, (int)*(ffi_arg *)resp);
|
||||
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
||||
*(ffi_arg*)resp =
|
||||
(int)*(int *)args[0] + (int)(*(int *)args[1])
|
||||
+ (int)(*(int *)args[2]) + (int)(*(int *)args[3])
|
||||
+ (int)(long)userdata;
|
||||
+ (int)(intptr_t)userdata;
|
||||
|
||||
printf("%d %d %d %d: %d\n",
|
||||
(int)*(int *)args[0], (int)(*(int *)args[1]),
|
||||
|
||||
@@ -19,11 +19,13 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
|
||||
struct cls_struct_align result;
|
||||
|
||||
result.a = a1.a + a2.a;
|
||||
result.b = (void *)((unsigned long)a1.b + (unsigned long)a2.b);
|
||||
result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b);
|
||||
result.c = a1.c + a2.c;
|
||||
|
||||
printf("%d %lu %d %d %lu %d: %d %lu %d\n", a1.a, (unsigned long)a1.b, a1.c,
|
||||
a2.a, (unsigned long)a2.b, a2.c, result.a, (unsigned long)result.b,
|
||||
printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n",
|
||||
a1.a, (uintptr_t)a1.b, a1.c,
|
||||
a2.a, (uintptr_t)a2.b, a2.c,
|
||||
result.a, (uintptr_t)result.b,
|
||||
result.c);
|
||||
|
||||
return result;
|
||||
@@ -87,14 +89,14 @@ int main (void)
|
||||
|
||||
ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl);
|
||||
/* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
|
||||
printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c);
|
||||
printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
|
||||
/* { dg-output "\nres: 13 14271 140" } */
|
||||
|
||||
CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
|
||||
|
||||
res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
|
||||
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
|
||||
printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c);
|
||||
printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
|
||||
/* { dg-output "\nres: 13 14271 140" } */
|
||||
|
||||
exit(0);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
PR: none.
|
||||
Originator: Blake Chaffin */
|
||||
|
||||
/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
|
||||
/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw x86_64-*-cygwin } } */
|
||||
/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
|
||||
|
||||
#include "ffitest.h"
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
void* cls_pointer_fn(void* a1, void* a2)
|
||||
{
|
||||
void* result = (void*)((long)a1 + (long)a2);
|
||||
void* result = (void*)((intptr_t)a1 + (intptr_t)a2);
|
||||
|
||||
printf("0x%08x 0x%08x: 0x%08x\n",
|
||||
(unsigned int) a1, (unsigned int) a2, (unsigned int) result);
|
||||
(unsigned int)(uintptr_t) a1,
|
||||
(unsigned int)(uintptr_t) a2,
|
||||
(unsigned int)(uintptr_t) result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -20,43 +20,48 @@ long dummy_func(
|
||||
|
||||
void* cls_pointer_fn2(void* a1, void* a2)
|
||||
{
|
||||
long double trample1 = (long)a1 + (long)a2;
|
||||
long double trample1 = (intptr_t)a1 + (intptr_t)a2;
|
||||
char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0];
|
||||
long double trample3 = (long)trample1 + (long)a1;
|
||||
long double trample3 = (intptr_t)trample1 + (intptr_t)a1;
|
||||
char trample4 = trample2 + ((char*)&a1)[1];
|
||||
long double trample5 = (long)trample3 + (long)a2;
|
||||
long double trample5 = (intptr_t)trample3 + (intptr_t)a2;
|
||||
char trample6 = trample4 + ((char*)&a2)[1];
|
||||
long double trample7 = (long)trample5 + (long)trample1;
|
||||
long double trample7 = (intptr_t)trample5 + (intptr_t)trample1;
|
||||
char trample8 = trample6 + trample2;
|
||||
|
||||
dummyVar = dummy_func(trample1, trample2, trample3, trample4,
|
||||
trample5, trample6, trample7, trample8);
|
||||
|
||||
void* result = (void*)((long)a1 + (long)a2);
|
||||
void* result = (void*)((intptr_t)a1 + (intptr_t)a2);
|
||||
|
||||
printf("0x%08x 0x%08x: 0x%08x\n",
|
||||
(unsigned int) a1, (unsigned int) a2, (unsigned int) result);
|
||||
(unsigned int)(uintptr_t) a1,
|
||||
(unsigned int)(uintptr_t) a2,
|
||||
(unsigned int)(uintptr_t) result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void* cls_pointer_fn1(void* a1, void* a2)
|
||||
{
|
||||
long double trample1 = (long)a1 + (long)a2;
|
||||
long double trample1 = (intptr_t)a1 + (intptr_t)a2;
|
||||
char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0];
|
||||
long double trample3 = (long)trample1 + (long)a1;
|
||||
long double trample3 = (intptr_t)trample1 + (intptr_t)a1;
|
||||
char trample4 = trample2 + ((char*)&a1)[1];
|
||||
long double trample5 = (long)trample3 + (long)a2;
|
||||
long double trample5 = (intptr_t)trample3 + (intptr_t)a2;
|
||||
char trample6 = trample4 + ((char*)&a2)[1];
|
||||
long double trample7 = (long)trample5 + (long)trample1;
|
||||
long double trample7 = (intptr_t)trample5 + (intptr_t)trample1;
|
||||
char trample8 = trample6 + trample2;
|
||||
|
||||
dummyVar = dummy_func(trample1, trample2, trample3, trample4,
|
||||
trample5, trample6, trample7, trample8);
|
||||
|
||||
void* result = (void*)((long)a1 + (long)a2);
|
||||
void* result = (void*)((intptr_t)a1 + (intptr_t)a2);
|
||||
|
||||
printf("0x%08x 0x%08x: 0x%08x\n", a1, a2, result);
|
||||
printf("0x%08x 0x%08x: 0x%08x\n",
|
||||
(unsigned int)(intptr_t) a1,
|
||||
(unsigned int)(intptr_t) a2,
|
||||
(unsigned int)(intptr_t) result);
|
||||
|
||||
result = cls_pointer_fn2(result, a1);
|
||||
|
||||
@@ -70,13 +75,13 @@ cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp,
|
||||
void* a1 = *(void**)(args[0]);
|
||||
void* a2 = *(void**)(args[1]);
|
||||
|
||||
long double trample1 = (long)a1 + (long)a2;
|
||||
long double trample1 = (intptr_t)a1 + (intptr_t)a2;
|
||||
char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0];
|
||||
long double trample3 = (long)trample1 + (long)a1;
|
||||
long double trample3 = (intptr_t)trample1 + (intptr_t)a1;
|
||||
char trample4 = trample2 + ((char*)&a1)[1];
|
||||
long double trample5 = (long)trample3 + (long)a2;
|
||||
long double trample5 = (intptr_t)trample3 + (intptr_t)a2;
|
||||
char trample6 = trample4 + ((char*)&a2)[1];
|
||||
long double trample7 = (long)trample5 + (long)trample1;
|
||||
long double trample7 = (intptr_t)trample5 + (intptr_t)trample1;
|
||||
char trample8 = trample6 + trample2;
|
||||
|
||||
dummyVar = dummy_func(trample1, trample2, trample3, trample4,
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <ffi.h>
|
||||
#include "fficonfig.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user