Files
cpython-source-deps/testsuite/libffi.call/many_complex.inc
Dominik Vogt 6e8a446083 2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com>
* src/types.c (FFI_TYPEDEF, FFI_NONCONST_TYPEDEF): Merge the macros by
	adding another argument that controls whether the result is const or not
	(FFI_LDBL_CONST): Temporary macro to reduce ifdef confusion
	* src/prep_cif.c (ffi_prep_cif_core): Replace list of systems with new
	macro FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
	* src/pa/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
	Define.
	* src/s390/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
	Define.
	* src/x86/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
	Define.

2014-07-22  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* doc/libffi.texi (Primitive Types): Document ffi_type_complex_float,
	ffi_type_complex_double and ffi_type_complex_longdouble
	(Complex Types): New subsection.
	(Complex Type Example): Ditto.
	* testsuite/libffi.call/cls_align_complex_double.c: New
	FFI_TYPE_COMPLEX test.
	* testsuite/libffi.call/cls_align_complex_float.c: Ditto.
	* testsuite/libffi.call/cls_align_complex_longdouble.c: Ditto.
	* testsuite/libffi.call/cls_complex_double.c: Ditto.
	* testsuite/libffi.call/cls_complex_float.c: Ditto.
	* testsuite/libffi.call/cls_complex_longdouble.c: Ditto.
	* testsuite/libffi.call/cls_complex_struct_double.c: Ditto.
	* testsuite/libffi.call/cls_complex_struct_float.c: Ditto.
	* testsuite/libffi.call/cls_complex_struct_longdouble.c: Ditto.
	* testsuite/libffi.call/cls_complex_va_double.c: Ditto.
	* testsuite/libffi.call/cls_complex_va_float.c: Ditto.
	* testsuite/libffi.call/cls_complex_va_longdouble.c: Ditto.
	* testsuite/libffi.call/complex_double.c: Ditto.
	* testsuite/libffi.call/complex_defs_double.c: Ditto.
	* testsuite/libffi.call/complex_float.c: Ditto.
	* testsuite/libffi.call/complex_defs_float.c: Ditto.
	* testsuite/libffi.call/complex_longdouble.c: Ditto.
	* testsuite/libffi.call/complex_defs_longdouble.c: Ditto.
	* testsuite/libffi.call/complex_int.c: Ditto.
	* testsuite/libffi.call/many_complex_double.c: Ditto.
	* testsuite/libffi.call/many_complex_float.c: Ditto.
	* testsuite/libffi.call/many_complex_longdouble.c: Ditto.
	* testsuite/libffi.call/return_complex1_double.c: Ditto.
	* testsuite/libffi.call/return_complex1_float.c: Ditto.
	* testsuite/libffi.call/return_complex1_longdouble.c: Ditto.
	* testsuite/libffi.call/return_complex2_double.c: Ditto.
	* testsuite/libffi.call/return_complex2_float.c: Ditto.
	* testsuite/libffi.call/return_complex2_longdouble.c: Ditto.
	* testsuite/libffi.call/return_complex_double.c: Ditto.
	* testsuite/libffi.call/return_complex_float.c: Ditto.
	* testsuite/libffi.call/return_complex_longdouble.c: Ditto.
	* src/raw_api.c (ffi_raw_to_ptrarray): Handle FFI_TYPE_COMPLEX
	(ffi_ptrarray_to_raw): Ditto.
	* src/prep_cif.c (ffi_prep_cif_core): Abort if FFI_TYPE_COMPLEX is not
	implemented in libffi for the target.
	* src/java_raw_api.c (ffi_java_raw_size): FFI_TYPE_COMPLEX not supported
	yet (abort).
	(ffi_java_raw_to_ptrarray): Ditto.
	(ffi_java_rvalue_to_raw): Ditto.
	(ffi_java_raw_to_rvalue):  Ditto.
	* src/debug.c (ffi_type_test): Add debug tests for complex types.
	* include/ffi.h.in (FFI_TYPE_COMPLEX): Add new FFI_TYPE_COMPLEX.
	(FFI_TYPE_LAST): Bump.
	(ffi_type_complex_float): Add new ffi_type_....
	(ffi_type_complex_double): Ditto.
	(ffi_type_complex_longdouble): Ditto.

2014-07-22  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* src/s390/ffitarget.h (FFI_TARGET_HAS_COMPLEX_TYPE): Define to provide
	FFI_TYPE_COMPLEX support.
	* src/s390/ffi.c (ffi_check_struct_type): Implement FFI_TYPE_COMPLEX
	(ffi_prep_args): Ditto.
	(ffi_prep_cif_machdep): Ditto.
	(ffi_closure_helper_SYSV): Ditto.
2014-09-20 06:24:41 -04:00

79 lines
1.9 KiB
C

/* -*-c-*- */
#include "ffitest.h"
#include <stdlib.h>
#include <complex.h>
static _Complex T_C_TYPE many(_Complex T_C_TYPE c1,
_Complex T_C_TYPE c2,
_Complex T_C_TYPE c3,
_Complex T_C_TYPE c4,
_Complex T_C_TYPE c5,
_Complex T_C_TYPE c6,
_Complex T_C_TYPE c7,
_Complex T_C_TYPE c8,
_Complex T_C_TYPE c9,
_Complex T_C_TYPE c10,
_Complex T_C_TYPE c11,
_Complex T_C_TYPE c12,
_Complex T_C_TYPE c13)
{
printf("0 :%f,%fi\n"
"1 :%f,%fi\n"
"2 :%f,%fi\n"
"3 :%f,%fi\n"
"4 :%f,%fi\n"
"5 :%f,%fi\n"
"6 :%f,%fi\n"
"7 :%f,%fi\n"
"8 :%f,%fi\n"
"9 :%f,%fi\n"
"10:%f,%fi\n"
"11:%f,%fi\n"
"12:%f,%fi\n",
T_CONV creal (c1), T_CONV cimag (c1),
T_CONV creal (c2), T_CONV cimag (c2),
T_CONV creal (c3), T_CONV cimag (c3),
T_CONV creal (c4), T_CONV cimag (c4),
T_CONV creal (c5), T_CONV cimag (c5),
T_CONV creal (c6), T_CONV cimag (c6),
T_CONV creal (c7), T_CONV cimag (c7),
T_CONV creal (c8), T_CONV cimag (c8),
T_CONV creal (c9), T_CONV cimag (c9),
T_CONV creal (c10), T_CONV cimag (c10),
T_CONV creal (c11), T_CONV cimag (c11),
T_CONV creal (c12), T_CONV cimag (c12),
T_CONV creal (c13), T_CONV cimag (c13));
return (c1+c2-c3-c4+c5+c6+c7-c8-c9-c10-c11+c12+c13);
}
int main (void)
{
ffi_cif cif;
ffi_type *args[13];
void *values[13];
_Complex T_C_TYPE ca[13];
_Complex T_C_TYPE c, cc;
int i;
for (i = 0; i < 13; i++)
{
args[i] = &T_FFI_TYPE;
values[i] = &ca[i];
ca[i] = i + (-20 - i) * I;
}
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, &T_FFI_TYPE, args) == FFI_OK);
ffi_call(&cif, FFI_FN(many), &c, values);
cc = many(ca[0], ca[1], ca[2], ca[3], ca[4], ca[5], ca[6], ca[7], ca[8],
ca[9], ca[10], ca[11], ca[12]);
CHECK(creal (cc) == creal (c));
CHECK(cimag (cc) == cimag (c));
exit(0);
}