Commit Graph

145 Commits

Author SHA1 Message Date
Tom Tromey
38a4d72c95 add ffi_get_struct_offsets 2016-02-22 16:07:55 -07:00
Anthony Green
755f1e642d Merge pull request #193 from rth7680/fix-70
Test case from issue #70
2016-02-20 06:43:48 -05:00
Filipe Brandenburger
89b760503e Fix dejagnu test support for --tool_opts
Right now it concatenates it with the existing options and then appends
it to that list, fix it to simply append it as is, same as it is done
with the other variables.

Tested by running the following command which includes gcc options:
  $ make check RUNTESTFLAGS="--tool_opts '-Werror'"

Without this patch, all the tests fail. With it, the test succeed.
Inspecting the logs shows that -Werror was indeed used when compiling
the test sources.
2016-02-03 13:37:39 -08:00
Richard Henderson
4cdedc279f Tidy call.exp test collection
Commit c952a92e20 moved all of
the complex tests to libffi.complex, but failed to remove the
anti-globbing from libffi.call.
2015-10-20 07:16:10 -10:00
Richard Henderson
609db2fbe4 Test case from Issue #70 2015-10-20 07:16:10 -10:00
Anthony Green
5cd411ad5d New test case for old aarch64 bug 2015-01-13 15:44:03 -05:00
Richard Henderson
ccdd7bb856 testsuite: Fix alpha static chain register name 2014-11-16 12:12:23 +01:00
Anthony Green
3316b666e3 Merge pull request #145 from rth7680/master
Configure and testsuite cleanups, v2
2014-11-15 07:31:41 -05:00
Richard Henderson
c9f5b6648b testsuite: Add trivial tests for Go closures 2014-11-14 13:07:47 +01:00
Richard Henderson
c952a92e20 testsuite: Move complex tests to their own subdirectory
It seems a bit silly to isolate them by globbing vs "*complex*"
when we can just as easily put them in their own subdirectory.
2014-11-14 13:07:47 +01:00
Richard Henderson
f1301a54bb testsuite: Use feature test rather than enumeration for complex 2014-11-14 13:07:45 +01:00
Richard Henderson
b5ade2fb5d testsuite: Detect clang
Clang doesn't like the -Wno-psabi argument that we want to pass to GCC.
Since clang is detected as GCC via __GNUC__, use ax_cv_c_compiler_vendor.
2014-11-14 13:07:16 +01:00
Anatoly Trosinenko
771fabc6d5 Take a float absolute value using fabs() instead of abs().
Replace integer abs() by floating point fabs() in the approximate
equality check for float values.
2014-11-14 14:21:35 +03:00
Anatoly Trosinenko
9622ede2e2 Fix floating point number comparisons in testsuite/libffi.call/float[123].c.
Rewrite the checks for approximate equality of floating point return
values to be in the form "fabs(a - b) < EPS" instead of just
"a - b < EPS".
2014-11-14 13:18:04 +03:00
Richard Henderson
ad89c2d9e9 sparc: Add support for complex types 2014-11-12 09:36:09 +01:00
Richard Henderson
a529bec27b arm: Add support for complex types 2014-11-12 09:32:36 +01:00
Richard Henderson
f41bec3b57 alpha: Add support for complex types 2014-11-12 09:31:19 +01:00
Richard Henderson
a992f8789b aarch64: Add support for complex types 2014-11-12 09:29:31 +01:00
Richard Henderson
198f469e91 x86: Add support for Complex 2014-11-12 09:16:02 +01:00
Richard Henderson
7cf841324f testsuite: Add two dg-do run markers
Caught by clang warning about unused -L parameter.
2014-11-12 09:15:35 +01:00
Richard Henderson
fc501750f4 testsuite: Fix return_complex2 vs excessive precision
Use the previously computed rc2 to validate, rather than
recomputing a floating point result with excess precision.
2014-11-12 09:15:35 +01:00
Richard Henderson
99db4d42ac win64: Rewrite
It's way too different from the 32-bit ABIs with which it is
currently associated. As seen from all of the existing XFAILs.
2014-11-12 09:15:35 +01:00
Anthony Green
990eb9d4c2 Only run the complex type tests on supported platforms. 2014-09-28 00:50:29 -04:00
Anthony Green
fbbf48fbdf Compile tests with -Wno-psabi when using GCC 2014-09-20 07:43:51 -04:00
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
Anthony Green
70c303cb88 Fix testsuite for GCC 4.9.0 2014-05-11 09:56:40 -04:00
Josh Triplett
d36952273d Support fastcall closures
libffi on 32-bit x86 now supports closures for all supported ABIs.
Thus, rewrite the last remaining duplicated-by-ABI test (closure_stdcall
and closure_thiscall) to use the generic ABI_NUM/ABI_ATTR mechanism.
2014-04-20 17:08:37 -07:00
Josh Triplett
7d698125b1 Use the proper C++ compiler to run C++ tests
Running the C compiler with -shared-libgcc -lstdc++ does not work on
non-GCC compilers.
2014-03-27 00:40:27 -07:00
Josh Triplett
9946a92af3 Stop looking for expect and runtest above top_builddir
Users wishing to test hand-compiled versions of expect and runtest can
easily enough put them in their path or set EXPECT and RUNTEST
themselves.
2014-03-26 20:20:31 -07:00
Josh Triplett
acb2023252 Stop setting an empty AM_RUNTESTFLAGS 2014-03-26 20:20:31 -07:00
Josh Triplett
e48918ecf8 testsuite: Add ABIs to the test matrix; unify tests across ABIs
This eliminates all the *_win32.c tests in favor of the tests they were
branched from, and expands test coverage to run many more tests on
stdcall, thiscall, and fastcall.

