summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/Makefile.am140
-rw-r--r--testsuite/Makefile.in207
-rw-r--r--testsuite/lib/libffi.exp19
-rw-r--r--testsuite/libffi.call/call.exp19
-rw-r--r--testsuite/libffi.call/closure_stdcall.c8
-rw-r--r--testsuite/libffi.call/closure_thiscall.c8
-rw-r--r--testsuite/libffi.call/cls_12byte.c8
-rw-r--r--testsuite/libffi.call/cls_16byte.c8
-rw-r--r--testsuite/libffi.call/cls_18byte.c8
-rw-r--r--testsuite/libffi.call/cls_19byte.c8
-rw-r--r--testsuite/libffi.call/cls_1_1byte.c8
-rw-r--r--testsuite/libffi.call/cls_20byte.c8
-rw-r--r--testsuite/libffi.call/cls_20byte1.c8
-rw-r--r--testsuite/libffi.call/cls_24byte.c10
-rw-r--r--testsuite/libffi.call/cls_2byte.c8
-rw-r--r--testsuite/libffi.call/cls_3_1byte.c8
-rw-r--r--testsuite/libffi.call/cls_3byte1.c8
-rw-r--r--testsuite/libffi.call/cls_3byte2.c8
-rw-r--r--testsuite/libffi.call/cls_4_1byte.c8
-rw-r--r--testsuite/libffi.call/cls_4byte.c8
-rw-r--r--testsuite/libffi.call/cls_5_1_byte.c8
-rw-r--r--testsuite/libffi.call/cls_5byte.c8
-rw-r--r--testsuite/libffi.call/cls_64byte.c10
-rw-r--r--testsuite/libffi.call/cls_6_1_byte.c8
-rw-r--r--testsuite/libffi.call/cls_6byte.c8
-rw-r--r--testsuite/libffi.call/cls_7_1_byte.c8
-rw-r--r--testsuite/libffi.call/cls_7byte.c8
-rw-r--r--testsuite/libffi.call/cls_8byte.c8
-rw-r--r--testsuite/libffi.call/cls_9byte1.c8
-rw-r--r--testsuite/libffi.call/cls_9byte2.c8
-rw-r--r--testsuite/libffi.call/cls_align_double.c8
-rw-r--r--testsuite/libffi.call/cls_align_float.c8
-rw-r--r--testsuite/libffi.call/cls_align_longdouble.c8
-rw-r--r--testsuite/libffi.call/cls_align_longdouble_split.c8
-rw-r--r--testsuite/libffi.call/cls_align_longdouble_split2.c8
-rw-r--r--testsuite/libffi.call/cls_align_pointer.c8
-rw-r--r--testsuite/libffi.call/cls_align_sint16.c8
-rw-r--r--testsuite/libffi.call/cls_align_sint32.c8
-rw-r--r--testsuite/libffi.call/cls_align_sint64.c8
-rw-r--r--testsuite/libffi.call/cls_align_uint16.c8
-rw-r--r--testsuite/libffi.call/cls_align_uint32.c8
-rw-r--r--testsuite/libffi.call/cls_align_uint64.c8
-rw-r--r--testsuite/libffi.call/cls_dbls_struct.c4
-rw-r--r--testsuite/libffi.call/cls_double_va.c9
-rw-r--r--testsuite/libffi.call/cls_longdouble.c4
-rw-r--r--testsuite/libffi.call/cls_longdouble_va.c9
-rw-r--r--testsuite/libffi.call/cls_pointer.c2
-rw-r--r--testsuite/libffi.call/cls_pointer_stack.c20
-rw-r--r--testsuite/libffi.call/cls_struct_va1.c114
-rw-r--r--testsuite/libffi.call/cls_uchar_va.c44
-rw-r--r--testsuite/libffi.call/cls_uint_va.c45
-rw-r--r--testsuite/libffi.call/cls_ulong_va.c45
-rw-r--r--testsuite/libffi.call/cls_ulonglong.c10
-rw-r--r--testsuite/libffi.call/cls_ushort_va.c44
-rw-r--r--testsuite/libffi.call/err_bad_typedef.c4
-rw-r--r--testsuite/libffi.call/fastthis1_win32.c2
-rw-r--r--testsuite/libffi.call/fastthis2_win32.c2
-rw-r--r--testsuite/libffi.call/fastthis3_win32.c2
-rw-r--r--testsuite/libffi.call/ffitest.h57
-rw-r--r--testsuite/libffi.call/float_va.c16
-rw-r--r--testsuite/libffi.call/huge_struct.c35
-rw-r--r--testsuite/libffi.call/many2.c5
-rw-r--r--testsuite/libffi.call/negint.c1
-rw-r--r--testsuite/libffi.call/nested_struct.c12
-rw-r--r--testsuite/libffi.call/nested_struct1.c16
-rw-r--r--testsuite/libffi.call/nested_struct10.c12
-rw-r--r--testsuite/libffi.call/nested_struct11.c121
-rw-r--r--testsuite/libffi.call/nested_struct2.c10
-rw-r--r--testsuite/libffi.call/nested_struct3.c10
-rw-r--r--testsuite/libffi.call/nested_struct4.c10
-rw-r--r--testsuite/libffi.call/nested_struct5.c10
-rw-r--r--testsuite/libffi.call/nested_struct6.c12
-rw-r--r--testsuite/libffi.call/nested_struct7.c10
-rw-r--r--testsuite/libffi.call/nested_struct8.c12
-rw-r--r--testsuite/libffi.call/nested_struct9.c12
-rw-r--r--testsuite/libffi.call/return_dbl.c1
-rw-r--r--testsuite/libffi.call/return_uc.c2
-rw-r--r--testsuite/libffi.call/stret_large.c14
-rw-r--r--testsuite/libffi.call/stret_large2.c14
-rw-r--r--testsuite/libffi.call/stret_medium.c10
-rw-r--r--testsuite/libffi.call/stret_medium2.c10
-rw-r--r--testsuite/libffi.call/strlen2_win32.c2
-rw-r--r--testsuite/libffi.call/struct1.c12
-rw-r--r--testsuite/libffi.call/struct1_win32.c14
-rw-r--r--testsuite/libffi.call/struct2.c10
-rw-r--r--testsuite/libffi.call/struct2_win32.c12
-rw-r--r--testsuite/libffi.call/struct3.c9
-rw-r--r--testsuite/libffi.call/struct4.c13
-rw-r--r--testsuite/libffi.call/struct5.c13
-rw-r--r--testsuite/libffi.call/struct6.c14
-rw-r--r--testsuite/libffi.call/struct7.c14
-rw-r--r--testsuite/libffi.call/struct8.c13
-rw-r--r--testsuite/libffi.call/struct9.c13
-rw-r--r--testsuite/libffi.call/testclosure.c4
-rw-r--r--testsuite/libffi.call/uninitialized.c61
-rw-r--r--testsuite/libffi.call/va_1.c196
-rw-r--r--testsuite/libffi.call/va_struct1.c121
-rw-r--r--testsuite/libffi.call/va_struct2.c123
-rw-r--r--testsuite/libffi.call/va_struct3.c125
-rw-r--r--testsuite/libffi.special/ffitestcxx.h41
-rw-r--r--testsuite/libffi.special/special.exp12
-rw-r--r--testsuite/libffi.special/unwindtest.cc1
-rw-r--r--testsuite/libffi.special/unwindtest_ffi_call.cc1
103 files changed, 1697 insertions, 592 deletions
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index cfd1df4..edc6e61 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -13,68 +13,82 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
AM_RUNTESTFLAGS =
+EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
+
CLEANFILES = *.exe core* *.log *.sum
-EXTRA_DIST = libffi.special/special.exp \
-libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \
-libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \
-lib/libffi.exp lib/wrapper.exp libffi.call/float.c \
-libffi.call/cls_multi_schar.c libffi.call/float3.c \
-libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \
-libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \
-libffi.call/promotion.c libffi.call/cls_dbls_struct.c \
-libffi.call/nested_struct.c libffi.call/closure_fn1.c \
-libffi.call/cls_4_1byte.c libffi.call/cls_float.c \
-libffi.call/cls_2byte.c libffi.call/closure_fn4.c \
-libffi.call/return_fl2.c libffi.call/nested_struct7.c \
-libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \
-libffi.call/float1.c libffi.call/cls_19byte.c \
-libffi.call/nested_struct1.c libffi.call/cls_4byte.c \
-libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \
-libffi.call/nested_struct4.c libffi.call/nested_struct3.c \
-libffi.call/struct7.c libffi.call/nested_struct9.c \
-libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \
-libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \
-libffi.call/testclosure.c libffi.call/cls_3byte1.c \
-libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \
-libffi.call/cls_ushort.c libffi.call/stret_medium2.c \
-libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \
-libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \
-libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \
-libffi.call/return_ll.c libffi.call/cls_pointer.c \
-libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \
-libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \
-libffi.call/return_sl.c libffi.call/cls_1_1byte.c \
-libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \
-libffi.call/cls_double.c libffi.call/many_win32.c \
-libffi.call/cls_16byte.c libffi.call/cls_align_double.c \
-libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \
-libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \
-libffi.call/closure_stdcall.c libffi.call/return_fl.c \
-libffi.call/strlen_win32.c libffi.call/return_ldl.c \
-libffi.call/cls_align_float.c libffi.call/struct3.c \
-libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \
-libffi.call/cls_align_longdouble_split.c \
-libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \
-libffi.call/stret_large.c libffi.call/cls_align_sint16.c \
-libffi.call/nested_struct6.c libffi.call/cls_5byte.c \
-libffi.call/return_dbl.c libffi.call/cls_20byte.c \
-libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \
-libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \
-libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \
-libffi.call/cls_18byte.c libffi.call/closure_fn3.c \
-libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \
-libffi.call/struct2.c libffi.call/cls_3byte2.c \
-libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \
-libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \
-libffi.call/problem1.c libffi.call/float4.c \
-libffi.call/cls_align_uint64.c libffi.call/struct9.c \
-libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \
-libffi.call/closure_fn0.c libffi.call/closure_fn6.c \
-libffi.call/struct4.c libffi.call/nested_struct2.c \
-libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \
-libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \
-libffi.call/cls_12byte.c libffi.call/cls_double_va.c \
-libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \
-libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
-libffi.call/huge_struct.c
+EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
+libffi.call/cls_align_longdouble_split.c \
+libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \
+libffi.call/closure_fn1.c libffi.call/many2_win32.c \
+libffi.call/return_ul.c libffi.call/cls_align_double.c \
+libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \
+libffi.call/cls_64byte.c libffi.call/nested_struct7.c \
+libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \
+libffi.call/ffitest.h libffi.call/nested_struct4.c \
+libffi.call/cls_multi_ushort.c libffi.call/struct3.c \
+libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \
+libffi.call/struct8.c libffi.call/nested_struct8.c \
+libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \
+libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \
+libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \
+libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \
+libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \
+libffi.call/call.exp libffi.call/cls_double.c \
+libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \
+libffi.call/return_ll1.c libffi.call/nested_struct3.c \
+libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \
+libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \
+libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \
+libffi.call/return_fl.c libffi.call/struct5.c \
+libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \
+libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
+libffi.call/return_fl3.c libffi.call/stret_medium.c \
+libffi.call/nested_struct6.c libffi.call/closure_fn3.c \
+libffi.call/float3.c libffi.call/many2.c \
+libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
+libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
+libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
+libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
+libffi.call/cls_sshort.c libffi.call/many_win32.c \
+libffi.call/nested_struct.c libffi.call/cls_20byte.c \
+libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
+libffi.call/return_uc.c libffi.call/closure_thiscall.c \
+libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
+libffi.call/promotion.c libffi.call/struct1_win32.c \
+libffi.call/return_dbl.c libffi.call/cls_24byte.c \
+libffi.call/struct4.c libffi.call/cls_6byte.c \
+libffi.call/cls_align_uint32.c libffi.call/float.c \
+libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
+libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
+libffi.call/cls_align_float.c libffi.call/return_fl1.c \
+libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
+libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
+libffi.call/stret_large2.c libffi.call/return_sl.c \
+libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
+libffi.call/cls_2byte.c libffi.call/float2.c \
+libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
+libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
+libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
+libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
+libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
+libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
+libffi.call/struct1.c libffi.call/nested_struct9.c \
+libffi.call/huge_struct.c libffi.call/problem1.c \
+libffi.call/float4.c libffi.call/fastthis3_win32.c \
+libffi.call/return_ldl.c libffi.call/strlen2_win32.c \
+libffi.call/closure_fn5.c libffi.call/struct2_win32.c \
+libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \
+libffi.call/return_sc.c libffi.call/struct7.c \
+libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \
+libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \
+libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \
+libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \
+libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \
+lib/libffi.exp libffi.call/cls_struct_va1.c \
+libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \
+libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \
+libffi.call/nested_struct11.c libffi.call/uninitialized.c \
+libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \
+libffi.call/va_struct3.c
+
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index b446655..a3ba066 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,6 +14,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -38,8 +54,10 @@ subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \
+ $(top_srcdir)/m4/ax_append_flag.m4 \
$(top_srcdir)/m4/ax_cc_maxopt.m4 \
$(top_srcdir)/m4/ax_cflags_warn_all.m4 \
+ $(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_configure_args.m4 \
$(top_srcdir)/m4/ax_enable_builddir.m4 \
@@ -57,6 +75,11 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
DEJATOOL = $(PACKAGE)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -204,70 +227,82 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
echo $(top_srcdir)/../dejagnu/runtest ; \
else echo runtest; fi`
+EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
CLEANFILES = *.exe core* *.log *.sum
-EXTRA_DIST = libffi.special/special.exp \
-libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \
-libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \
-lib/libffi.exp lib/wrapper.exp libffi.call/float.c \
-libffi.call/cls_multi_schar.c libffi.call/float3.c \
-libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \
-libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \
-libffi.call/promotion.c libffi.call/cls_dbls_struct.c \
-libffi.call/nested_struct.c libffi.call/closure_fn1.c \
-libffi.call/cls_4_1byte.c libffi.call/cls_float.c \
-libffi.call/cls_2byte.c libffi.call/closure_fn4.c \
-libffi.call/return_fl2.c libffi.call/nested_struct7.c \
-libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \
-libffi.call/float1.c libffi.call/cls_19byte.c \
-libffi.call/nested_struct1.c libffi.call/cls_4byte.c \
-libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \
-libffi.call/nested_struct4.c libffi.call/nested_struct3.c \
-libffi.call/struct7.c libffi.call/nested_struct9.c \
-libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \
-libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \
-libffi.call/testclosure.c libffi.call/cls_3byte1.c \
-libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \
-libffi.call/cls_ushort.c libffi.call/stret_medium2.c \
-libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \
-libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \
-libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \
-libffi.call/return_ll.c libffi.call/cls_pointer.c \
-libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \
-libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \
-libffi.call/return_sl.c libffi.call/cls_1_1byte.c \
-libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \
-libffi.call/cls_double.c libffi.call/many_win32.c \
-libffi.call/cls_16byte.c libffi.call/cls_align_double.c \
-libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \
-libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \
-libffi.call/closure_stdcall.c libffi.call/return_fl.c \
-libffi.call/strlen_win32.c libffi.call/return_ldl.c \
-libffi.call/cls_align_float.c libffi.call/struct3.c \
-libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \
-libffi.call/cls_align_longdouble_split.c \
-libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \
-libffi.call/stret_large.c libffi.call/cls_align_sint16.c \
-libffi.call/nested_struct6.c libffi.call/cls_5byte.c \
-libffi.call/return_dbl.c libffi.call/cls_20byte.c \
-libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \
-libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \
-libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \
-libffi.call/cls_18byte.c libffi.call/closure_fn3.c \
-libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \
-libffi.call/struct2.c libffi.call/cls_3byte2.c \
-libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \
-libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \
-libffi.call/problem1.c libffi.call/float4.c \
-libffi.call/cls_align_uint64.c libffi.call/struct9.c \
-libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \
-libffi.call/closure_fn0.c libffi.call/closure_fn6.c \
-libffi.call/struct4.c libffi.call/nested_struct2.c \
-libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \
-libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \
-libffi.call/cls_12byte.c libffi.call/cls_double_va.c \
-libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \
-libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
-libffi.call/huge_struct.c
+EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
+libffi.call/cls_align_longdouble_split.c \
+libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \
+libffi.call/closure_fn1.c libffi.call/many2_win32.c \
+libffi.call/return_ul.c libffi.call/cls_align_double.c \
+libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \
+libffi.call/cls_64byte.c libffi.call/nested_struct7.c \
+libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \
+libffi.call/ffitest.h libffi.call/nested_struct4.c \
+libffi.call/cls_multi_ushort.c libffi.call/struct3.c \
+libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \
+libffi.call/struct8.c libffi.call/nested_struct8.c \
+libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \
+libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \
+libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \
+libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \
+libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \
+libffi.call/call.exp libffi.call/cls_double.c \
+libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \
+libffi.call/return_ll1.c libffi.call/nested_struct3.c \
+libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \
+libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \
+libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \
+libffi.call/return_fl.c libffi.call/struct5.c \
+libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \
+libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
+libffi.call/return_fl3.c libffi.call/stret_medium.c \
+libffi.call/nested_struct6.c libffi.call/closure_fn3.c \
+libffi.call/float3.c libffi.call/many2.c \
+libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
+libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
+libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
+libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
+libffi.call/cls_sshort.c libffi.call/many_win32.c \
+libffi.call/nested_struct.c libffi.call/cls_20byte.c \
+libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
+libffi.call/return_uc.c libffi.call/closure_thiscall.c \
+libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
+libffi.call/promotion.c libffi.call/struct1_win32.c \
+libffi.call/return_dbl.c libffi.call/cls_24byte.c \
+libffi.call/struct4.c libffi.call/cls_6byte.c \
+libffi.call/cls_align_uint32.c libffi.call/float.c \
+libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
+libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
+libffi.call/cls_align_float.c libffi.call/return_fl1.c \
+libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
+libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
+libffi.call/stret_large2.c libffi.call/return_sl.c \
+libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
+libffi.call/cls_2byte.c libffi.call/float2.c \
+libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
+libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
+libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
+libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
+libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
+libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
+libffi.call/struct1.c libffi.call/nested_struct9.c \
+libffi.call/huge_struct.c libffi.call/problem1.c \
+libffi.call/float4.c libffi.call/fastthis3_win32.c \
+libffi.call/return_ldl.c libffi.call/strlen2_win32.c \
+libffi.call/closure_fn5.c libffi.call/struct2_win32.c \
+libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \
+libffi.call/return_sc.c libffi.call/struct7.c \
+libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \
+libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \
+libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \
+libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \
+libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \
+lib/libffi.exp libffi.call/cls_struct_va1.c \
+libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \
+libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \
+libffi.call/nested_struct11.c libffi.call/uninitialized.c \
+libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \
+libffi.call/va_struct3.c
all: all-am
@@ -314,9 +349,11 @@ TAGS:
ctags: CTAGS
CTAGS:
+cscope cscopelist:
+
check-DEJAGNU: site.exp
- srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ srcdir='$(srcdir)'; export srcdir; \
EXPECT=$(EXPECT); export EXPECT; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
@@ -324,15 +361,15 @@ check-DEJAGNU: site.exp
if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
then :; else exit_status=1; fi; \
done; \
- else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ else echo "WARNING: could not find 'runtest'" 1>&2; :;\
fi; \
exit $$exit_status
-site.exp: Makefile
- @echo 'Making a new site.exp file...'
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
+ @echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp
- @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo 'set srcdir "$(srcdir)"' >>site.tmp
@echo "set objdir `pwd`" >>site.tmp
@echo 'set build_alias "$(build_alias)"' >>site.tmp
@echo 'set build_triplet $(build_triplet)' >>site.tmp
@@ -340,9 +377,16 @@ site.exp: Makefile
@echo 'set host_triplet $(host_triplet)' >>site.tmp
@echo 'set target_alias "$(target_alias)"' >>site.tmp
@echo 'set target_triplet $(target_triplet)' >>site.tmp
- @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
- @test ! -f site.exp || \
- sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+ echo "## Begin content included from file $$f. Do not modify. ##" \
+ && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+ && echo "## End content included from file $$f. ##" \
+ || exit 1; \
+ done >> site.tmp
+ @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
+ @if test -f site.exp; then \
+ sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
+ fi
@-rm -f site.bak
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
@@ -398,10 +442,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index 4a65ed1..1ac2c36 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -101,9 +101,17 @@ proc libffi-init { args } {
global tool_root_dir
global ld_library_path
+ global using_gcc
+
set blddirffi [pwd]/..
verbose "libffi $blddirffi"
+ # Are we building with GCC?
+ set tmp [grep ../config.status "GCC='yes'"]
+ if { [string match $tmp "GCC='yes'"] } {
+
+ set using_gcc "yes"
+
set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
if {$gccdir != ""} {
set gccdir [file dirname $gccdir]
@@ -127,6 +135,13 @@ proc libffi-init { args } {
}
}
}
+
+ } else {
+
+ set using_gcc "no"
+
+ }
+
# add the library path for libffi.
append ld_library_path ":${blddirffi}/.libs"
@@ -203,6 +218,10 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lffi"
+ if { [string match "aarch64*-*-linux*" $target_triplet] } {
+ lappend options "libs= -lpthread"
+ }
+
verbose "options: $options"
return [target_compile $source $dest $type $options]
}
diff --git a/testsuite/libffi.call/call.exp b/testsuite/libffi.call/call.exp
index 26acd81..c334685 100644
--- a/testsuite/libffi.call/call.exp
+++ b/testsuite/libffi.call/call.exp
@@ -19,11 +19,20 @@ libffi-init
global srcdir subdir
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" ""
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" ""
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" ""
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" ""
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" ""
+if { [string match $using_gcc "yes"] } {
+
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" ""
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" ""
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" ""
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" ""
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" ""
+
+} else {
+
+ # Assume we are using the vendor compiler.
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" ""
+
+}
dg-finish
diff --git a/testsuite/libffi.call/closure_stdcall.c b/testsuite/libffi.call/closure_stdcall.c
index 6bfcc1f..1407f02 100644
--- a/testsuite/libffi.call/closure_stdcall.c
+++ b/testsuite/libffi.call/closure_stdcall.c
@@ -49,9 +49,17 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall,
(void *) 3 /* userdata */, code) == FFI_OK);
+#ifdef _MSC_VER
+ __asm { mov sp_pre, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
+#endif
res = (*(closure_test_type0)code)(0, 1, 2, 3);
+#ifdef _MSC_VER
+ __asm { mov sp_post, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_post));
+#endif
/* { dg-output "0 1 2 3: 9" } */
printf("res: %d\n",res);
diff --git a/testsuite/libffi.call/closure_thiscall.c b/testsuite/libffi.call/closure_thiscall.c
index 6c46f35..0f93649 100644
--- a/testsuite/libffi.call/closure_thiscall.c
+++ b/testsuite/libffi.call/closure_thiscall.c
@@ -49,9 +49,17 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_thiscall,
(void *) 3 /* userdata */, code) == FFI_OK);
+#ifdef _MSC_VER
+ __asm { mov sp_pre, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
+#endif
res = (*(closure_test_type0)code)(0, 1, 2, 3);
+#ifdef _MSC_VER
+ __asm { mov sp_post, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_post));
+#endif
/* { dg-output "0 1 2 3: 9" } */
printf("res: %d\n",res);
diff --git a/testsuite/libffi.call/cls_12byte.c b/testsuite/libffi.call/cls_12byte.c
index f0a334f..ea0825d 100644
--- a/testsuite/libffi.call/cls_12byte.c
+++ b/testsuite/libffi.call/cls_12byte.c
@@ -49,15 +49,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_12byte h_dbl = { 7, 4, 9 };
+ struct cls_struct_12byte j_dbl = { 1, 5, 3 };
+ struct cls_struct_12byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_12byte h_dbl = { 7, 4, 9 };
- struct cls_struct_12byte j_dbl = { 1, 5, 3 };
- struct cls_struct_12byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/testsuite/libffi.call/cls_16byte.c b/testsuite/libffi.call/cls_16byte.c
index 9b9292a..89a08a2 100644
--- a/testsuite/libffi.call/cls_16byte.c
+++ b/testsuite/libffi.call/cls_16byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_16byte h_dbl = { 7, 8.0, 9 };
+ struct cls_struct_16byte j_dbl = { 1, 9.0, 3 };
+ struct cls_struct_16byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_16byte h_dbl = { 7, 8.0, 9 };
- struct cls_struct_16byte j_dbl = { 1, 9.0, 3 };
- struct cls_struct_16byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/testsuite/libffi.call/cls_18byte.c b/testsuite/libffi.call/cls_18byte.c
index 40c8c6d..9f75da8 100644
--- a/testsuite/libffi.call/cls_18byte.c
+++ b/testsuite/libffi.call/cls_18byte.c
@@ -54,15 +54,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 };
+ struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 };
+ struct cls_struct_18byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 };
- struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 };
- struct cls_struct_18byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_19byte.c b/testsuite/libffi.call/cls_19byte.c
index aa64248..278794b 100644
--- a/testsuite/libffi.call/cls_19byte.c
+++ b/testsuite/libffi.call/cls_19byte.c
@@ -57,15 +57,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 };
+ struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 };
+ struct cls_struct_19byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 };
- struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 };
- struct cls_struct_19byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_1_1byte.c b/testsuite/libffi.call/cls_1_1byte.c
index b9402d6..82492c0 100644
--- a/testsuite/libffi.call/cls_1_1byte.c
+++ b/testsuite/libffi.call/cls_1_1byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_1_1byte g_dbl = { 12 };
+ struct cls_struct_1_1byte f_dbl = { 178 };
+ struct cls_struct_1_1byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_1_1byte g_dbl = { 12 };
- struct cls_struct_1_1byte f_dbl = { 178 };
- struct cls_struct_1_1byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = NULL;
diff --git a/testsuite/libffi.call/cls_20byte.c b/testsuite/libffi.call/cls_20byte.c
index 80dd7ac..3f8bb28 100644
--- a/testsuite/libffi.call/cls_20byte.c
+++ b/testsuite/libffi.call/cls_20byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 };
+ struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 };
+ struct cls_struct_20byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 };
- struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 };
- struct cls_struct_20byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/testsuite/libffi.call/cls_20byte1.c b/testsuite/libffi.call/cls_20byte1.c
index 50bcbbf..6562727 100644
--- a/testsuite/libffi.call/cls_20byte1.c
+++ b/testsuite/libffi.call/cls_20byte1.c
@@ -52,15 +52,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 };
+ struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 };
+ struct cls_struct_20byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 };
- struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 };
- struct cls_struct_20byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/testsuite/libffi.call/cls_24byte.c b/testsuite/libffi.call/cls_24byte.c
index 46a6eb4..1d82f6e 100644
--- a/testsuite/libffi.call/cls_24byte.c
+++ b/testsuite/libffi.call/cls_24byte.c
@@ -61,17 +61,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 };
struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 };
struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 };
struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 };
struct cls_struct_24byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/testsuite/libffi.call/cls_2byte.c b/testsuite/libffi.call/cls_2byte.c
index 101e130..81bb0a6 100644
--- a/testsuite/libffi.call/cls_2byte.c
+++ b/testsuite/libffi.call/cls_2byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_2byte g_dbl = { 12, 127 };
+ struct cls_struct_2byte f_dbl = { 1, 13 };
+ struct cls_struct_2byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_2byte g_dbl = { 12, 127 };
- struct cls_struct_2byte f_dbl = { 1, 13 };
- struct cls_struct_2byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/cls_3_1byte.c b/testsuite/libffi.call/cls_3_1byte.c
index fc780c3..b782746 100644
--- a/testsuite/libffi.call/cls_3_1byte.c
+++ b/testsuite/libffi.call/cls_3_1byte.c
@@ -54,15 +54,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_3_1byte g_dbl = { 12, 13, 14 };
+ struct cls_struct_3_1byte f_dbl = { 178, 179, 180 };
+ struct cls_struct_3_1byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_3_1byte g_dbl = { 12, 13, 14 };
- struct cls_struct_3_1byte f_dbl = { 178, 179, 180 };
- struct cls_struct_3_1byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_3byte1.c b/testsuite/libffi.call/cls_3byte1.c
index 5705ce3..a02c463 100644
--- a/testsuite/libffi.call/cls_3byte1.c
+++ b/testsuite/libffi.call/cls_3byte1.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_3byte g_dbl = { 12, 119 };
+ struct cls_struct_3byte f_dbl = { 1, 15 };
+ struct cls_struct_3byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_3byte g_dbl = { 12, 119 };
- struct cls_struct_3byte f_dbl = { 1, 15 };
- struct cls_struct_3byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/cls_3byte2.c b/testsuite/libffi.call/cls_3byte2.c
index 01770a0..c7251ce 100644
--- a/testsuite/libffi.call/cls_3byte2.c
+++ b/testsuite/libffi.call/cls_3byte2.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_3byte_1 g_dbl = { 15, 125 };
+ struct cls_struct_3byte_1 f_dbl = { 9, 19 };
+ struct cls_struct_3byte_1 res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_3byte_1 g_dbl = { 15, 125 };
- struct cls_struct_3byte_1 f_dbl = { 9, 19 };
- struct cls_struct_3byte_1 res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/cls_4_1byte.c b/testsuite/libffi.call/cls_4_1byte.c
index f3806d7..2d6d8b6 100644
--- a/testsuite/libffi.call/cls_4_1byte.c
+++ b/testsuite/libffi.call/cls_4_1byte.c
@@ -56,15 +56,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 };
+ struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 };
+ struct cls_struct_4_1byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 };
- struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 };
- struct cls_struct_4_1byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_4byte.c b/testsuite/libffi.call/cls_4byte.c
index a1aba3c..4ac3787 100644
--- a/testsuite/libffi.call/cls_4byte.c
+++ b/testsuite/libffi.call/cls_4byte.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_4byte g_dbl = { 127, 120 };
+ struct cls_struct_4byte f_dbl = { 12, 128 };
+ struct cls_struct_4byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_4byte g_dbl = { 127, 120 };
- struct cls_struct_4byte f_dbl = { 12, 128 };
- struct cls_struct_4byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/cls_5_1_byte.c b/testsuite/libffi.call/cls_5_1_byte.c
index 2ceba3d..ad9d51c 100644
--- a/testsuite/libffi.call/cls_5_1_byte.c
+++ b/testsuite/libffi.call/cls_5_1_byte.c
@@ -58,15 +58,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 };
+ struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 };
+ struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 };
- struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 };
- struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_5byte.c b/testsuite/libffi.call/cls_5byte.c
index 61d595c..4e0c000 100644
--- a/testsuite/libffi.call/cls_5byte.c
+++ b/testsuite/libffi.call/cls_5byte.c
@@ -53,15 +53,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_5byte g_dbl = { 127, 120, 1 };
+ struct cls_struct_5byte f_dbl = { 12, 128, 9 };
+ struct cls_struct_5byte res_dbl = { 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_5byte g_dbl = { 127, 120, 1 };
- struct cls_struct_5byte f_dbl = { 12, 128, 9 };
- struct cls_struct_5byte res_dbl = { 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_64byte.c b/testsuite/libffi.call/cls_64byte.c
index 576ebe0..a55edc2 100644
--- a/testsuite/libffi.call/cls_64byte.c
+++ b/testsuite/libffi.call/cls_64byte.c
@@ -66,17 +66,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 };
struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 };
struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 };
struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 };
struct cls_struct_64byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/testsuite/libffi.call/cls_6_1_byte.c b/testsuite/libffi.call/cls_6_1_byte.c
index 9f2eff6..b4dcdba 100644
--- a/testsuite/libffi.call/cls_6_1_byte.c
+++ b/testsuite/libffi.call/cls_6_1_byte.c
@@ -60,15 +60,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 };
+ struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 };
+ struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 };
- struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 };
- struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_6byte.c b/testsuite/libffi.call/cls_6byte.c
index 73257b0..7406780 100644
--- a/testsuite/libffi.call/cls_6byte.c
+++ b/testsuite/libffi.call/cls_6byte.c
@@ -56,15 +56,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 };
+ struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 };
+ struct cls_struct_6byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 };
- struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 };
- struct cls_struct_6byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_7_1_byte.c b/testsuite/libffi.call/cls_7_1_byte.c
index 50d09c9..14a7e96 100644
--- a/testsuite/libffi.call/cls_7_1_byte.c
+++ b/testsuite/libffi.call/cls_7_1_byte.c
@@ -62,15 +62,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 };
+ struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 };
+ struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 };
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 };
- struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 };
- struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 };
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_7byte.c b/testsuite/libffi.call/cls_7byte.c
index f5c0000..1645cc6 100644
--- a/testsuite/libffi.call/cls_7byte.c
+++ b/testsuite/libffi.call/cls_7byte.c
@@ -55,15 +55,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 };
+ struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 };
+ struct cls_struct_7byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 };
- struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 };
- struct cls_struct_7byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_8byte.c b/testsuite/libffi.call/cls_8byte.c
index 4aa99d1..f6c1ea5 100644
--- a/testsuite/libffi.call/cls_8byte.c
+++ b/testsuite/libffi.call/cls_8byte.c
@@ -49,15 +49,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_8byte g_dbl = { 1, 2.0 };
+ struct cls_struct_8byte f_dbl = { 4, 5.0 };
+ struct cls_struct_8byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_8byte g_dbl = { 1, 2.0 };
- struct cls_struct_8byte f_dbl = { 4, 5.0 };
- struct cls_struct_8byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/cls_9byte1.c b/testsuite/libffi.call/cls_9byte1.c
index cc5e9d6..0b85722 100644
--- a/testsuite/libffi.call/cls_9byte1.c
+++ b/testsuite/libffi.call/cls_9byte1.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_9byte h_dbl = { 7, 8.0};
+ struct cls_struct_9byte j_dbl = { 1, 9.0};
+ struct cls_struct_9byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_9byte h_dbl = { 7, 8.0};
- struct cls_struct_9byte j_dbl = { 1, 9.0};
- struct cls_struct_9byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/cls_9byte2.c b/testsuite/libffi.call/cls_9byte2.c
index 5c0ba0d..edf991d 100644
--- a/testsuite/libffi.call/cls_9byte2.c
+++ b/testsuite/libffi.call/cls_9byte2.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_9byte h_dbl = { 7.0, 8};
+ struct cls_struct_9byte j_dbl = { 1.0, 9};
+ struct cls_struct_9byte res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_9byte h_dbl = { 7.0, 8};
- struct cls_struct_9byte j_dbl = { 1.0, 9};
- struct cls_struct_9byte res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/cls_align_double.c b/testsuite/libffi.call/cls_align_double.c
index 22b94d5..aad5f3c 100644
--- a/testsuite/libffi.call/cls_align_double.c
+++ b/testsuite/libffi.call/cls_align_double.c
@@ -52,15 +52,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_float.c b/testsuite/libffi.call/cls_align_float.c
index 62637f2..37e0855 100644
--- a/testsuite/libffi.call/cls_align_float.c
+++ b/testsuite/libffi.call/cls_align_float.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_longdouble.c b/testsuite/libffi.call/cls_align_longdouble.c
index af38060..b3322d8 100644
--- a/testsuite/libffi.call/cls_align_longdouble.c
+++ b/testsuite/libffi.call/cls_align_longdouble.c
@@ -51,15 +51,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_longdouble;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_longdouble_split.c b/testsuite/libffi.call/cls_align_longdouble_split.c
index a3732bd..15f9365 100644
--- a/testsuite/libffi.call/cls_align_longdouble_split.c
+++ b/testsuite/libffi.call/cls_align_longdouble_split.c
@@ -87,15 +87,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
+ struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
- struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_longdouble;
cls_struct_fields[1] = &ffi_type_longdouble;
cls_struct_fields[2] = &ffi_type_longdouble;
diff --git a/testsuite/libffi.call/cls_align_longdouble_split2.c b/testsuite/libffi.call/cls_align_longdouble_split2.c
index 63a0f76..ca1c356 100644
--- a/testsuite/libffi.call/cls_align_longdouble_split2.c
+++ b/testsuite/libffi.call/cls_align_longdouble_split2.c
@@ -67,15 +67,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
+ struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
+ struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 };
- struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_longdouble;
cls_struct_fields[1] = &ffi_type_longdouble;
cls_struct_fields[2] = &ffi_type_longdouble;
diff --git a/testsuite/libffi.call/cls_align_pointer.c b/testsuite/libffi.call/cls_align_pointer.c
index cbc4f95..8fbf36a 100644
--- a/testsuite/libffi.call/cls_align_pointer.c
+++ b/testsuite/libffi.call/cls_align_pointer.c
@@ -54,15 +54,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, (void *)4951, 127 };
+ struct cls_struct_align f_dbl = { 1, (void *)9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, (void *)4951, 127 };
- struct cls_struct_align f_dbl = { 1, (void *)9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_pointer;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_sint16.c b/testsuite/libffi.call/cls_align_sint16.c
index 383ea41..039b874 100644
--- a/testsuite/libffi.call/cls_align_sint16.c
+++ b/testsuite/libffi.call/cls_align_sint16.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_sshort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_sint32.c b/testsuite/libffi.call/cls_align_sint32.c
index 705d78c..c96c6d1 100644
--- a/testsuite/libffi.call/cls_align_sint32.c
+++ b/testsuite/libffi.call/cls_align_sint32.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_sint64.c b/testsuite/libffi.call/cls_align_sint64.c
index 31d53af..9aa7bdd 100644
--- a/testsuite/libffi.call/cls_align_sint64.c
+++ b/testsuite/libffi.call/cls_align_sint64.c
@@ -51,15 +51,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_sint64;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_uint16.c b/testsuite/libffi.call/cls_align_uint16.c
index cb6b748..97620b7 100644
--- a/testsuite/libffi.call/cls_align_uint16.c
+++ b/testsuite/libffi.call/cls_align_uint16.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_uint32.c b/testsuite/libffi.call/cls_align_uint32.c
index e453d3e..5766fad 100644
--- a/testsuite/libffi.call/cls_align_uint32.c
+++ b/testsuite/libffi.call/cls_align_uint32.c
@@ -50,15 +50,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uint;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_align_uint64.c b/testsuite/libffi.call/cls_align_uint64.c
index 495c79f..a52cb89 100644
--- a/testsuite/libffi.call/cls_align_uint64.c
+++ b/testsuite/libffi.call/cls_align_uint64.c
@@ -52,15 +52,15 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_align g_dbl = { 12, 4951, 127 };
+ struct cls_struct_align f_dbl = { 1, 9320, 13 };
+ struct cls_struct_align res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
- struct cls_struct_align g_dbl = { 12, 4951, 127 };
- struct cls_struct_align f_dbl = { 1, 9320, 13 };
- struct cls_struct_align res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uint64;
cls_struct_fields[2] = &ffi_type_uchar;
diff --git a/testsuite/libffi.call/cls_dbls_struct.c b/testsuite/libffi.call/cls_dbls_struct.c
index 660dabb..d663791 100644
--- a/testsuite/libffi.call/cls_dbls_struct.c
+++ b/testsuite/libffi.call/cls_dbls_struct.c
@@ -37,6 +37,8 @@ int main(int argc __UNUSED__, char** argv __UNUSED__)
ffi_type ts1_type;
ffi_type* ts1_type_elements[4];
+ Dbls arg = { 1.0, 2.0 };
+
ts1_type.size = 0;
ts1_type.alignment = 0;
ts1_type.type = FFI_TYPE_STRUCT;
@@ -48,8 +50,6 @@ int main(int argc __UNUSED__, char** argv __UNUSED__)
cl_arg_types[0] = &ts1_type;
- Dbls arg = { 1.0, 2.0 };
-
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_void, cl_arg_types) == FFI_OK);
diff --git a/testsuite/libffi.call/cls_double_va.c b/testsuite/libffi.call/cls_double_va.c
index 67e44a4..43167b6 100644
--- a/testsuite/libffi.call/cls_double_va.c
+++ b/testsuite/libffi.call/cls_double_va.c
@@ -7,7 +7,6 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-output "" { xfail avr32*-*-* } } */
/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */
-/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */
#include "ffitest.h"
@@ -46,9 +45,9 @@ int main (void)
args[2] = NULL;
ffi_call(&cif, FFI_FN(printf), &res, args);
- // { dg-output "7.0" }
+ /* { dg-output "7.0" } */
printf("res: %d\n", (int) res);
- // { dg-output "\nres: 4" }
+ /* { 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);
@@ -56,9 +55,9 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
res = ((int(*)(char*, double))(code))(format, doubleArg);
- // { dg-output "\n7.0" }
+ /* { dg-output "\n7.0" } */
printf("res: %d\n", (int) res);
- // { dg-output "\nres: 4" }
+ /* { dg-output "\nres: 4" } */
exit(0);
}
diff --git a/testsuite/libffi.call/cls_longdouble.c b/testsuite/libffi.call/cls_longdouble.c
index e6bac1f..5dc9ac7 100644
--- a/testsuite/libffi.call/cls_longdouble.c
+++ b/testsuite/libffi.call/cls_longdouble.c
@@ -5,7 +5,9 @@
Originator: Blake Chaffin */
/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
-/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */
+/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have
+ remove the xfail for arm*-*-* below, until we know more. */
+/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
diff --git a/testsuite/libffi.call/cls_longdouble_va.c b/testsuite/libffi.call/cls_longdouble_va.c
index 6b8484a..7126b13 100644
--- a/testsuite/libffi.call/cls_longdouble_va.c
+++ b/testsuite/libffi.call/cls_longdouble_va.c
@@ -7,7 +7,6 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */
/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */
-/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */
#include "ffitest.h"
@@ -46,9 +45,9 @@ int main (void)
args[2] = NULL;
ffi_call(&cif, FFI_FN(printf), &res, args);
- // { dg-output "7.0" }
+ /* { dg-output "7.0" } */
printf("res: %d\n", (int) res);
- // { dg-output "\nres: 4" }
+ /* { 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,
@@ -57,9 +56,9 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
res = ((int(*)(char*, long double))(code))(format, ldArg);
- // { dg-output "\n7.0" }
+ /* { dg-output "\n7.0" } */
printf("res: %d\n", (int) res);
- // { dg-output "\nres: 4" }
+ /* { dg-output "\nres: 4" } */
exit(0);
}
diff --git a/testsuite/libffi.call/cls_pointer.c b/testsuite/libffi.call/cls_pointer.c
index cf03993..d82a87a 100644
--- a/testsuite/libffi.call/cls_pointer.c
+++ b/testsuite/libffi.call/cls_pointer.c
@@ -35,7 +35,7 @@ int main (void)
void *code;
ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3];
-// ffi_type cls_pointer_type;
+ /* ffi_type cls_pointer_type; */
ffi_type* arg_types[3];
/* cls_pointer_type.size = sizeof(void*);
diff --git a/testsuite/libffi.call/cls_pointer_stack.c b/testsuite/libffi.call/cls_pointer_stack.c
index d631cf8..1f1d915 100644
--- a/testsuite/libffi.call/cls_pointer_stack.c
+++ b/testsuite/libffi.call/cls_pointer_stack.c
@@ -28,11 +28,12 @@ void* cls_pointer_fn2(void* a1, void* a2)
char trample6 = trample4 + ((char*)&a2)[1];
long double trample7 = (intptr_t)trample5 + (intptr_t)trample1;
char trample8 = trample6 + trample2;
+ void* result;
dummyVar = dummy_func(trample1, trample2, trample3, trample4,
trample5, trample6, trample7, trample8);
- void* result = (void*)((intptr_t)a1 + (intptr_t)a2);
+ result = (void*)((intptr_t)a1 + (intptr_t)a2);
printf("0x%08x 0x%08x: 0x%08x\n",
(unsigned int)(uintptr_t) a1,
@@ -52,11 +53,12 @@ void* cls_pointer_fn1(void* a1, void* a2)
char trample6 = trample4 + ((char*)&a2)[1];
long double trample7 = (intptr_t)trample5 + (intptr_t)trample1;
char trample8 = trample6 + trample2;
+ void* result;
dummyVar = dummy_func(trample1, trample2, trample3, trample4,
trample5, trample6, trample7, trample8);
- void* result = (void*)((intptr_t)a1 + (intptr_t)a2);
+ result = (void*)((intptr_t)a1 + (intptr_t)a2);
printf("0x%08x 0x%08x: 0x%08x\n",
(unsigned int)(intptr_t) a1,
@@ -96,7 +98,7 @@ int main (void)
void *code;
ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3];
-// ffi_type cls_pointer_type;
+ /* ffi_type cls_pointer_type; */
ffi_type* arg_types[3];
/* cls_pointer_type.size = sizeof(void*);
@@ -123,18 +125,18 @@ int main (void)
ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args);
printf("res: 0x%08x\n", (unsigned int) res);
- // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" }
- // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" }
- // { dg-output "\nres: 0x8bf258bd" }
+ /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */
+ /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */
+ /* { dg-output "\nres: 0x8bf258bd" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK);
res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2);
printf("res: 0x%08x\n", (unsigned int) res);
- // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" }
- // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" }
- // { dg-output "\nres: 0x8bf258bd" }
+ /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */
+ /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */
+ /* { dg-output "\nres: 0x8bf258bd" } */
exit(0);
}
diff --git a/testsuite/libffi.call/cls_struct_va1.c b/testsuite/libffi.call/cls_struct_va1.c
new file mode 100644
index 0000000..175ed96
--- /dev/null
+++ b/testsuite/libffi.call/cls_struct_va1.c
@@ -0,0 +1,114 @@
+/* Area: ffi_call, closure_call
+ Purpose: Test doubles passed in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: Blake Chaffin 6/6/2007 */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+#include "ffitest.h"
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static void
+test_fn (ffi_cif* cif __UNUSED__, void* resp,
+ void** args, void* userdata __UNUSED__)
+{
+ int n = *(int*)args[0];
+ struct small_tag s1 = * (struct small_tag *) args[1];
+ struct large_tag l1 = * (struct large_tag *) args[2];
+ struct small_tag s2 = * (struct small_tag *) args[3];
+
+ printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b,
+ l1.a, l1.b, l1.c, l1.d, l1.e,
+ s2.a, s2.b);
+ * (int*) resp = 42;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
+ ffi_type* arg_types[5];
+
+ ffi_arg res = 0;
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int si;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint,
+ arg_types) == FFI_OK);
+
+ si = 4;
+ s1.a = 5;
+ s1.b = 6;
+
+ s2.a = 20;
+ s2.b = 21;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK);
+
+ res = ((int (*)(int, ...))(code))(si, s1, l1, s2);
+ /* { dg-output "4 5 6 10 11 12 13 14 20 21" } */
+ printf("res: %d\n", (int) res);
+ /* { dg-output "\nres: 42" } */
+
+ exit(0);
+}
diff --git a/testsuite/libffi.call/cls_uchar_va.c b/testsuite/libffi.call/cls_uchar_va.c
new file mode 100644
index 0000000..6491c5b
--- /dev/null
+++ b/testsuite/libffi.call/cls_uchar_va.c
@@ -0,0 +1,44 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned char argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef unsigned char T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(ffi_arg *)resp = *(T *)args[0];
+
+ printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_uchar;
+ cl_arg_types[1] = &ffi_type_uchar;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_uchar, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %d\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/testsuite/libffi.call/cls_uint_va.c b/testsuite/libffi.call/cls_uint_va.c
new file mode 100644
index 0000000..150fddd
--- /dev/null
+++ b/testsuite/libffi.call/cls_uint_va.c
@@ -0,0 +1,45 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned int argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+
+#include "ffitest.h"
+
+typedef unsigned int T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(T *)resp = *(T *)args[0];
+
+ printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_uint;
+ cl_arg_types[1] = &ffi_type_uint;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_uint, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %d\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/testsuite/libffi.call/cls_ulong_va.c b/testsuite/libffi.call/cls_ulong_va.c
new file mode 100644
index 0000000..0315082
--- /dev/null
+++ b/testsuite/libffi.call/cls_ulong_va.c
@@ -0,0 +1,45 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned long argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+
+#include "ffitest.h"
+
+typedef unsigned long T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(T *)resp = *(T *)args[0];
+
+ printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_ulong;
+ cl_arg_types[1] = &ffi_type_ulong;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_ulong, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %ld\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/testsuite/libffi.call/cls_ulonglong.c b/testsuite/libffi.call/cls_ulonglong.c
index 235ab44..62f2cae 100644
--- a/testsuite/libffi.call/cls_ulonglong.c
+++ b/testsuite/libffi.call/cls_ulonglong.c
@@ -11,7 +11,7 @@
static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp,
void** args, void* userdata __UNUSED__)
{
- *(unsigned long long *)resp= *(unsigned long long *)args[0];
+ *(unsigned long long *)resp= 0xfffffffffffffffLL ^ *(unsigned long long *)args[0];
printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0],
*(unsigned long long *)(resp));
@@ -34,14 +34,14 @@ int main (void)
&ffi_type_uint64, cl_arg_types) == FFI_OK);
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" } */
+ /* { dg-output "214: 1152921504606846761" } */
printf("res: %" PRIdLL "\n", res);
- /* { dg-output "\nres: 214" } */
+ /* { dg-output "\nres: 1152921504606846761" } */
res = (*((cls_ret_ulonglong)code))(9223372035854775808LL);
- /* { dg-output "\n9223372035854775808: 9223372035854775808" } */
+ /* { dg-output "\n9223372035854775808: 8070450533247928831" } */
printf("res: %" PRIdLL "\n", res);
- /* { dg-output "\nres: 9223372035854775808" } */
+ /* { dg-output "\nres: 8070450533247928831" } */
exit(0);
}
diff --git a/testsuite/libffi.call/cls_ushort_va.c b/testsuite/libffi.call/cls_ushort_va.c
new file mode 100644
index 0000000..37aa106
--- /dev/null
+++ b/testsuite/libffi.call/cls_ushort_va.c
@@ -0,0 +1,44 @@
+/* Area: closure_call
+ Purpose: Test anonymous unsigned short argument.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef unsigned short T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+ void* userdata __UNUSED__)
+ {
+ *(ffi_arg *)resp = *(T *)args[0];
+
+ printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+ ffi_cif cif;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+ ffi_type * cl_arg_types[3];
+ T res;
+
+ cl_arg_types[0] = &ffi_type_ushort;
+ cl_arg_types[1] = &ffi_type_ushort;
+ cl_arg_types[2] = NULL;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+ &ffi_type_ushort, cl_arg_types) == FFI_OK);
+
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_T)code)(67, 4)));
+ /* { dg-output "67: 67 4" } */
+ printf("res: %d\n", res);
+ /* { dg-output "\nres: 67" } */
+ exit(0);
+}
diff --git a/testsuite/libffi.call/err_bad_typedef.c b/testsuite/libffi.call/err_bad_typedef.c
index 2539273..bf60161 100644
--- a/testsuite/libffi.call/err_bad_typedef.c
+++ b/testsuite/libffi.call/err_bad_typedef.c
@@ -13,10 +13,10 @@ int main (void)
ffi_cif cif;
ffi_type* arg_types[1];
- arg_types[0] = NULL;
-
ffi_type badType = ffi_type_void;
+ arg_types[0] = NULL;
+
badType.size = 0;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType,
diff --git a/testsuite/libffi.call/fastthis1_win32.c b/testsuite/libffi.call/fastthis1_win32.c
index b3c4c73..cbc4724 100644
--- a/testsuite/libffi.call/fastthis1_win32.c
+++ b/testsuite/libffi.call/fastthis1_win32.c
@@ -8,7 +8,7 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_f(char *s, float a)
+static size_t __FASTCALL__ my_fastcall_f(char *s, float a)
{
return (size_t) ((int) strlen(s) + (int) a);
}
diff --git a/testsuite/libffi.call/fastthis2_win32.c b/testsuite/libffi.call/fastthis2_win32.c
index f148a12..7bdd0e1 100644
--- a/testsuite/libffi.call/fastthis2_win32.c
+++ b/testsuite/libffi.call/fastthis2_win32.c
@@ -8,7 +8,7 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_f(float a, char *s)
+static size_t __FASTCALL__ my_fastcall_f(float a, char *s)
{
return (size_t) ((int) strlen(s) + (int) a);
}
diff --git a/testsuite/libffi.call/fastthis3_win32.c b/testsuite/libffi.call/fastthis3_win32.c
index 5cf82bb..b5d606d 100644
--- a/testsuite/libffi.call/fastthis3_win32.c
+++ b/testsuite/libffi.call/fastthis3_win32.c
@@ -8,7 +8,7 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_f(float a, char *s, int i)
+static size_t __FASTCALL__ my_fastcall_f(float a, char *s, int i)
{
return (size_t) ((int) strlen(s) + (int) a + i);
}
diff --git a/testsuite/libffi.call/ffitest.h b/testsuite/libffi.call/ffitest.h
index 0e95e16..136a7a6 100644
--- a/testsuite/libffi.call/ffitest.h
+++ b/testsuite/libffi.call/ffitest.h
@@ -15,7 +15,7 @@
#define MAX_ARGS 256
-#define CHECK(x) !(x) ? abort() : 0
+#define CHECK(x) !(x) ? (abort(), 1) : 0
/* Define __UNUSED__ that also other compilers than gcc can run the tests. */
#undef __UNUSED__
@@ -25,6 +25,14 @@
#define __UNUSED__
#endif
+/* Define __FASTCALL__ so that other compilers than gcc can run the tests. */
+#undef __FASTCALL__
+#if defined _MSC_VER
+#define __FASTCALL__ __fastcall
+#else
+#define __FASTCALL__ __attribute__((fastcall))
+#endif
+
/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a
file open. */
#ifdef HAVE_MMAP_ANON
@@ -110,44 +118,15 @@
#endif
#endif
-#ifdef USING_MMAP
-static inline void *
-allocate_mmap (size_t size)
-{
- void *page;
-#if defined (HAVE_MMAP_DEV_ZERO)
- static int dev_zero_fd = -1;
-#endif
-
-#ifdef HAVE_MMAP_DEV_ZERO
- if (dev_zero_fd == -1)
- {
- dev_zero_fd = open ("/dev/zero", O_RDONLY);
- if (dev_zero_fd == -1)
- {
- perror ("open /dev/zero: %m");
- exit (1);
- }
- }
-#endif
-
-
-#ifdef HAVE_MMAP_ANON
- page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-#endif
-#ifdef HAVE_MMAP_DEV_ZERO
- page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE, dev_zero_fd, 0);
+/* MSVC kludge. */
+#if defined _MSC_VER
+#define PRIuPTR "lu"
+#define PRIu8 "u"
+#define PRId8 "d"
+#define PRIu64 "I64u"
+#define PRId64 "I64d"
#endif
- if (page == (void *) MAP_FAILED)
- {
- perror ("virtual memory exhausted");
- exit (1);
- }
-
- return page;
-}
-
+#ifndef PRIuPTR
+#define PRIuPTR "u"
#endif
diff --git a/testsuite/libffi.call/float_va.c b/testsuite/libffi.call/float_va.c
index aae158e..5acff91 100644
--- a/testsuite/libffi.call/float_va.c
+++ b/testsuite/libffi.call/float_va.c
@@ -56,9 +56,9 @@ int main (void)
* different. */
/* Call it statically and then via ffi */
resfp=float_va_fn(0,2.0);
- // { dg-output "0: 2.0 : total: 2.0" }
+ /* { dg-output "0: 2.0 : total: 2.0" } */
printf("compiled: %.1f\n", resfp);
- // { dg-output "\ncompiled: 2.0" }
+ /* { dg-output "\ncompiled: 2.0" } */
arg_types[0] = &ffi_type_uint;
arg_types[1] = &ffi_type_double;
@@ -71,16 +71,16 @@ int main (void)
values[0] = &firstarg;
values[1] = &doubles[0];
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
- // { dg-output "\n0: 2.0 : total: 2.0" }
+ /* { dg-output "\n0: 2.0 : total: 2.0" } */
printf("ffi: %.1f\n", resfp);
- // { dg-output "\nffi: 2.0" }
+ /* { dg-output "\nffi: 2.0" } */
/* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */
/* Call it statically and then via ffi */
resfp=float_va_fn(2,2.0,3.0,4.0);
- // { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" }
+ /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
printf("compiled: %.1f\n", resfp);
- // { dg-output "\ncompiled: 11.0" }
+ /* { dg-output "\ncompiled: 11.0" } */
arg_types[0] = &ffi_type_uint;
arg_types[1] = &ffi_type_double;
@@ -99,9 +99,9 @@ int main (void)
values[2] = &doubles[1];
values[3] = &doubles[2];
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
- // { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" }
+ /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
printf("ffi: %.1f\n", resfp);
- // { dg-output "\nffi: 11.0" }
+ /* { dg-output "\nffi: 11.0" } */
exit(0);
}
diff --git a/testsuite/libffi.call/huge_struct.c b/testsuite/libffi.call/huge_struct.c
index e04e1d5..657fe54 100644
--- a/testsuite/libffi.call/huge_struct.c
+++ b/testsuite/libffi.call/huge_struct.c
@@ -8,6 +8,7 @@
/* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
+/* { dg-options -Wformat=0 { target moxie*-*-elf } } */
/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include "ffitest.h"
@@ -229,6 +230,19 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
ffi_type* st_fields[51];
BigStruct retVal;
+ uint8_t ui8 = 1;
+ int8_t si8 = 2;
+ uint16_t ui16 = 3;
+ int16_t si16 = 4;
+ uint32_t ui32 = 5;
+ int32_t si32 = 6;
+ uint64_t ui64 = 7;
+ int64_t si64 = 8;
+ float f = 9;
+ double d = 10;
+ long double ld = 11;
+ char* p = (char*)0x12345678;
+
memset (&retVal, 0, sizeof(retVal));
ret_struct_type.size = 0;
@@ -251,19 +265,6 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
st_fields[50] = NULL;
- uint8_t ui8 = 1;
- int8_t si8 = 2;
- uint16_t ui16 = 3;
- int16_t si16 = 4;
- uint32_t ui32 = 5;
- int32_t si32 = 6;
- uint64_t ui64 = 7;
- int64_t si64 = 8;
- float f = 9;
- double d = 10;
- long double ld = 11;
- char* p = (char*)0x12345678;
-
argTypes[0] = argTypes[12] = argTypes[24] = argTypes[36] = argTypes[48] = &ffi_type_uint8;
argValues[0] = argValues[12] = argValues[24] = argValues[36] = argValues[48] = &ui8;
argTypes[1] = argTypes[13] = argTypes[25] = argTypes[37] = argTypes[49] = &ffi_type_sint8;
@@ -295,7 +296,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK);
ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues);
- // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
+ /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
@@ -308,7 +309,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj,
retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp,
retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx);
- // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
+ /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK);
@@ -323,7 +324,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8);
- // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
+ /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
@@ -336,7 +337,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj,
retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp,
retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx);
- // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
+ /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
return 0;
}
diff --git a/testsuite/libffi.call/many2.c b/testsuite/libffi.call/many2.c
index 1077159..98eac60 100644
--- a/testsuite/libffi.call/many2.c
+++ b/testsuite/libffi.call/many2.c
@@ -12,7 +12,10 @@
typedef unsigned char u8;
-__attribute__((noinline)) uint8_t
+#ifdef __GNUC__
+__attribute__((noinline))
+#endif
+uint8_t
foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d,
uint8_t e, uint8_t f, uint8_t g)
{
diff --git a/testsuite/libffi.call/negint.c b/testsuite/libffi.call/negint.c
index 3168113..6e2f26f 100644
--- a/testsuite/libffi.call/negint.c
+++ b/testsuite/libffi.call/negint.c
@@ -5,7 +5,6 @@
Originator: From the original ffitest.c */
/* { dg-do run } */
-/* { dg-options -O2 } */
#include "ffitest.h"
diff --git a/testsuite/libffi.call/nested_struct.c b/testsuite/libffi.call/nested_struct.c
index 8aa527e..c15e3a0 100644
--- a/testsuite/libffi.call/nested_struct.c
+++ b/testsuite/libffi.call/nested_struct.c
@@ -77,6 +77,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
+ struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
+ struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
+ {3, 1.0, 8.0}};
+ struct cls_struct_combined res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -92,12 +98,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
- struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
- struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
- {3, 1.0, 8.0}};
- struct cls_struct_combined res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = &ffi_type_sint;
diff --git a/testsuite/libffi.call/nested_struct1.c b/testsuite/libffi.call/nested_struct1.c
index 2a9f515..477a6b9 100644
--- a/testsuite/libffi.call/nested_struct1.c
+++ b/testsuite/libffi.call/nested_struct1.c
@@ -81,6 +81,13 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
+ struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
+ struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
+ {3, 1.0, 8.0}};
+ struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4};
+ struct cls_struct_combined res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -96,13 +103,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6};
- struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0};
- struct cls_struct_combined g_dbl = {{4.0, 5.0, 6},
- {3, 1.0, 8.0}};
- struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4};
- struct cls_struct_combined res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = &ffi_type_sint;
@@ -156,6 +156,6 @@ int main (void)
CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii));
CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd));
CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff));
- // CHECK( 1 == 0);
+ /* CHECK( 1 == 0); */
exit(0);
}
diff --git a/testsuite/libffi.call/nested_struct10.c b/testsuite/libffi.call/nested_struct10.c
index d6a718b..34a74e7 100644
--- a/testsuite/libffi.call/nested_struct10.c
+++ b/testsuite/libffi.call/nested_struct10.c
@@ -67,6 +67,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = { 99, {12LL , 127}, 255};
+ struct C g_dbl = { 2LL, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -82,12 +88,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = { 99, {12LL , 127}, 255};
- struct C g_dbl = { 2LL, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct11.c b/testsuite/libffi.call/nested_struct11.c
new file mode 100644
index 0000000..fce6948
--- /dev/null
+++ b/testsuite/libffi.call/nested_struct11.c
@@ -0,0 +1,121 @@
+/* Area: ffi_call, closure_call
+ Purpose: Check parameter passing with nested structs
+ of a single type. This tests the special cases
+ for homogenous floating-point aggregates in the
+ AArch64 PCS.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef struct A {
+ float a_x;
+ float a_y;
+} A;
+
+typedef struct B {
+ float b_x;
+ float b_y;
+} B;
+
+typedef struct C {
+ A a;
+ B b;
+} C;
+
+static C C_fn (int x, int y, int z, C source, int i, int j, int k)
+{
+ C result;
+ result.a.a_x = source.a.a_x;
+ result.a.a_y = source.a.a_y;
+ result.b.b_x = source.b.b_x;
+ result.b.b_y = source.b.b_y;
+
+ printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k);
+
+ printf ("%.1f, %.1f, %.1f, %.1f, "
+ "%.1f, %.1f, %.1f, %.1f\n",
+ source.a.a_x, source.a.a_y,
+ source.b.b_x, source.b.b_y,
+ result.a.a_x, result.a.a_y,
+ result.b.b_x, result.b.b_y);
+
+ return result;
+}
+
+int main (void)
+{
+ ffi_cif cif;
+
+ ffi_type* struct_fields_source_a[3];
+ ffi_type* struct_fields_source_b[3];
+ ffi_type* struct_fields_source_c[3];
+ ffi_type* arg_types[8];
+
+ ffi_type struct_type_a, struct_type_b, struct_type_c;
+
+ struct A source_fld_a = {1.0, 2.0};
+ struct B source_fld_b = {4.0, 8.0};
+ int k = 1;
+
+ struct C result;
+ struct C source = {source_fld_a, source_fld_b};
+
+ struct_type_a.size = 0;
+ struct_type_a.alignment = 0;
+ struct_type_a.type = FFI_TYPE_STRUCT;
+ struct_type_a.elements = struct_fields_source_a;
+
+ struct_type_b.size = 0;
+ struct_type_b.alignment = 0;
+ struct_type_b.type = FFI_TYPE_STRUCT;
+ struct_type_b.elements = struct_fields_source_b;
+
+ struct_type_c.size = 0;
+ struct_type_c.alignment = 0;
+ struct_type_c.type = FFI_TYPE_STRUCT;
+ struct_type_c.elements = struct_fields_source_c;
+
+ struct_fields_source_a[0] = &ffi_type_float;
+ struct_fields_source_a[1] = &ffi_type_float;
+ struct_fields_source_a[2] = NULL;
+
+ struct_fields_source_b[0] = &ffi_type_float;
+ struct_fields_source_b[1] = &ffi_type_float;
+ struct_fields_source_b[2] = NULL;
+
+ struct_fields_source_c[0] = &struct_type_a;
+ struct_fields_source_c[1] = &struct_type_b;
+ struct_fields_source_c[2] = NULL;
+
+ arg_types[0] = &ffi_type_sint32;
+ arg_types[1] = &ffi_type_sint32;
+ arg_types[2] = &ffi_type_sint32;
+ arg_types[3] = &struct_type_c;
+ arg_types[4] = &ffi_type_sint32;
+ arg_types[5] = &ffi_type_sint32;
+ arg_types[6] = &ffi_type_sint32;
+ arg_types[7] = NULL;
+
+ void *args[7];
+ args[0] = &k;
+ args[1] = &k;
+ args[2] = &k;
+ args[3] = &source;
+ args[4] = &k;
+ args[5] = &k;
+ args[6] = &k;
+ CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c,
+ arg_types) == FFI_OK);
+
+ ffi_call (&cif, FFI_FN (C_fn), &result, args);
+ /* { dg-output "1, 1, 1, 1, 1, 1\n" } */
+ /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */
+ CHECK (result.a.a_x == source.a.a_x);
+ CHECK (result.a.a_y == source.a.a_y);
+ CHECK (result.b.b_x == source.b.b_x);
+ CHECK (result.b.b_y == source.b.b_y);
+ exit (0);
+}
diff --git a/testsuite/libffi.call/nested_struct2.c b/testsuite/libffi.call/nested_struct2.c
index de1584c..69268cd 100644
--- a/testsuite/libffi.call/nested_struct2.c
+++ b/testsuite/libffi.call/nested_struct2.c
@@ -57,6 +57,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1, 7};
+ struct B f_dbl = {{12 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -67,11 +72,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1, 7};
- struct B f_dbl = {{12 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_ulong;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct3.c b/testsuite/libffi.call/nested_struct3.c
index 58aa853..ab18cad 100644
--- a/testsuite/libffi.call/nested_struct3.c
+++ b/testsuite/libffi.call/nested_struct3.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = {{12LL , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = {{12LL , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct4.c b/testsuite/libffi.call/nested_struct4.c
index 98e491e..2ffb4d6 100644
--- a/testsuite/libffi.call/nested_struct4.c
+++ b/testsuite/libffi.call/nested_struct4.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1.0, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1.0, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct5.c b/testsuite/libffi.call/nested_struct5.c
index d8e3537..6c79845 100644
--- a/testsuite/libffi.call/nested_struct5.c
+++ b/testsuite/libffi.call/nested_struct5.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1.0, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1.0, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_longdouble;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct6.c b/testsuite/libffi.call/nested_struct6.c
index 2f2b25a..59d3579 100644
--- a/testsuite/libffi.call/nested_struct6.c
+++ b/testsuite/libffi.call/nested_struct6.c
@@ -66,6 +66,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1.0, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+ struct C g_dbl = { 2, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -81,12 +87,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1.0, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
- struct C g_dbl = { 2, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct7.c b/testsuite/libffi.call/nested_struct7.c
index 14c7023..27595e6 100644
--- a/testsuite/libffi.call/nested_struct7.c
+++ b/testsuite/libffi.call/nested_struct7.c
@@ -58,6 +58,11 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = {{12.0 , 127}, 99};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -68,11 +73,6 @@ int main (void)
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = {{12.0 , 127}, 99};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct8.c b/testsuite/libffi.call/nested_struct8.c
index bb77ead..0e6c682 100644
--- a/testsuite/libffi.call/nested_struct8.c
+++ b/testsuite/libffi.call/nested_struct8.c
@@ -66,6 +66,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1LL, 7};
+ struct B f_dbl = {{12LL , 127}, 99};
+ struct C g_dbl = { 2LL, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -81,12 +87,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1LL, 7};
- struct B f_dbl = {{12LL , 127}, 99};
- struct C g_dbl = { 2LL, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/nested_struct9.c b/testsuite/libffi.call/nested_struct9.c
index e9f541c..5f7ac67 100644
--- a/testsuite/libffi.call/nested_struct9.c
+++ b/testsuite/libffi.call/nested_struct9.c
@@ -66,6 +66,12 @@ int main (void)
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
+ struct A e_dbl = { 1, 7LL};
+ struct B f_dbl = {{12.0 , 127}, 99};
+ struct C g_dbl = { 2, 9};
+
+ struct B res_dbl;
+
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -81,12 +87,6 @@ int main (void)
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
- struct A e_dbl = { 1, 7LL};
- struct B f_dbl = {{12.0 , 127}, 99};
- struct C g_dbl = { 2, 9};
-
- struct B res_dbl;
-
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uint64;
cls_struct_fields[2] = NULL;
diff --git a/testsuite/libffi.call/return_dbl.c b/testsuite/libffi.call/return_dbl.c
index 1aab403..fd07e50 100644
--- a/testsuite/libffi.call/return_dbl.c
+++ b/testsuite/libffi.call/return_dbl.c
@@ -9,6 +9,7 @@
static double return_dbl(double dbl)
{
+ printf ("%f\n", dbl);
return 2 * dbl;
}
int main (void)
diff --git a/testsuite/libffi.call/return_uc.c b/testsuite/libffi.call/return_uc.c
index 07c45de..6fe5546 100644
--- a/testsuite/libffi.call/return_uc.c
+++ b/testsuite/libffi.call/return_uc.c
@@ -32,7 +32,7 @@ int main (void)
uc < (unsigned char) '\xff'; uc++)
{
ffi_call(&cif, FFI_FN(return_uc), &rint, values);
- CHECK(rint == (signed int) uc);
+ CHECK((unsigned char)rint == uc);
}
exit(0);
}
diff --git a/testsuite/libffi.call/stret_large.c b/testsuite/libffi.call/stret_large.c
index 23a93b9..71c2469 100644
--- a/testsuite/libffi.call/stret_large.c
+++ b/testsuite/libffi.call/stret_large.c
@@ -9,8 +9,8 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
#include "ffitest.h"
-// 13 FPRs: 104 bytes
-// 14 FPRs: 112 bytes
+/* 13 FPRs: 104 bytes */
+/* 14 FPRs: 112 bytes */
typedef struct struct_108byte {
double a;
@@ -82,17 +82,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 };
struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 };
struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 };
struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 };
struct_108byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/testsuite/libffi.call/stret_large2.c b/testsuite/libffi.call/stret_large2.c
index e2599d2..d9c750e 100644
--- a/testsuite/libffi.call/stret_large2.c
+++ b/testsuite/libffi.call/stret_large2.c
@@ -9,8 +9,8 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
#include "ffitest.h"
-// 13 FPRs: 104 bytes
-// 14 FPRs: 112 bytes
+/* 13 FPRs: 104 bytes */
+/* 14 FPRs: 112 bytes */
typedef struct struct_116byte {
double a;
@@ -84,17 +84,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 };
struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 };
struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 };
struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 };
struct_116byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/testsuite/libffi.call/stret_medium.c b/testsuite/libffi.call/stret_medium.c
index 1fc6a9e..973ee02 100644
--- a/testsuite/libffi.call/stret_medium.c
+++ b/testsuite/libffi.call/stret_medium.c
@@ -68,17 +68,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 };
struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 };
struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 };
struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 };
struct_72byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/testsuite/libffi.call/stret_medium2.c b/testsuite/libffi.call/stret_medium2.c
index cb2f2fb..84323d1 100644
--- a/testsuite/libffi.call/stret_medium2.c
+++ b/testsuite/libffi.call/stret_medium2.c
@@ -69,17 +69,17 @@ int main (void)
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
- cls_struct_type.size = 0;
- cls_struct_type.alignment = 0;
- cls_struct_type.type = FFI_TYPE_STRUCT;
- cls_struct_type.elements = cls_struct_fields;
-
struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 };
struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 };
struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 };
struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 };
struct_72byte res_dbl;
+ cls_struct_type.size = 0;
+ cls_struct_type.alignment = 0;
+ cls_struct_type.type = FFI_TYPE_STRUCT;
+ cls_struct_type.elements = cls_struct_fields;
+
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
diff --git a/testsuite/libffi.call/strlen2_win32.c b/testsuite/libffi.call/strlen2_win32.c
index ce8520a..0d81061 100644
--- a/testsuite/libffi.call/strlen2_win32.c
+++ b/testsuite/libffi.call/strlen2_win32.c
@@ -8,7 +8,7 @@
#include "ffitest.h"
-static size_t __attribute__((fastcall)) my_fastcall_strlen(char *s)
+static size_t __FASTCALL__ my_fastcall_strlen(char *s)
{
return (strlen(s));
}
diff --git a/testsuite/libffi.call/struct1.c b/testsuite/libffi.call/struct1.c
index ea76c85..bfc23f6 100644
--- a/testsuite/libffi.call/struct1.c
+++ b/testsuite/libffi.call/struct1.c
@@ -30,6 +30,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts1_type;
ffi_type *ts1_type_elements[4];
+
+ test_structure_1 ts1_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_1 *ts1_result =
+ (test_structure_1 *) malloc (sizeof(test_structure_1));
+
ts1_type.size = 0;
ts1_type.alignment = 0;
ts1_type.type = FFI_TYPE_STRUCT;
@@ -39,11 +46,6 @@ int main (void)
ts1_type_elements[2] = &ffi_type_uint;
ts1_type_elements[3] = NULL;
- test_structure_1 ts1_arg;
- /* This is a hack to get a properly aligned result buffer */
- test_structure_1 *ts1_result =
- (test_structure_1 *) malloc (sizeof(test_structure_1));
-
args[0] = &ts1_type;
values[0] = &ts1_arg;
diff --git a/testsuite/libffi.call/struct1_win32.c b/testsuite/libffi.call/struct1_win32.c
index 4a7eb94..b756f5a 100644
--- a/testsuite/libffi.call/struct1_win32.c
+++ b/testsuite/libffi.call/struct1_win32.c
@@ -14,7 +14,7 @@ typedef struct
unsigned int ui;
} test_structure_1;
-static __attribute__ ((fastcall)) test_structure_1 struct1(test_structure_1 ts)
+static test_structure_1 __FASTCALL__ struct1(test_structure_1 ts)
{
ts.uc++;
ts.d--;
@@ -30,6 +30,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts1_type;
ffi_type *ts1_type_elements[4];
+
+ test_structure_1 ts1_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_1 *ts1_result =
+ (test_structure_1 *) malloc (sizeof(test_structure_1));
+
ts1_type.size = 0;
ts1_type.alignment = 0;
ts1_type.type = FFI_TYPE_STRUCT;
@@ -39,11 +46,6 @@ int main (void)
ts1_type_elements[2] = &ffi_type_uint;
ts1_type_elements[3] = NULL;
- test_structure_1 ts1_arg;
- /* This is a hack to get a properly aligned result buffer */
- test_structure_1 *ts1_result =
- (test_structure_1 *) malloc (sizeof(test_structure_1));
-
args[0] = &ts1_type;
values[0] = &ts1_arg;
diff --git a/testsuite/libffi.call/struct2.c b/testsuite/libffi.call/struct2.c
index 14bc9fd..d85385e 100644
--- a/testsuite/libffi.call/struct2.c
+++ b/testsuite/libffi.call/struct2.c
@@ -29,6 +29,11 @@ int main (void)
test_structure_2 ts2_arg;
ffi_type ts2_type;
ffi_type *ts2_type_elements[3];
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_2 *ts2_result =
+ (test_structure_2 *) malloc (sizeof(test_structure_2));
+
ts2_type.size = 0;
ts2_type.alignment = 0;
ts2_type.type = FFI_TYPE_STRUCT;
@@ -37,11 +42,6 @@ int main (void)
ts2_type_elements[1] = &ffi_type_double;
ts2_type_elements[2] = NULL;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_2 *ts2_result =
- (test_structure_2 *) malloc (sizeof(test_structure_2));
-
args[0] = &ts2_type;
values[0] = &ts2_arg;
diff --git a/testsuite/libffi.call/struct2_win32.c b/testsuite/libffi.call/struct2_win32.c
index 2bfbdc5..5d02285 100644
--- a/testsuite/libffi.call/struct2_win32.c
+++ b/testsuite/libffi.call/struct2_win32.c
@@ -13,7 +13,7 @@ typedef struct
double d2;
} test_structure_2;
-static test_structure_2 __attribute__ ((fastcall)) struct2(test_structure_2 ts)
+static test_structure_2 __FASTCALL__ struct2(test_structure_2 ts)
{
ts.d1--;
ts.d2--;
@@ -29,6 +29,11 @@ int main (void)
test_structure_2 ts2_arg;
ffi_type ts2_type;
ffi_type *ts2_type_elements[3];
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_2 *ts2_result =
+ (test_structure_2 *) malloc (sizeof(test_structure_2));
+
ts2_type.size = 0;
ts2_type.alignment = 0;
ts2_type.type = FFI_TYPE_STRUCT;
@@ -37,11 +42,6 @@ int main (void)
ts2_type_elements[1] = &ffi_type_double;
ts2_type_elements[2] = NULL;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_2 *ts2_result =
- (test_structure_2 *) malloc (sizeof(test_structure_2));
-
args[0] = &ts2_type;
values[0] = &ts2_arg;
diff --git a/testsuite/libffi.call/struct3.c b/testsuite/libffi.call/struct3.c
index e0bb09b..de883c2 100644
--- a/testsuite/libffi.call/struct3.c
+++ b/testsuite/libffi.call/struct3.c
@@ -27,6 +27,11 @@ int main (void)
int compare_value;
ffi_type ts3_type;
ffi_type *ts3_type_elements[2];
+
+ test_structure_3 ts3_arg;
+ test_structure_3 *ts3_result =
+ (test_structure_3 *) malloc (sizeof(test_structure_3));
+
ts3_type.size = 0;
ts3_type.alignment = 0;
ts3_type.type = FFI_TYPE_STRUCT;
@@ -34,10 +39,6 @@ int main (void)
ts3_type_elements[0] = &ffi_type_sint;
ts3_type_elements[1] = NULL;
- test_structure_3 ts3_arg;
- test_structure_3 *ts3_result =
- (test_structure_3 *) malloc (sizeof(test_structure_3));
-
args[0] = &ts3_type;
values[0] = &ts3_arg;
diff --git a/testsuite/libffi.call/struct4.c b/testsuite/libffi.call/struct4.c
index 0ad0a83..48e0349 100644
--- a/testsuite/libffi.call/struct4.c
+++ b/testsuite/libffi.call/struct4.c
@@ -28,21 +28,22 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts4_type;
ffi_type *ts4_type_elements[4];
+
+ test_structure_4 ts4_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_4 *ts4_result =
+ (test_structure_4 *) malloc (sizeof(test_structure_4));
+
ts4_type.size = 0;
ts4_type.alignment = 0;
ts4_type.type = FFI_TYPE_STRUCT;
- test_structure_4 ts4_arg;
ts4_type.elements = ts4_type_elements;
ts4_type_elements[0] = &ffi_type_uint;
ts4_type_elements[1] = &ffi_type_uint;
ts4_type_elements[2] = &ffi_type_uint;
ts4_type_elements[3] = NULL;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_4 *ts4_result =
- (test_structure_4 *) malloc (sizeof(test_structure_4));
-
args[0] = &ts4_type;
values[0] = &ts4_arg;
diff --git a/testsuite/libffi.call/struct5.c b/testsuite/libffi.call/struct5.c
index c03cc97..28b1f0c 100644
--- a/testsuite/libffi.call/struct5.c
+++ b/testsuite/libffi.call/struct5.c
@@ -27,6 +27,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts5_type;
ffi_type *ts5_type_elements[3];
+
+ test_structure_5 ts5_arg1, ts5_arg2;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_5 *ts5_result =
+ (test_structure_5 *) malloc (sizeof(test_structure_5));
+
ts5_type.size = 0;
ts5_type.alignment = 0;
ts5_type.type = FFI_TYPE_STRUCT;
@@ -35,12 +42,6 @@ int main (void)
ts5_type_elements[1] = &ffi_type_schar;
ts5_type_elements[2] = NULL;
- test_structure_5 ts5_arg1, ts5_arg2;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_5 *ts5_result =
- (test_structure_5 *) malloc (sizeof(test_structure_5));
-
args[0] = &ts5_type;
args[1] = &ts5_type;
values[0] = &ts5_arg1;
diff --git a/testsuite/libffi.call/struct6.c b/testsuite/libffi.call/struct6.c
index 83db9af..0e26746 100644
--- a/testsuite/libffi.call/struct6.c
+++ b/testsuite/libffi.call/struct6.c
@@ -27,6 +27,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts6_type;
ffi_type *ts6_type_elements[3];
+
+ test_structure_6 ts6_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_6 *ts6_result =
+ (test_structure_6 *) malloc (sizeof(test_structure_6));
+
ts6_type.size = 0;
ts6_type.alignment = 0;
ts6_type.type = FFI_TYPE_STRUCT;
@@ -35,13 +42,6 @@ int main (void)
ts6_type_elements[1] = &ffi_type_double;
ts6_type_elements[2] = NULL;
-
- test_structure_6 ts6_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_6 *ts6_result =
- (test_structure_6 *) malloc (sizeof(test_structure_6));
-
args[0] = &ts6_type;
values[0] = &ts6_arg;
diff --git a/testsuite/libffi.call/struct7.c b/testsuite/libffi.call/struct7.c
index 58aac4c..8f2bbfd 100644
--- a/testsuite/libffi.call/struct7.c
+++ b/testsuite/libffi.call/struct7.c
@@ -29,6 +29,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts7_type;
ffi_type *ts7_type_elements[4];
+
+ test_structure_7 ts7_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_7 *ts7_result =
+ (test_structure_7 *) malloc (sizeof(test_structure_7));
+
ts7_type.size = 0;
ts7_type.alignment = 0;
ts7_type.type = FFI_TYPE_STRUCT;
@@ -38,13 +45,6 @@ int main (void)
ts7_type_elements[2] = &ffi_type_double;
ts7_type_elements[3] = NULL;
-
- test_structure_7 ts7_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_7 *ts7_result =
- (test_structure_7 *) malloc (sizeof(test_structure_7));
-
args[0] = &ts7_type;
values[0] = &ts7_arg;
diff --git a/testsuite/libffi.call/struct8.c b/testsuite/libffi.call/struct8.c
index c773ac7..266e1f0 100644
--- a/testsuite/libffi.call/struct8.c
+++ b/testsuite/libffi.call/struct8.c
@@ -31,6 +31,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts8_type;
ffi_type *ts8_type_elements[5];
+
+ test_structure_8 ts8_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_8 *ts8_result =
+ (test_structure_8 *) malloc (sizeof(test_structure_8));
+
ts8_type.size = 0;
ts8_type.alignment = 0;
ts8_type.type = FFI_TYPE_STRUCT;
@@ -41,12 +48,6 @@ int main (void)
ts8_type_elements[3] = &ffi_type_float;
ts8_type_elements[4] = NULL;
- test_structure_8 ts8_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_8 *ts8_result =
- (test_structure_8 *) malloc (sizeof(test_structure_8));
-
args[0] = &ts8_type;
values[0] = &ts8_arg;
diff --git a/testsuite/libffi.call/struct9.c b/testsuite/libffi.call/struct9.c
index f30091f..efeb716 100644
--- a/testsuite/libffi.call/struct9.c
+++ b/testsuite/libffi.call/struct9.c
@@ -28,6 +28,13 @@ int main (void)
void *values[MAX_ARGS];
ffi_type ts9_type;
ffi_type *ts9_type_elements[3];
+
+ test_structure_9 ts9_arg;
+
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_9 *ts9_result =
+ (test_structure_9 *) malloc (sizeof(test_structure_9));
+
ts9_type.size = 0;
ts9_type.alignment = 0;
ts9_type.type = FFI_TYPE_STRUCT;
@@ -36,12 +43,6 @@ int main (void)
ts9_type_elements[1] = &ffi_type_sint;
ts9_type_elements[2] = NULL;
- test_structure_9 ts9_arg;
-
- /* This is a hack to get a properly aligned result buffer */
- test_structure_9 *ts9_result =
- (test_structure_9 *) malloc (sizeof(test_structure_9));
-
args[0] = &ts9_type;
values[0] = &ts9_arg;
diff --git a/testsuite/libffi.call/testclosure.c b/testsuite/libffi.call/testclosure.c
index 161cc89..ca31056 100644
--- a/testsuite/libffi.call/testclosure.c
+++ b/testsuite/libffi.call/testclosure.c
@@ -43,13 +43,13 @@ int main (void)
ffi_type cls_struct_type0;
ffi_type* dbl_arg_types[5];
+ struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0};
+
cls_struct_type0.size = 0;
cls_struct_type0.alignment = 0;
cls_struct_type0.type = FFI_TYPE_STRUCT;
cls_struct_type0.elements = cls_struct_fields0;
- struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0};
-
cls_struct_fields0[0] = &ffi_type_float;
cls_struct_fields0[1] = &ffi_type_float;
cls_struct_fields0[2] = &ffi_type_float;
diff --git a/testsuite/libffi.call/uninitialized.c b/testsuite/libffi.call/uninitialized.c
new file mode 100644
index 0000000..f00d830
--- /dev/null
+++ b/testsuite/libffi.call/uninitialized.c
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef struct
+{
+ unsigned char uc;
+ double d;
+ unsigned int ui;
+} test_structure_1;
+
+static test_structure_1 struct1(test_structure_1 ts)
+{
+ ts.uc++;
+ ts.d--;
+ ts.ui++;
+
+ return ts;
+}
+
+int main (void)
+{
+ ffi_cif cif;
+ ffi_type *args[MAX_ARGS];
+ void *values[MAX_ARGS];
+ ffi_type ts1_type;
+ ffi_type *ts1_type_elements[4];
+
+ memset(&cif, 1, sizeof(cif));
+ ts1_type.size = 0;
+ ts1_type.alignment = 0;
+ ts1_type.type = FFI_TYPE_STRUCT;
+ ts1_type.elements = ts1_type_elements;
+ ts1_type_elements[0] = &ffi_type_uchar;
+ ts1_type_elements[1] = &ffi_type_double;
+ ts1_type_elements[2] = &ffi_type_uint;
+ ts1_type_elements[3] = NULL;
+
+ test_structure_1 ts1_arg;
+ /* This is a hack to get a properly aligned result buffer */
+ test_structure_1 *ts1_result =
+ (test_structure_1 *) malloc (sizeof(test_structure_1));
+
+ args[0] = &ts1_type;
+ values[0] = &ts1_arg;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
+ &ts1_type, args) == FFI_OK);
+
+ ts1_arg.uc = '\x01';
+ ts1_arg.d = 3.14159;
+ ts1_arg.ui = 555;
+
+ ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
+
+ CHECK(ts1_result->ui == 556);
+ CHECK(ts1_result->d == 3.14159 - 1);
+
+ free (ts1_result);
+ exit(0);
+}
diff --git a/testsuite/libffi.call/va_1.c b/testsuite/libffi.call/va_1.c
new file mode 100644
index 0000000..cf4dd85
--- /dev/null
+++ b/testsuite/libffi.call/va_1.c
@@ -0,0 +1,196 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static int
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+ unsigned char uc;
+ signed char sc;
+ unsigned short us;
+ signed short ss;
+ unsigned int ui;
+ signed int si;
+ unsigned long ul;
+ signed long sl;
+ float f;
+ double d;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+
+ uc = va_arg (ap, unsigned);
+ sc = va_arg (ap, signed);
+
+ us = va_arg (ap, unsigned);
+ ss = va_arg (ap, signed);
+
+ ui = va_arg (ap, unsigned int);
+ si = va_arg (ap, signed int);
+
+ ul = va_arg (ap, unsigned long);
+ sl = va_arg (ap, signed long);
+
+ f = va_arg (ap, double); /* C standard promotes float->double
+ when anonymous */
+ d = va_arg (ap, double);
+
+ printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n",
+ s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b,
+ uc, sc,
+ us, ss,
+ ui, si,
+ ul, sl,
+ f, d);
+ va_end (ap);
+ return n + 1;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[15];
+ ffi_type* arg_types[15];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ int res;
+
+ unsigned char uc;
+ signed char sc;
+ unsigned short us;
+ signed short ss;
+ unsigned int ui;
+ signed int si;
+ unsigned long ul;
+ signed long sl;
+ double d1;
+ double f1;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = &ffi_type_uchar;
+ arg_types[5] = &ffi_type_schar;
+ arg_types[6] = &ffi_type_ushort;
+ arg_types[7] = &ffi_type_sshort;
+ arg_types[8] = &ffi_type_uint;
+ arg_types[9] = &ffi_type_sint;
+ arg_types[10] = &ffi_type_ulong;
+ arg_types[11] = &ffi_type_slong;
+ arg_types[12] = &ffi_type_double;
+ arg_types[13] = &ffi_type_double;
+ arg_types[14] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ uc = 9;
+ sc = 10;
+ us = 11;
+ ss = 12;
+ ui = 13;
+ si = 14;
+ ul = 15;
+ sl = 16;
+ f1 = 2.12;
+ d1 = 3.13;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = &uc;
+ args[5] = &sc;
+ args[6] = &us;
+ args[7] = &ss;
+ args[8] = &ui;
+ args[9] = &si;
+ args[10] = &ul;
+ args[11] = &sl;
+ args[12] = &f1;
+ args[13] = &d1;
+ args[14] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */
+ printf("res: %d\n", (int) res);
+ /* { dg-output "\nres: 42" } */
+
+ return 0;
+}
diff --git a/testsuite/libffi.call/va_struct1.c b/testsuite/libffi.call/va_struct1.c
new file mode 100644
index 0000000..11d1f10
--- /dev/null
+++ b/testsuite/libffi.call/va_struct1.c
@@ -0,0 +1,121 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static int
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+ printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b);
+ va_end (ap);
+ return n + 1;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[5];
+ ffi_type* arg_types[5];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ int res;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+ printf("res: %d\n", (int) res);
+ /* { dg-output "\nres: 42" } */
+
+ return 0;
+}
diff --git a/testsuite/libffi.call/va_struct2.c b/testsuite/libffi.call/va_struct2.c
new file mode 100644
index 0000000..56f5b9c
--- /dev/null
+++ b/testsuite/libffi.call/va_struct2.c
@@ -0,0 +1,123 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static struct small_tag
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+ printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b);
+ va_end (ap);
+ s1.a += s2.a;
+ s1.b += s2.b;
+ return s1;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[5];
+ ffi_type* arg_types[5];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ struct small_tag res;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+ printf("res: %d %d\n", res.a, res.b);
+ /* { dg-output "\nres: 12 14" } */
+
+ return 0;
+}
diff --git a/testsuite/libffi.call/va_struct3.c b/testsuite/libffi.call/va_struct3.c
new file mode 100644
index 0000000..9a27e7f
--- /dev/null
+++ b/testsuite/libffi.call/va_struct3.c
@@ -0,0 +1,125 @@
+/* Area: ffi_call
+ Purpose: Test passing struct in variable argument lists.
+ Limitations: none.
+ PR: none.
+ Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+ unsigned char a;
+ unsigned char b;
+};
+
+struct large_tag
+{
+ unsigned a;
+ unsigned b;
+ unsigned c;
+ unsigned d;
+ unsigned e;
+};
+
+static struct large_tag
+test_fn (int n, ...)
+{
+ va_list ap;
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l;
+
+ va_start (ap, n);
+ s1 = va_arg (ap, struct small_tag);
+ l = va_arg (ap, struct large_tag);
+ s2 = va_arg (ap, struct small_tag);
+ printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+ s2.a, s2.b);
+ va_end (ap);
+ l.a += s1.a;
+ l.b += s1.b;
+ l.c += s2.a;
+ l.d += s2.b;
+ return l;
+}
+
+int
+main (void)
+{
+ ffi_cif cif;
+ void* args[5];
+ ffi_type* arg_types[5];
+
+ ffi_type s_type;
+ ffi_type *s_type_elements[3];
+
+ ffi_type l_type;
+ ffi_type *l_type_elements[6];
+
+ struct small_tag s1;
+ struct small_tag s2;
+ struct large_tag l1;
+
+ int n;
+ struct large_tag res;
+
+ s_type.size = 0;
+ s_type.alignment = 0;
+ s_type.type = FFI_TYPE_STRUCT;
+ s_type.elements = s_type_elements;
+
+ s_type_elements[0] = &ffi_type_uchar;
+ s_type_elements[1] = &ffi_type_uchar;
+ s_type_elements[2] = NULL;
+
+ l_type.size = 0;
+ l_type.alignment = 0;
+ l_type.type = FFI_TYPE_STRUCT;
+ l_type.elements = l_type_elements;
+
+ l_type_elements[0] = &ffi_type_uint;
+ l_type_elements[1] = &ffi_type_uint;
+ l_type_elements[2] = &ffi_type_uint;
+ l_type_elements[3] = &ffi_type_uint;
+ l_type_elements[4] = &ffi_type_uint;
+ l_type_elements[5] = NULL;
+
+ arg_types[0] = &ffi_type_sint;
+ arg_types[1] = &s_type;
+ arg_types[2] = &l_type;
+ arg_types[3] = &s_type;
+ arg_types[4] = NULL;
+
+ CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK);
+
+ s1.a = 5;
+ s1.b = 6;
+
+ l1.a = 10;
+ l1.b = 11;
+ l1.c = 12;
+ l1.d = 13;
+ l1.e = 14;
+
+ s2.a = 7;
+ s2.b = 8;
+
+ n = 41;
+
+ args[0] = &n;
+ args[1] = &s1;
+ args[2] = &l1;
+ args[3] = &s2;
+ args[4] = NULL;
+
+ ffi_call(&cif, FFI_FN(test_fn), &res, args);
+ /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+ printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e);
+ /* { dg-output "\nres: 15 17 19 21 14" } */
+
+ return 0;
+}
diff --git a/testsuite/libffi.special/ffitestcxx.h b/testsuite/libffi.special/ffitestcxx.h
index 83f5442..c6da7ef 100644
--- a/testsuite/libffi.special/ffitestcxx.h
+++ b/testsuite/libffi.special/ffitestcxx.h
@@ -53,44 +53,3 @@
#define PRIuLL "llu"
#endif
-#ifdef USING_MMAP
-static inline void *
-allocate_mmap (size_t size)
-{
- void *page;
-#if defined (HAVE_MMAP_DEV_ZERO)
- static int dev_zero_fd = -1;
-#endif
-
-#ifdef HAVE_MMAP_DEV_ZERO
- if (dev_zero_fd == -1)
- {
- dev_zero_fd = open ("/dev/zero", O_RDONLY);
- if (dev_zero_fd == -1)
- {
- perror ("open /dev/zero: %m");
- exit (1);
- }
- }
-#endif
-
-
-#ifdef HAVE_MMAP_ANON
- page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-#endif
-#ifdef HAVE_MMAP_DEV_ZERO
- page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE, dev_zero_fd, 0);
-#endif
-
- if (page == (char *) MAP_FAILED)
- {
- perror ("virtual memory exhausted");
- exit (1);
- }
-
- return page;
-}
-
-#endif
diff --git a/testsuite/libffi.special/special.exp b/testsuite/libffi.special/special.exp
index 74671b1..f1a5fa6 100644
--- a/testsuite/libffi.special/special.exp
+++ b/testsuite/libffi.special/special.exp
@@ -23,10 +23,14 @@ global cxx_options
set cxx_options " -shared-libgcc -lstdc++"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os"
+if { [string match $using_gcc "yes"] } {
+
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall"
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2"
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3"
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os"
+
+}
dg-finish
diff --git a/testsuite/libffi.special/unwindtest.cc b/testsuite/libffi.special/unwindtest.cc
index d7ffd4a..a78f4e7 100644
--- a/testsuite/libffi.special/unwindtest.cc
+++ b/testsuite/libffi.special/unwindtest.cc
@@ -5,6 +5,7 @@
Originator: Jeff Sturm <jsturm@one-point.com> */
/* { dg-do run } */
+
#include "ffitestcxx.h"
#if defined HAVE_STDINT_H
diff --git a/testsuite/libffi.special/unwindtest_ffi_call.cc b/testsuite/libffi.special/unwindtest_ffi_call.cc
index 29739cd..57191f2 100644
--- a/testsuite/libffi.special/unwindtest_ffi_call.cc
+++ b/testsuite/libffi.special/unwindtest_ffi_call.cc
@@ -5,6 +5,7 @@
Originator: Andreas Tobler <andreast@gcc.gnu.org> 20061213 */
/* { dg-do run } */
+
#include "ffitestcxx.h"
static int checking(int a __UNUSED__, short b __UNUSED__,