This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH libffi win64 support


Timothy Wall wrote:
> applied.
> 
> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote:
> 
>> Timothy Wall wrote:
>>> 2009-06-08  Timothy Wall  <twall@users.sf.net>
>>>
>>>     * Makefile.am,
>>>        configure.ac,
>>>        include/ffi.h.in,
>>>        include/ffi_common.h,
>>>        src/closures.c,
>>>        src/dlmalloc.c,
>>>        src/x86/ffi.c,
>>>        src/x86/ffitarget.h,
>>>        src/x86/win64.S (new),
>>>     README: Added win64 support (mingw or MSVC)
>>>        * ltcf-c.sh: properly escape cygwin/w32 path
>>>        * man/ffi_call.3: Clarify size requirements for return value.
>>>        * src/x86/ffi64.c: Fix filename in comment.
>>
>> Please commit this and let me know as soon as you've done so.

I've got a few new test failures.  They're of the form

libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format '%ld' expects type 'long int', but argument 3 has type 'long long int'

It's because of changes like this:

-  printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+  printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);

which prints out a  long long  as an int64.  This is wrong, since
the type is "long long" and the printf format must match the
declaration of the object being printed.

Andrew.


2009-06-12  Andrew Haley  <aph@redhat.com>

	* ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c,
	testsuite/libffi.call/cls_align_uint64.c,
	testsuite/libffi.call/cls_ulonglong.c,
	testsuite/libffi.call/return_ll1.c,
	testsuite/libffi.call/stret_medium2.c: Fix printf format
	specifiers.
	testsuite/libffi.special/unwindtest.cc: include stdint.h

Index: testsuite/libffi.call/cls_align_sint64.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_sint64.c,v
retrieving revision 1.4
diff -u -r1.4 cls_align_sint64.c
--- testsuite/libffi.call/cls_align_sint64.c	11 Jun 2009 14:27:28 -0000	1.4
+++ testsuite/libffi.call/cls_align_sint64.c	12 Jun 2009 14:15:30 -0000
@@ -22,7 +22,7 @@
   result.b = a1.b + a2.b;
   result.c = a1.c + a2.c;

-  printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
+  printf("%d %lld %d %d %lld %d: %d %lld %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);

   return  result;
 }
@@ -77,14 +77,14 @@

   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 %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+  printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */

   CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);

   res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
-  printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+  printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */

   exit(0);
Index: testsuite/libffi.call/cls_align_uint64.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_uint64.c,v
retrieving revision 1.4
diff -u -r1.4 cls_align_uint64.c
--- testsuite/libffi.call/cls_align_uint64.c	11 Jun 2009 14:27:28 -0000	1.4
+++ testsuite/libffi.call/cls_align_uint64.c	12 Jun 2009 14:15:30 -0000
@@ -23,7 +23,7 @@
   result.b = a1.b + a2.b;
   result.c = a1.c + a2.c;

-  printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
+  printf("%d %llu %d %d %llu %d: %d %llu %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);

   return  result;
 }
@@ -78,14 +78,14 @@

   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 %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+  printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */

   CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);

   res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
   /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
-  printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+  printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
   /* { dg-output "\nres: 13 14271 140" } */

   exit(0);
Index: testsuite/libffi.call/cls_ulonglong.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_ulonglong.c,v
retrieving revision 1.4
diff -u -r1.4 cls_ulonglong.c
--- testsuite/libffi.call/cls_ulonglong.c	11 Jun 2009 14:27:28 -0000	1.4
+++ testsuite/libffi.call/cls_ulonglong.c	12 Jun 2009 14:15:30 -0000
@@ -12,7 +12,7 @@
 {
   *(unsigned long long *)resp=  *(unsigned long long *)args[0];

-  printf("%" PRIu64 ": %" PRIu64 "\n",*(unsigned long long *)args[0],
+  printf("%llu: %llu\n",*(unsigned long long *)args[0],
 	 *(unsigned long long *)(resp));
 }
 typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long);
@@ -34,12 +34,12 @@
   CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code)  == FFI_OK);
   res = (*((cls_ret_ulonglong)code))(214LL);
   /* { dg-output "214: 214" } */
-  printf("res: %" PRId64 "\n", res);
+  printf("res: %llu\n", res);
   /* { dg-output "\nres: 214" } */

   res = (*((cls_ret_ulonglong)code))(9223372035854775808LL);
   /* { dg-output "\n9223372035854775808: 9223372035854775808" } */
-  printf("res: %" PRId64 "\n", res);
+  printf("res: %llu\n", res);
   /* { dg-output "\nres: 9223372035854775808" } */

   exit(0);
Index: testsuite/libffi.call/return_ll1.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/return_ll1.c,v
retrieving revision 1.3
diff -u -r1.3 return_ll1.c
--- testsuite/libffi.call/return_ll1.c	11 Jun 2009 14:27:28 -0000	1.3
+++ testsuite/libffi.call/return_ll1.c	12 Jun 2009 14:15:30 -0000
@@ -36,7 +36,7 @@
   ll2 = 11111111;

   ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
-  printf("res: %" PRId64 ", %" PRId64 "\n", rlonglong, ll0 + ll1 + ll2);
+  printf("res: %lld, %lld\n", rlonglong, ll0 + ll1 + ll2);
   /* { dg-output "res: 11111133333222, 11111133333222" } */
   exit(0);
 }
Index: testsuite/libffi.call/stret_medium2.c
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.call/stret_medium2.c,v
retrieving revision 1.3
diff -u -r1.3 stret_medium2.c
--- testsuite/libffi.call/stret_medium2.c	11 Jun 2009 14:27:28 -0000	1.3
+++ testsuite/libffi.call/stret_medium2.c	12 Jun 2009 14:15:30 -0000
@@ -39,7 +39,7 @@
 	result.h = b0.h + b1.h + b2.h + b3.h;
 	result.i = b0.i + b1.i + b2.i + b3.i;

-	printf("%g %g %g %g %g %g %g %g %" PRId64 "\n", result.a, result.b, result.c,
+	printf("%g %g %g %g %g %g %g %g %lld\n", result.a, result.b, result.c,
 		result.d, result.e, result.f, result.g, result.h, result.i);

 	return result;
@@ -107,7 +107,7 @@

 	ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl);
 	/* { dg-output "22 15 17 25 6 13 19 18 16" } */
-	printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c,
+	printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c,
 		res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
 	/* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */

@@ -116,7 +116,7 @@
 	res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte,
 		struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
 	/* { dg-output "\n22 15 17 25 6 13 19 18 16" } */
-	printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c,
+	printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c,
 		res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
 	/* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */

Index: testsuite/libffi.special/unwindtest.cc
===================================================================
RCS file: /cvs/libffi/libffi/testsuite/libffi.special/unwindtest.cc,v
retrieving revision 1.4
diff -u -r1.4 unwindtest.cc
--- testsuite/libffi.special/unwindtest.cc	11 Jun 2009 14:27:28 -0000	1.4
+++ testsuite/libffi.special/unwindtest.cc	12 Jun 2009 14:15:30 -0000
@@ -6,6 +6,7 @@

 /* { dg-do run } */
 #include "ffitestcxx.h"
+#include <stdint.h>

 void
 closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]