This same mechanism also supports testing any other target that has
multiple ABIs.
2014-03-16 20:39:12 -07:00
Josh Triplett
4d4d368e5a testsuite: Replace ffitestcxx.h with ffitest.h
ffitest.h contains a superset of the functionality of ffitestcxx.h;
make the C++ tests include ffitest.h instead, and remove ffitestcxx.h.
2014-03-16 20:39:06 -07:00
Josh Triplett
3f97cf3413 testsuite: Unify the C and C++ testsuites
These two testsuites differ only in the source file glob and a couple of
additional compiler options; unify the remaining bits.
2014-03-16 20:34:46 -07:00
Josh Triplett
0d9cce8edb testsuite: ffitest.h: Parenthesize the CHECK macro 2014-03-16 20:34:46 -07:00
Josh Triplett
5695ec1444 testsuite: Factor out a function to run a matrix of tests
This commons up code from libffi.call/call.exp and
libffi.special/special.exp, unifies the optimization option matrix
between the two, and makes it easier to add more axes to the matrix
in the future.
2014-03-16 20:34:46 -07:00
Josh Triplett
dfdb02cc86 testsuite: Introduce a __THISCALL__ compiler-specific macro 2014-03-16 20:34:41 -07:00
Josh Triplett
bad8948346 testsuite: Introduce a __STDCALL__ compiler-specific macro
Several tests want to use stdcall, which differs in syntax by compiler,
so introduce a macro for it in ffitest.h.
2014-03-16 15:27:07 -07:00
Josh Triplett
98a793fa36 testsuite: Common up the ifdef blocks for compiler-specific macros 2014-03-16 15:21:57 -07:00
Josh Triplett
e1911f78df Add support for stdcall, thiscall, and fastcall on non-Windows x86-32
Linux supports the stdcall calling convention, either via functions
explicitly declared with the stdcall attribute, or via code compiled
with -mrtd which effectively makes stdcall the default.

This introduces FFI_STDCALL, FFI_THISCALL, and FFI_FASTCALL on
non-Windows x86-32 platforms, as non-default calling conventions.
2014-03-16 05:05:06 -07:00
Josh Triplett
9c279328ee testsuite: Remove fragile stack pointer checks
testsuite/libffi.call/closure_stdcall.c and
testsuite/libffi.call/closure_thiscall.c include inline assembly to save
the stack pointer before and after the call, and compare the values.
However, compilers can and do leave the stack in different states for
these two pieces of inline assembly, such as by saving a temporary value
on the stack across the call; observed with gcc -Os, and verified as
spurious through careful inspection of disassembly.
2014-03-16 04:45:37 -07:00
Josh Triplett
88d562a8b5 testsuite/libffi.call/many_win32.c: Avoid spurious failure due to excess precision
The test case testsuite/libffi.call/many_win32.c can spuriously fail due
to excess floating-point precision.  Instrumenting it with some printf
calls shows differences well above FLT_EPSILON.  (Note when
instrumenting it that multiple computations of the difference, such as
one in a print and another in the conditional, may produce different
results.)

Rather than complicating the test suite with architecture-specific flags
to avoid excess precision, just simplify the floating-point computation
to avoid a dependency on potential excess precision.
2014-03-16 04:39:37 -07:00
Josh Triplett
c00a49ecd1 testsuite/libffi.call/many.c: Avoid spurious failure due to excess precision
The test case testsuite/libffi.call/many.c can spuriously fail due to
excess floating-point precision.  Instrumenting it with some printf
calls shows differences well above FLT_EPSILON.  (Note when
instrumenting it that multiple computations of the difference, such as
one in a print and another in the conditional, may produce different
results.)

Rather than complicating the test suite with architecture-specific flags
to avoid excess precision, just simplify the floating-point computation
to avoid a dependency on potential excess precision.
2014-03-16 04:39:37 -07:00
Josh Triplett
35634dbcea Remove autogenerated files from the repository
Add an autogen.sh to regenerate them.
2014-03-16 04:24:12 -07:00
Alan Modra
ab79d6e219 This separates the 32-bit sysv/linux/bsd code from the 64-bit linux
code, and makes it possible to link code compiled with different
options to those used to compile libffi.  For example, a
-mlong-double-128 libffi can be used with -mlong-double-64 code.

Using the return value area as a place to pass parameters wasn't such
a good idea, causing a failure of cls_ulonglong.c.  I didn't see this
when running the mainline gcc libffi testsuite because that version of
the test is inferior to the upstreamm libffi test.

Using NUM_FPR_ARG_REGISTERS rather than NUM_FPR_ARG_REGISTERS64 meant
that a parameter save area could be allocated before it was strictly
necessary.  Wrong but harmless.  Found when splitting apart ffi.c
into 32-bit and 64-bit support.
2013-11-21 21:24:56 -05:00
Alan Modra
164283f4ac 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..
2013-11-16 06:38:55 -05:00
Andrew Haley
db0ace3a38 Fix broken test cases 2013-11-16 06:29:25 -05:00
David Schneider
cdf405d574 add a testcase for the double/float issue on ARMHF 2013-11-13 18:01:56 +01:00
Anthony Green
c2422174b3 Merge pull request #45 from foss-for-synopsys-dwc-arc-processors/arc_support
arc: Fix build error
2013-11-02 17:11:08 -04:00
Sandra Loosemore
2f5626ce02 Fix testsuite bug 2013-10-15 15:32:16 -04:00
Marcus Shawcroft
f64e4a8655 Fix many.c testcase for Aarch64 2013-10-15 15:20:14 -04:00