diff options
author | Alan Modra <amodra@gmail.com> | 2013-11-16 06:38:55 -0500 |
---|---|---|
committer | Anthony Green <green@moxielogic.com> | 2013-11-16 06:38:55 -0500 |
commit | 164283f4ac5972ce2ab5e015cc2ab1014c23276c (patch) | |
tree | e968a1edbdaa647a62faca51cf59df455b52285b /testsuite | |
parent | 31257b3189f81a199bc2902c22bc5f2d7c54ccde (diff) | |
download | libffi-164283f4ac5972ce2ab5e015cc2ab1014c23276c.tar.gz |
The powerpc64 support opted to pass floating point values both in the
fpr area and the parameter save area, necessary when the backend
doesn't know if a function argument corresponds to the ellipsis
arguments of a variadic function. This patch adds powerpc support for
variadic functions, and changes the code to only pass fp in the ABI
mandated area. ELFv2 needs this change since the parameter save area
may not exist there.
This also fixes two faulty tests that used a non-variadic function
cast to call a variadic function, and spuriously reasoned that this is
somehow necessary for static functions..
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/libffi.call/cls_double_va.c | 10 | ||||
-rw-r--r-- | testsuite/libffi.call/cls_longdouble_va.c | 11 |
2 files changed, 8 insertions, 13 deletions
diff --git a/testsuite/libffi.call/cls_double_va.c b/testsuite/libffi.call/cls_double_va.c index 43167b6..e077f92 100644 --- a/testsuite/libffi.call/cls_double_va.c +++ b/testsuite/libffi.call/cls_double_va.c @@ -38,7 +38,7 @@ int main (void) /* This printf call is variadic */ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, - arg_types) == FFI_OK); + arg_types) == FFI_OK); args[0] = &format; args[1] = &doubleArg; @@ -49,12 +49,10 @@ int main (void) printf("res: %d\n", (int) res); /* { dg-output "\nres: 4" } */ - /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, + code) == FFI_OK); - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); - - res = ((int(*)(char*, double))(code))(format, doubleArg); + res = ((int(*)(char*, ...))(code))(format, doubleArg); /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); /* { dg-output "\nres: 4" } */ diff --git a/testsuite/libffi.call/cls_longdouble_va.c b/testsuite/libffi.call/cls_longdouble_va.c index 7126b13..39b438b 100644 --- a/testsuite/libffi.call/cls_longdouble_va.c +++ b/testsuite/libffi.call/cls_longdouble_va.c @@ -38,7 +38,7 @@ int main (void) /* This printf call is variadic */ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, - arg_types) == FFI_OK); + arg_types) == FFI_OK); args[0] = &format; args[1] = &ldArg; @@ -49,13 +49,10 @@ int main (void) printf("res: %d\n", (int) res); /* { dg-output "\nres: 4" } */ - /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, - arg_types) == FFI_OK); + 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); - - res = ((int(*)(char*, long double))(code))(format, ldArg); + res = ((int(*)(char*, ...))(code))(format, ldArg); /* { dg-output "\n7.0" } */ printf("res: %d\n", (int) res); /* { dg-output "\nres: 4" } */ |