Commit 3bc462c2 by Andrew Haley Committed by Andrew Haley

cls_align_sint64.c, [...]: Fix printf format specifiers.

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

        * testsuite/libffi.call/cls_align_sint64.c,
        testsuite/libffi.call/cls_align_uint64.c,
        testsuite/libffi.call/cls_longdouble_va.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.call/ffitest.h,
        testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define.

From-SVN: r148521
parent 2b26b801
2009-06-16 Andrew Haley <aph@redhat.com>
* testsuite/libffi.call/cls_align_sint64.c,
testsuite/libffi.call/cls_align_uint64.c,
testsuite/libffi.call/cls_longdouble_va.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.call/ffitest.h,
testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define.
2009-06-15 Andrew Haley <aph@redhat.com> 2009-06-15 Andrew Haley <aph@redhat.com>
* testsuite/libffi.call/err_bad_typedef.c: xfail everywhere. * testsuite/libffi.call/err_bad_typedef.c: xfail everywhere.
......
...@@ -22,7 +22,7 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, ...@@ -22,7 +22,7 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
result.b = a1.b + a2.b; result.b = a1.b + a2.b;
result.c = a1.c + a2.c; result.c = a1.c + a2.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); printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
return result; return result;
} }
...@@ -77,14 +77,14 @@ int main (void) ...@@ -77,14 +77,14 @@ int main (void)
ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl);
/* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */ /* { dg-output "\nres: 13 14271 140" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); 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); 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" } */ /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */ /* { dg-output "\nres: 13 14271 140" } */
exit(0); exit(0);
......
...@@ -23,7 +23,7 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, ...@@ -23,7 +23,7 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
result.b = a1.b + a2.b; result.b = a1.b + a2.b;
result.c = a1.c + a2.c; result.c = a1.c + a2.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); printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
return result; return result;
} }
...@@ -78,14 +78,14 @@ int main (void) ...@@ -78,14 +78,14 @@ int main (void)
ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl);
/* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c); printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */ /* { dg-output "\nres: 13 14271 140" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); 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); 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" } */ /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c); printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */ /* { dg-output "\nres: 13 14271 140" } */
exit(0); exit(0);
......
...@@ -42,9 +42,9 @@ int main (void) ...@@ -42,9 +42,9 @@ int main (void)
args[2] = NULL; args[2] = NULL;
ffi_call(&cif, FFI_FN(printf), &res, args); ffi_call(&cif, FFI_FN(printf), &res, args);
// { dg-output "7.0" { xfail i*86-*-linux-* x86_64-*-linux-* sh*-*-linux-* } } // { dg-output "7.0" { xfail i*86-*-linux-* x86_64-*-linux-* } }
printf("res: %d\n", (int) res); printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" { xfail i*86-*-linux-* x86_64-*-linux-* sh*-*-linux-* } } // { dg-output "\nres: 4" { xfail i*86-*-linux-* x86_64-*-linux-* } }
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
......
...@@ -12,7 +12,7 @@ static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, ...@@ -12,7 +12,7 @@ static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp,
{ {
*(unsigned long long *)resp= *(unsigned long long *)args[0]; *(unsigned long long *)resp= *(unsigned long long *)args[0];
printf("%llu: %llu\n",*(unsigned long long *)args[0], printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0],
*(unsigned long long *)(resp)); *(unsigned long long *)(resp));
} }
typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long);
...@@ -34,12 +34,12 @@ int main (void) ...@@ -34,12 +34,12 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK);
res = (*((cls_ret_ulonglong)code))(214LL); res = (*((cls_ret_ulonglong)code))(214LL);
/* { dg-output "214: 214" } */ /* { dg-output "214: 214" } */
printf("res: %llu\n", res); printf("res: %" PRIdLL "\n", res);
/* { dg-output "\nres: 214" } */ /* { dg-output "\nres: 214" } */
res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); res = (*((cls_ret_ulonglong)code))(9223372035854775808LL);
/* { dg-output "\n9223372035854775808: 9223372035854775808" } */ /* { dg-output "\n9223372035854775808: 9223372035854775808" } */
printf("res: %llu\n", res); printf("res: %" PRIdLL "\n", res);
/* { dg-output "\nres: 9223372035854775808" } */ /* { dg-output "\nres: 9223372035854775808" } */
exit(0); exit(0);
......
...@@ -45,6 +45,15 @@ ...@@ -45,6 +45,15 @@
#endif #endif
/* MinGW kludge. */
#ifdef WIN64
#define PRIdLL "PRId64"
#define PRIuLL "PRIu64"
#else
#define PRIdLL "lld"
#define PRIuLL "llu"
#endif
#ifdef USING_MMAP #ifdef USING_MMAP
static inline void * static inline void *
allocate_mmap (size_t size) allocate_mmap (size_t size)
......
...@@ -36,7 +36,7 @@ int main (void) ...@@ -36,7 +36,7 @@ int main (void)
ll2 = 11111111; ll2 = 11111111;
ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
printf("res: %lld, %lld\n", rlonglong, ll0 + ll1 + ll2); printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2);
/* { dg-output "res: 11111133333222, 11111133333222" } */ /* { dg-output "res: 11111133333222, 11111133333222" } */
exit(0); exit(0);
} }
...@@ -39,7 +39,7 @@ struct_72byte cls_struct_72byte_fn( ...@@ -39,7 +39,7 @@ struct_72byte cls_struct_72byte_fn(
result.h = b0.h + b1.h + b2.h + b3.h; result.h = b0.h + b1.h + b2.h + b3.h;
result.i = b0.i + b1.i + b2.i + b3.i; result.i = b0.i + b1.i + b2.i + b3.i;
printf("%g %g %g %g %g %g %g %g %lld\n", result.a, result.b, result.c, printf("%g %g %g %g %g %g %g %g %" PRIdLL "\n", result.a, result.b, result.c,
result.d, result.e, result.f, result.g, result.h, result.i); result.d, result.e, result.f, result.g, result.h, result.i);
return result; return result;
...@@ -107,7 +107,7 @@ int main (void) ...@@ -107,7 +107,7 @@ int main (void)
ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl);
/* { dg-output "22 15 17 25 6 13 19 18 16" } */ /* { dg-output "22 15 17 25 6 13 19 18 16" } */
printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\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); 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" } */ /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */
...@@ -116,7 +116,7 @@ int main (void) ...@@ -116,7 +116,7 @@ int main (void)
res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte,
struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */
printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\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); 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" } */ /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */
......
...@@ -43,6 +43,16 @@ ...@@ -43,6 +43,16 @@
#endif #endif
/* MinGW kludge. */
#ifdef WIN64
#define PRIdLL "PRId64"
#define PRIuLL "PRIu64"
#else
#define PRIdLL "lld"
#define PRIuLL "llu"
#endif
#ifdef USING_MMAP #ifdef USING_MMAP
static inline void * static inline void *
allocate_mmap (size_t size) allocate_mmap (size_t size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment