ffi 1.15.5 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +118 -0
- data/Gemfile +10 -3
- data/README.md +4 -3
- data/Rakefile +25 -10
- data/ext/ffi_c/AbstractMemory.c +99 -74
- data/ext/ffi_c/AbstractMemory.h +3 -2
- data/ext/ffi_c/ArrayType.c +51 -15
- data/ext/ffi_c/ArrayType.h +1 -0
- data/ext/ffi_c/Buffer.c +90 -33
- data/ext/ffi_c/Call.c +29 -12
- data/ext/ffi_c/Call.h +3 -2
- data/ext/ffi_c/DynamicLibrary.c +90 -27
- data/ext/ffi_c/Function.c +244 -98
- data/ext/ffi_c/Function.h +1 -0
- data/ext/ffi_c/FunctionInfo.c +81 -25
- data/ext/ffi_c/LastError.c +29 -11
- data/ext/ffi_c/MappedType.c +66 -23
- data/ext/ffi_c/MappedType.h +0 -2
- data/ext/ffi_c/MemoryPointer.c +36 -9
- data/ext/ffi_c/MethodHandle.c +3 -1
- data/ext/ffi_c/Pointer.c +82 -40
- data/ext/ffi_c/Pointer.h +1 -0
- data/ext/ffi_c/Struct.c +166 -84
- data/ext/ffi_c/Struct.h +7 -4
- data/ext/ffi_c/StructByValue.c +48 -16
- data/ext/ffi_c/StructLayout.c +130 -61
- data/ext/ffi_c/Type.c +120 -51
- data/ext/ffi_c/Type.h +3 -1
- data/ext/ffi_c/Types.c +8 -2
- data/ext/ffi_c/Types.h +0 -1
- data/ext/ffi_c/Variadic.c +71 -26
- data/ext/ffi_c/compat.h +22 -22
- data/ext/ffi_c/extconf.rb +19 -2
- data/ext/ffi_c/ffi.c +4 -0
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
- data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
- data/ext/ffi_c/libffi/.appveyor.yml +27 -9
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/build-in-container.sh +4 -6
- data/ext/ffi_c/libffi/.ci/build.sh +124 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/install.sh +14 -7
- data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/site.exp +5 -3
- data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +479 -0
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +172 -0
- data/ext/ffi_c/libffi/.gitignore +10 -2
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/Makefile.am +12 -5
- data/ext/ffi_c/libffi/Makefile.in +118 -51
- data/ext/ffi_c/libffi/README.md +150 -105
- data/ext/ffi_c/libffi/acinclude.m4 +10 -112
- data/ext/ffi_c/libffi/compile +348 -0
- data/ext/ffi_c/libffi/config.guess +623 -556
- data/ext/ffi_c/libffi/config.sub +75 -34
- data/ext/ffi_c/libffi/configure +4571 -3830
- data/ext/ffi_c/libffi/configure.ac +64 -28
- data/ext/ffi_c/libffi/configure.host +26 -7
- data/ext/ffi_c/libffi/doc/Makefile.in +9 -6
- data/ext/ffi_c/libffi/doc/libffi.texi +82 -33
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +12 -47
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +163 -52
- data/ext/ffi_c/libffi/include/Makefile.am +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +10 -9
- data/ext/ffi_c/libffi/include/ffi.h.in +55 -60
- data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +33 -2
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +92 -69
- data/ext/ffi_c/libffi/libffi.map.in +5 -0
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +518 -333
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +18 -14
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -45
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/man/Makefile.in +9 -6
- data/ext/ffi_c/libffi/missing +1 -1
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +2 -2
- data/ext/ffi_c/libffi/msvcc.sh +1 -1
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +172 -55
- data/ext/ffi_c/libffi/src/aarch64/internal.h +32 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +331 -87
- data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
- data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +62 -17
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +3 -3
- data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +113 -42
- data/ext/ffi_c/libffi/src/closures.c +136 -50
- data/ext/ffi_c/libffi/src/debug.c +2 -2
- data/ext/ffi_c/libffi/src/dlmalloc.c +6 -1
- data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
- data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
- data/ext/ffi_c/libffi/src/loongarch64/ffi.c +624 -0
- data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
- data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +31 -14
- data/ext/ffi_c/libffi/src/mips/ffi.c +250 -67
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -0
- data/ext/ffi_c/libffi/src/mips/n32.S +193 -33
- data/ext/ffi_c/libffi/src/mips/o32.S +61 -4
- data/ext/ffi_c/libffi/src/moxie/ffi.c +47 -22
- data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
- data/ext/ffi_c/libffi/src/pa/ffi.c +32 -33
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +22 -8
- data/ext/ffi_c/libffi/src/pa/hpux32.S +83 -36
- data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +82 -35
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1 -1
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +2 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +2 -0
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +22 -2
- data/ext/ffi_c/libffi/src/riscv/ffi.c +37 -4
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +23 -1
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/types.c +4 -6
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +947 -0
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +99 -37
- data/ext/ffi_c/libffi/src/x86/ffi64.c +67 -12
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +9 -5
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +44 -1
- data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +172 -38
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +91 -88
- data/ext/ffi_c/libffi/src/x86/unix64.S +96 -6
- data/ext/ffi_c/libffi/src/x86/win64.S +20 -7
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
- data/ext/ffi_c/libffi/testsuite/Makefile.am +79 -114
- data/ext/ffi_c/libffi/testsuite/Makefile.in +89 -121
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +86 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +43 -21
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +8 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -119
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +3 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +21 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +7 -6
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +6 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +18 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +29 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +21 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +35 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +19 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +18 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +29 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +28 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +24 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +39 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +25 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +14 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +14 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +14 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +20 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +40 -25
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +40 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +18 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +18 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +19 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +3 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +11 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +22 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +5 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +6 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +6 -2
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +5 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +2 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -138
- data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +21 -21
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +32 -9
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +12 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +21 -5
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +10 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +10 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +9 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +9 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +9 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +6 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +2 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +1 -0
- data/ext/ffi_c/libffi.bsd.mk +2 -2
- data/ext/ffi_c/libffi.darwin.mk +2 -2
- data/ext/ffi_c/libffi.gnu.mk +2 -2
- data/ext/ffi_c/rbffi.h +1 -1
- data/ffi.gemspec +3 -3
- data/lib/ffi/autopointer.rb +8 -31
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +2 -2
- data/lib/ffi/dynamic_library.rb +118 -0
- data/lib/ffi/enum.rb +18 -12
- data/lib/ffi/ffi.rb +3 -0
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +72 -88
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +1 -1
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
- data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
- data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
- data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- data/lib/ffi/platform.rb +15 -13
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +6 -5
- data/lib/ffi/struct_layout.rb +3 -3
- data/lib/ffi/struct_layout_builder.rb +9 -9
- data/lib/ffi/types.rb +65 -37
- data/lib/ffi/variadic.rb +19 -8
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +11 -0
- data/samples/qsort_ractor.rb +28 -0
- data/sig/ffi/abstract_memory.rbs +165 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +122 -28
- metadata.gz.sig +1 -0
- data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +0 -14
- data/ext/ffi_c/libffi/.travis/build.sh +0 -142
- data/ext/ffi_c/libffi/.travis.yml +0 -83
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar_va.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort_va.c +0 -44
- /data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/bfin-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/m32r-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/or1k-sim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/powerpc-eabisim.exp +0 -0
- /data/ext/ffi_c/libffi/{.travis → .ci}/wine-sim.exp +0 -0
- /data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
- /data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +0 -0
@@ -44,6 +44,7 @@ closure_test_fn5(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
|
44
44
|
(int)*(unsigned long long *)args[14],
|
45
45
|
*(int *)args[15],
|
46
46
|
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
47
|
+
CHECK((int)*(ffi_arg *)resp == 680);
|
47
48
|
|
48
49
|
}
|
49
50
|
|
@@ -87,6 +88,7 @@ int main (void)
|
|
87
88
|
/* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
|
88
89
|
printf("res: %d\n",res);
|
89
90
|
/* { dg-output "\nres: 680" } */
|
91
|
+
CHECK(res == 680);
|
90
92
|
|
91
93
|
exit(0);
|
92
94
|
}
|
@@ -37,6 +37,7 @@ closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
|
37
37
|
(int)*(int *)args[12], (int)(*(int *)args[13]),
|
38
38
|
(int)(*(double *)args[14]), (int)(*(double *)args[15]),
|
39
39
|
(int)(intptr_t)userdata, (int)*(ffi_arg *)resp);
|
40
|
+
CHECK((int)*(ffi_arg *)resp == 680);
|
40
41
|
|
41
42
|
}
|
42
43
|
|
@@ -86,5 +87,6 @@ int main (void)
|
|
86
87
|
/* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
|
87
88
|
printf("res: %d\n",res);
|
88
89
|
/* { dg-output "\nres: 680" } */
|
90
|
+
CHECK(res == 680);
|
89
91
|
exit(0);
|
90
92
|
}
|
@@ -7,9 +7,6 @@
|
|
7
7
|
Originator: <andreast@gcc.gnu.org> 20030828 */
|
8
8
|
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
/* { dg-do run } */
|
13
10
|
#include "ffitest.h"
|
14
11
|
|
15
12
|
static void
|
@@ -82,8 +79,11 @@ int main (void)
|
|
82
79
|
|
83
80
|
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0,
|
84
81
|
(void *) 3 /* userdata */, codeloc) == FFI_OK);
|
85
|
-
|
86
|
-
|
82
|
+
|
83
|
+
#if !defined(FFI_EXEC_STATIC_TRAMP) && !defined(__EMSCRIPTEN__)
|
84
|
+
/* With static trampolines, the codeloc does not point to closure */
|
85
|
+
CHECK(memcmp(pcl, FFI_CL(codeloc), sizeof(*pcl)) == 0);
|
86
|
+
#endif
|
87
87
|
|
88
88
|
res = (*((closure_loc_test_type0)codeloc))
|
89
89
|
(1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13,
|
@@ -91,5 +91,6 @@ int main (void)
|
|
91
91
|
/* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
|
92
92
|
printf("res: %d\n",res);
|
93
93
|
/* { dg-output "\nres: 680" } */
|
94
|
-
|
94
|
+
CHECK(res == 680);
|
95
|
+
exit(0);
|
95
96
|
}
|
@@ -20,6 +20,11 @@ closure_test(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata)
|
|
20
20
|
(int)(*(int *)args[2]), (int)(*(int *)args[3]),
|
21
21
|
(int)*(ffi_arg *)resp);
|
22
22
|
|
23
|
+
CHECK((int)*(int *)args[0] == 0);
|
24
|
+
CHECK((int)*(int *)args[1] == 1);
|
25
|
+
CHECK((int)*(int *)args[2] == 2);
|
26
|
+
CHECK((int)*(int *)args[3] == 3);
|
27
|
+
CHECK((int)*(ffi_arg *)resp == 9);
|
23
28
|
}
|
24
29
|
|
25
30
|
typedef int (ABI_ATTR *closure_test_type0)(int, int, int, int);
|
@@ -50,6 +55,7 @@ int main (void)
|
|
50
55
|
|
51
56
|
printf("res: %d\n",res);
|
52
57
|
/* { dg-output "\nres: 9" } */
|
58
|
+
CHECK(res == 9);
|
53
59
|
|
54
60
|
exit(0);
|
55
61
|
}
|
@@ -25,6 +25,17 @@ cls_struct_12byte cls_struct_12byte_fn(struct cls_struct_12byte b1,
|
|
25
25
|
printf("%d %d %d %d %d %d: %d %d %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c,
|
26
26
|
result.a, result.b, result.c);
|
27
27
|
|
28
|
+
CHECK(b1.a == 7);
|
29
|
+
CHECK(b1.b == 4);
|
30
|
+
CHECK(b1.c == 9);
|
31
|
+
|
32
|
+
CHECK(b2.a == 1);
|
33
|
+
CHECK(b2.b == 5);
|
34
|
+
CHECK(b2.c == 3);
|
35
|
+
|
36
|
+
CHECK(result.a == 8);
|
37
|
+
CHECK(result.b == 9);
|
38
|
+
CHECK(result.c == 12);
|
28
39
|
return result;
|
29
40
|
}
|
30
41
|
|
@@ -78,6 +89,9 @@ int main (void)
|
|
78
89
|
/* { dg-output "7 4 9 1 5 3: 8 9 12" } */
|
79
90
|
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
80
91
|
/* { dg-output "\nres: 8 9 12" } */
|
92
|
+
CHECK(res_dbl.a == 8);
|
93
|
+
CHECK(res_dbl.b == 9);
|
94
|
+
CHECK(res_dbl.c == 12);
|
81
95
|
|
82
96
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK);
|
83
97
|
|
@@ -87,8 +101,12 @@ int main (void)
|
|
87
101
|
|
88
102
|
res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl);
|
89
103
|
/* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */
|
104
|
+
|
90
105
|
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
91
106
|
/* { dg-output "\nres: 8 9 12" } */
|
107
|
+
CHECK(res_dbl.a == 8);
|
108
|
+
CHECK(res_dbl.b == 9);
|
109
|
+
CHECK(res_dbl.c == 12);
|
92
110
|
|
93
111
|
exit(0);
|
94
112
|
}
|
@@ -26,6 +26,19 @@ cls_struct_16byte cls_struct_16byte_fn(struct cls_struct_16byte b1,
|
|
26
26
|
printf("%d %g %d %d %g %d: %d %g %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c,
|
27
27
|
result.a, result.b, result.c);
|
28
28
|
|
29
|
+
CHECK(b1.a == 7);
|
30
|
+
CHECK(b1.b == 8);
|
31
|
+
CHECK(b1.c == 9);
|
32
|
+
|
33
|
+
CHECK(b2.a == 1);
|
34
|
+
CHECK(b2.b == 9);
|
35
|
+
CHECK(b2.c == 3);
|
36
|
+
|
37
|
+
CHECK(result.a == 8);
|
38
|
+
CHECK(result.b == 17);
|
39
|
+
CHECK(result.c == 12);
|
40
|
+
|
41
|
+
|
29
42
|
return result;
|
30
43
|
}
|
31
44
|
|
@@ -80,6 +93,10 @@ int main (void)
|
|
80
93
|
printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
81
94
|
/* { dg-output "\nres: 8 17 12" } */
|
82
95
|
|
96
|
+
CHECK(res_dbl.a == 8);
|
97
|
+
CHECK(res_dbl.b == 17);
|
98
|
+
CHECK(res_dbl.c == 12);
|
99
|
+
|
83
100
|
res_dbl.a = 0;
|
84
101
|
res_dbl.b = 0.0;
|
85
102
|
res_dbl.c = 0;
|
@@ -91,5 +108,10 @@ int main (void)
|
|
91
108
|
printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
92
109
|
/* { dg-output "\nres: 8 17 12" } */
|
93
110
|
|
111
|
+
CHECK(res_dbl.a == 8);
|
112
|
+
CHECK(res_dbl.b == 17);
|
113
|
+
CHECK(res_dbl.c == 12);
|
114
|
+
|
115
|
+
|
94
116
|
exit(0);
|
95
117
|
}
|
@@ -29,6 +29,22 @@ cls_struct_18byte cls_struct_18byte_fn(struct cls_struct_18byte a1,
|
|
29
29
|
printf("%g %d %d %g %g %d %d %g: %g %d %d %g\n", a1.a, a1.b, a1.c, a1.d,
|
30
30
|
a2.a, a2.b, a2.c, a2.d,
|
31
31
|
result.a, result.b, result.c, result.d);
|
32
|
+
|
33
|
+
CHECK(a1.a == 1);
|
34
|
+
CHECK(a1.b == 127);
|
35
|
+
CHECK(a1.c == 126);
|
36
|
+
CHECK(a1.d == 3);
|
37
|
+
|
38
|
+
CHECK(a2.a == 4);
|
39
|
+
CHECK(a2.b == 125);
|
40
|
+
CHECK(a2.c == 124);
|
41
|
+
CHECK(a2.d == 5);
|
42
|
+
|
43
|
+
CHECK(result.a == 5);
|
44
|
+
CHECK(result.b == 252);
|
45
|
+
CHECK(result.c == 250);
|
46
|
+
CHECK(result.d == 8);
|
47
|
+
|
32
48
|
return result;
|
33
49
|
}
|
34
50
|
|
@@ -84,6 +100,10 @@ int main (void)
|
|
84
100
|
/* { dg-output "1 127 126 3 4 125 124 5: 5 252 250 8" } */
|
85
101
|
printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
|
86
102
|
/* { dg-output "\nres: 5 252 250 8" } */
|
103
|
+
CHECK(res_dbl.a == 5);
|
104
|
+
CHECK(res_dbl.b == 252);
|
105
|
+
CHECK(res_dbl.c == 250);
|
106
|
+
CHECK(res_dbl.d == 8);
|
87
107
|
|
88
108
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK);
|
89
109
|
|
@@ -91,6 +111,10 @@ int main (void)
|
|
91
111
|
/* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */
|
92
112
|
printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
|
93
113
|
/* { dg-output "\nres: 5 252 250 8" } */
|
114
|
+
CHECK(res_dbl.a == 5);
|
115
|
+
CHECK(res_dbl.b == 252);
|
116
|
+
CHECK(res_dbl.c == 250);
|
117
|
+
CHECK(res_dbl.d == 8);
|
94
118
|
|
95
119
|
exit(0);
|
96
120
|
}
|
@@ -32,6 +32,25 @@ cls_struct_19byte cls_struct_19byte_fn(struct cls_struct_19byte a1,
|
|
32
32
|
a1.a, a1.b, a1.c, a1.d, a1.e,
|
33
33
|
a2.a, a2.b, a2.c, a2.d, a2.e,
|
34
34
|
result.a, result.b, result.c, result.d, result.e);
|
35
|
+
|
36
|
+
CHECK(a1.a == 1);
|
37
|
+
CHECK(a1.b == 127);
|
38
|
+
CHECK(a1.c == 126);
|
39
|
+
CHECK(a1.d == 3);
|
40
|
+
CHECK(a1.e == 120);
|
41
|
+
|
42
|
+
CHECK(a2.a == 4);
|
43
|
+
CHECK(a2.b == 125);
|
44
|
+
CHECK(a2.c == 124);
|
45
|
+
CHECK(a2.d == 5);
|
46
|
+
CHECK(a2.e == 119);
|
47
|
+
|
48
|
+
CHECK(result.a == 5);
|
49
|
+
CHECK(result.b == 252);
|
50
|
+
CHECK(result.c == 250);
|
51
|
+
CHECK(result.d == 8);
|
52
|
+
CHECK(result.e == 239);
|
53
|
+
|
35
54
|
return result;
|
36
55
|
}
|
37
56
|
|
@@ -89,6 +108,11 @@ int main (void)
|
|
89
108
|
printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
|
90
109
|
res_dbl.d, res_dbl.e);
|
91
110
|
/* { dg-output "\nres: 5 252 250 8 239" } */
|
111
|
+
CHECK(res_dbl.a == 5);
|
112
|
+
CHECK(res_dbl.b == 252);
|
113
|
+
CHECK(res_dbl.c == 250);
|
114
|
+
CHECK(res_dbl.d == 8);
|
115
|
+
CHECK(res_dbl.e == 239);
|
92
116
|
|
93
117
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK);
|
94
118
|
|
@@ -97,6 +121,11 @@ int main (void)
|
|
97
121
|
printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
|
98
122
|
res_dbl.d, res_dbl.e);
|
99
123
|
/* { dg-output "\nres: 5 252 250 8 239" } */
|
124
|
+
CHECK(res_dbl.a == 5);
|
125
|
+
CHECK(res_dbl.b == 252);
|
126
|
+
CHECK(res_dbl.c == 250);
|
127
|
+
CHECK(res_dbl.d == 8);
|
128
|
+
CHECK(res_dbl.e == 239);
|
100
129
|
|
101
130
|
exit(0);
|
102
131
|
}
|
@@ -23,6 +23,9 @@ cls_struct_1_1byte cls_struct_1_1byte_fn(struct cls_struct_1_1byte a1,
|
|
23
23
|
result.a = a1.a + a2.a;
|
24
24
|
|
25
25
|
printf("%d %d: %d\n", a1.a, a2.a, result.a);
|
26
|
+
CHECK(a1.a == 12);
|
27
|
+
CHECK(a2.a == 178);
|
28
|
+
CHECK(result.a == 190);
|
26
29
|
|
27
30
|
return result;
|
28
31
|
}
|
@@ -84,6 +87,7 @@ int main (void)
|
|
84
87
|
/* { dg-output "\n12 178: 190" } */
|
85
88
|
printf("res: %d\n", res_dbl.a);
|
86
89
|
/* { dg-output "\nres: 190" } */
|
90
|
+
CHECK(res_dbl.a == 190);
|
87
91
|
|
88
92
|
exit(0);
|
89
93
|
}
|
@@ -14,7 +14,7 @@ typedef struct cls_struct_20byte {
|
|
14
14
|
int c;
|
15
15
|
} cls_struct_20byte;
|
16
16
|
|
17
|
-
cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1,
|
17
|
+
static cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1,
|
18
18
|
struct cls_struct_20byte a2)
|
19
19
|
{
|
20
20
|
struct cls_struct_20byte result;
|
@@ -25,6 +25,18 @@ cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1,
|
|
25
25
|
|
26
26
|
printf("%g %g %d %g %g %d: %g %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c,
|
27
27
|
result.a, result.b, result.c);
|
28
|
+
|
29
|
+
CHECK(a1.a == 1);
|
30
|
+
CHECK(a1.b == 2);
|
31
|
+
CHECK(a1.c == 3);
|
32
|
+
|
33
|
+
CHECK(a2.a == 4);
|
34
|
+
CHECK(a2.b == 5);
|
35
|
+
CHECK(a2.c == 7);
|
36
|
+
|
37
|
+
CHECK(result.a == 5);
|
38
|
+
CHECK(result.b == 7);
|
39
|
+
CHECK(result.c == 10);
|
28
40
|
return result;
|
29
41
|
}
|
30
42
|
|
@@ -79,6 +91,9 @@ int main (void)
|
|
79
91
|
/* { dg-output "1 2 3 4 5 7: 5 7 10" } */
|
80
92
|
printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
81
93
|
/* { dg-output "\nres: 5 7 10" } */
|
94
|
+
CHECK(res_dbl.a == 5);
|
95
|
+
CHECK(res_dbl.b == 7);
|
96
|
+
CHECK(res_dbl.c == 10);
|
82
97
|
|
83
98
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK);
|
84
99
|
|
@@ -86,6 +101,9 @@ int main (void)
|
|
86
101
|
/* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */
|
87
102
|
printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
88
103
|
/* { dg-output "\nres: 5 7 10" } */
|
104
|
+
CHECK(res_dbl.a == 5);
|
105
|
+
CHECK(res_dbl.b == 7);
|
106
|
+
CHECK(res_dbl.c == 10);
|
89
107
|
|
90
108
|
exit(0);
|
91
109
|
}
|
@@ -16,7 +16,7 @@ typedef struct cls_struct_20byte {
|
|
16
16
|
double c;
|
17
17
|
} cls_struct_20byte;
|
18
18
|
|
19
|
-
cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1,
|
19
|
+
static cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1,
|
20
20
|
struct cls_struct_20byte a2)
|
21
21
|
{
|
22
22
|
struct cls_struct_20byte result;
|
@@ -27,6 +27,19 @@ cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1,
|
|
27
27
|
|
28
28
|
printf("%d %g %g %d %g %g: %d %g %g\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c,
|
29
29
|
result.a, result.b, result.c);
|
30
|
+
|
31
|
+
CHECK(a1.a == 1);
|
32
|
+
CHECK(a1.b == 2);
|
33
|
+
CHECK(a1.c == 3);
|
34
|
+
|
35
|
+
CHECK(a2.a == 4);
|
36
|
+
CHECK(a2.b == 5);
|
37
|
+
CHECK(a2.c == 7);
|
38
|
+
|
39
|
+
CHECK(result.a == 5);
|
40
|
+
CHECK(result.b == 7);
|
41
|
+
CHECK(result.c == 10);
|
42
|
+
|
30
43
|
return result;
|
31
44
|
}
|
32
45
|
|
@@ -81,6 +94,9 @@ int main (void)
|
|
81
94
|
/* { dg-output "1 2 3 4 5 7: 5 7 10" } */
|
82
95
|
printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
83
96
|
/* { dg-output "\nres: 5 7 10" } */
|
97
|
+
CHECK(res_dbl.a == 5);
|
98
|
+
CHECK(res_dbl.b == 7);
|
99
|
+
CHECK(res_dbl.c == 10);
|
84
100
|
|
85
101
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK);
|
86
102
|
|
@@ -89,5 +105,9 @@ int main (void)
|
|
89
105
|
printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
90
106
|
/* { dg-output "\nres: 5 7 10" } */
|
91
107
|
|
108
|
+
CHECK(res_dbl.a == 5);
|
109
|
+
CHECK(res_dbl.b == 7);
|
110
|
+
CHECK(res_dbl.c == 10);
|
111
|
+
|
92
112
|
exit(0);
|
93
113
|
}
|
@@ -31,8 +31,32 @@ cls_struct_24byte cls_struct_24byte_fn(struct cls_struct_24byte b0,
|
|
31
31
|
b0.a, b0.b, b0.c, b0.d,
|
32
32
|
b1.a, b1.b, b1.c, b1.d,
|
33
33
|
b2.a, b2.b, b2.c, b2.d,
|
34
|
-
b3.a, b3.b, b3.c,
|
34
|
+
b3.a, b3.b, b3.c, b3.d,
|
35
35
|
result.a, result.b, result.c, result.d);
|
36
|
+
CHECK_DOUBLE_EQ(b0.a, 9);
|
37
|
+
CHECK_DOUBLE_EQ(b0.b, 2);
|
38
|
+
CHECK(b0.c == 6);
|
39
|
+
CHECK_FLOAT_EQ(b0.d, 5);
|
40
|
+
|
41
|
+
CHECK_DOUBLE_EQ(b1.a, 1);
|
42
|
+
CHECK_DOUBLE_EQ(b1.b, 2);
|
43
|
+
CHECK(b1.c == 3);
|
44
|
+
CHECK_FLOAT_EQ(b1.d, 7);
|
45
|
+
|
46
|
+
CHECK_DOUBLE_EQ(b2.a, 4);
|
47
|
+
CHECK_DOUBLE_EQ(b2.b, 5);
|
48
|
+
CHECK(b2.c == 7);
|
49
|
+
CHECK_FLOAT_EQ(b2.d, 9);
|
50
|
+
|
51
|
+
CHECK_DOUBLE_EQ(b3.a, 8);
|
52
|
+
CHECK_DOUBLE_EQ(b3.b, 6);
|
53
|
+
CHECK(b3.c == 1);
|
54
|
+
CHECK_FLOAT_EQ(b3.d, 4);
|
55
|
+
|
56
|
+
CHECK_DOUBLE_EQ(result.a, 22);
|
57
|
+
CHECK_DOUBLE_EQ(result.b, 15);
|
58
|
+
CHECK(result.c == 17);
|
59
|
+
CHECK_FLOAT_EQ(result.d, 25);
|
36
60
|
|
37
61
|
return result;
|
38
62
|
}
|
@@ -94,9 +118,13 @@ int main (void)
|
|
94
118
|
args_dbl[4] = NULL;
|
95
119
|
|
96
120
|
ffi_call(&cif, FFI_FN(cls_struct_24byte_fn), &res_dbl, args_dbl);
|
97
|
-
/* { dg-output "9 2 6 5 1 2 3 7 4 5 7 9 8 6 1
|
121
|
+
/* { dg-output "9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 4: 22 15 17 25" } */
|
98
122
|
printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
|
99
123
|
/* { dg-output "\nres: 22 15 17 25" } */
|
124
|
+
CHECK_DOUBLE_EQ(res_dbl.a, 22);
|
125
|
+
CHECK_DOUBLE_EQ(res_dbl.b, 15);
|
126
|
+
CHECK(res_dbl.c == 17);
|
127
|
+
CHECK_FLOAT_EQ(res_dbl.d, 25);
|
100
128
|
|
101
129
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK);
|
102
130
|
|
@@ -105,9 +133,13 @@ int main (void)
|
|
105
133
|
cls_struct_24byte,
|
106
134
|
cls_struct_24byte))
|
107
135
|
(code))(e_dbl, f_dbl, g_dbl, h_dbl);
|
108
|
-
/* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1
|
136
|
+
/* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 4: 22 15 17 25" } */
|
109
137
|
printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
|
110
138
|
/* { dg-output "\nres: 22 15 17 25" } */
|
139
|
+
CHECK_DOUBLE_EQ(res_dbl.a, 22);
|
140
|
+
CHECK_DOUBLE_EQ(res_dbl.b, 15);
|
141
|
+
CHECK(res_dbl.c == 17);
|
142
|
+
CHECK_FLOAT_EQ(res_dbl.d, 25);
|
111
143
|
|
112
144
|
exit(0);
|
113
145
|
}
|
@@ -24,6 +24,15 @@ cls_struct_2byte cls_struct_2byte_fn(struct cls_struct_2byte a1,
|
|
24
24
|
|
25
25
|
printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b);
|
26
26
|
|
27
|
+
CHECK(a1.a == 12);
|
28
|
+
CHECK(a1.b == 127);
|
29
|
+
|
30
|
+
CHECK(a2.a == 1);
|
31
|
+
CHECK(a2.b == 13);
|
32
|
+
|
33
|
+
CHECK(result.a == 13);
|
34
|
+
CHECK(result.b == 140);
|
35
|
+
|
27
36
|
return result;
|
28
37
|
}
|
29
38
|
|
@@ -78,6 +87,8 @@ int main (void)
|
|
78
87
|
/* { dg-output "12 127 1 13: 13 140" } */
|
79
88
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
80
89
|
/* { dg-output "\nres: 13 140" } */
|
90
|
+
CHECK(res_dbl.a == 13);
|
91
|
+
CHECK(res_dbl.b == 140);
|
81
92
|
|
82
93
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK);
|
83
94
|
|
@@ -85,6 +96,8 @@ int main (void)
|
|
85
96
|
/* { dg-output "\n12 127 1 13: 13 140" } */
|
86
97
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
87
98
|
/* { dg-output "\nres: 13 140" } */
|
99
|
+
CHECK(res_dbl.a == 13);
|
100
|
+
CHECK(res_dbl.b == 140);
|
88
101
|
|
89
102
|
exit(0);
|
90
103
|
}
|
@@ -28,6 +28,18 @@ cls_struct_3_1byte cls_struct_3_1byte_fn(struct cls_struct_3_1byte a1,
|
|
28
28
|
a2.a, a2.b, a2.c,
|
29
29
|
result.a, result.b, result.c);
|
30
30
|
|
31
|
+
CHECK(a1.a == 12);
|
32
|
+
CHECK(a1.b == 13);
|
33
|
+
CHECK(a1.c == 14);
|
34
|
+
|
35
|
+
CHECK(a2.a == 178);
|
36
|
+
CHECK(a2.b == 179);
|
37
|
+
CHECK(a2.c == 180);
|
38
|
+
|
39
|
+
CHECK(result.a == 190);
|
40
|
+
CHECK(result.b == 192);
|
41
|
+
CHECK(result.c == 194);
|
42
|
+
|
31
43
|
return result;
|
32
44
|
}
|
33
45
|
|
@@ -83,6 +95,9 @@ int main (void)
|
|
83
95
|
/* { dg-output "12 13 14 178 179 180: 190 192 194" } */
|
84
96
|
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
85
97
|
/* { dg-output "\nres: 190 192 194" } */
|
98
|
+
CHECK(res_dbl.a == 190);
|
99
|
+
CHECK(res_dbl.b == 192);
|
100
|
+
CHECK(res_dbl.c == 194);
|
86
101
|
|
87
102
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK);
|
88
103
|
|
@@ -91,5 +106,9 @@ int main (void)
|
|
91
106
|
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
|
92
107
|
/* { dg-output "\nres: 190 192 194" } */
|
93
108
|
|
109
|
+
CHECK(res_dbl.a == 190);
|
110
|
+
CHECK(res_dbl.b == 192);
|
111
|
+
CHECK(res_dbl.c == 194);
|
112
|
+
|
94
113
|
exit(0);
|
95
114
|
}
|
@@ -24,6 +24,15 @@ cls_struct_3byte cls_struct_3byte_fn(struct cls_struct_3byte a1,
|
|
24
24
|
|
25
25
|
printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b);
|
26
26
|
|
27
|
+
CHECK(a1.a == 12);
|
28
|
+
CHECK(a1.b == 119);
|
29
|
+
|
30
|
+
CHECK(a2.a == 1);
|
31
|
+
CHECK(a2.b == 15);
|
32
|
+
|
33
|
+
CHECK(result.a == 13);
|
34
|
+
CHECK(result.b == 134);
|
35
|
+
|
27
36
|
return result;
|
28
37
|
}
|
29
38
|
|
@@ -78,6 +87,8 @@ int main (void)
|
|
78
87
|
/* { dg-output "12 119 1 15: 13 134" } */
|
79
88
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
80
89
|
/* { dg-output "\nres: 13 134" } */
|
90
|
+
CHECK(res_dbl.a == 13);
|
91
|
+
CHECK(res_dbl.b == 134);
|
81
92
|
|
82
93
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK);
|
83
94
|
|
@@ -85,6 +96,8 @@ int main (void)
|
|
85
96
|
/* { dg-output "\n12 119 1 15: 13 134" } */
|
86
97
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
87
98
|
/* { dg-output "\nres: 13 134" } */
|
99
|
+
CHECK(res_dbl.a == 13);
|
100
|
+
CHECK(res_dbl.b == 134);
|
88
101
|
|
89
102
|
exit(0);
|
90
103
|
}
|
@@ -24,6 +24,15 @@ cls_struct_3byte_1 cls_struct_3byte_fn1(struct cls_struct_3byte_1 a1,
|
|
24
24
|
|
25
25
|
printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b);
|
26
26
|
|
27
|
+
CHECK(a1.a == 15);
|
28
|
+
CHECK(a1.b == 125);
|
29
|
+
|
30
|
+
CHECK(a2.a == 9);
|
31
|
+
CHECK(a2.b == 19);
|
32
|
+
|
33
|
+
CHECK(result.a == 24);
|
34
|
+
CHECK(result.b == 144);
|
35
|
+
|
27
36
|
return result;
|
28
37
|
}
|
29
38
|
|
@@ -78,6 +87,8 @@ int main (void)
|
|
78
87
|
/* { dg-output "15 125 9 19: 24 144" } */
|
79
88
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
80
89
|
/* { dg-output "\nres: 24 144" } */
|
90
|
+
CHECK(res_dbl.a == 24);
|
91
|
+
CHECK(res_dbl.b == 144);
|
81
92
|
|
82
93
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK);
|
83
94
|
|
@@ -85,6 +96,8 @@ int main (void)
|
|
85
96
|
/* { dg-output "\n15 125 9 19: 24 144" } */
|
86
97
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
87
98
|
/* { dg-output "\nres: 24 144" } */
|
99
|
+
CHECK(res_dbl.a == 24);
|
100
|
+
CHECK(res_dbl.b == 144);
|
88
101
|
|
89
102
|
exit(0);
|
90
103
|
}
|
@@ -27,6 +27,18 @@ cls_struct_3float cls_struct_3float_fn(struct cls_struct_3float a1,
|
|
27
27
|
printf("%g %g %g %g %g %g: %g %g %g\n", a1.f, a1.g, a1.h,
|
28
28
|
a2.f, a2.g, a2.h, result.f, result.g, result.h);
|
29
29
|
|
30
|
+
CHECK_FLOAT_EQ(a1.f, 1);
|
31
|
+
CHECK_FLOAT_EQ(a1.g, 2);
|
32
|
+
CHECK_FLOAT_EQ(a1.h, 3);
|
33
|
+
|
34
|
+
CHECK_FLOAT_EQ(a2.f, 1);
|
35
|
+
CHECK_FLOAT_EQ(a2.g, 2);
|
36
|
+
CHECK_FLOAT_EQ(a2.h, 3);
|
37
|
+
|
38
|
+
CHECK_FLOAT_EQ(result.f, 2);
|
39
|
+
CHECK_FLOAT_EQ(result.g, 4);
|
40
|
+
CHECK_FLOAT_EQ(result.h, 6);
|
41
|
+
|
30
42
|
return result;
|
31
43
|
}
|
32
44
|
|
@@ -81,6 +93,9 @@ int main (void)
|
|
81
93
|
/* { dg-output "1 2 3 1 2 3: 2 4 6" } */
|
82
94
|
printf("res: %g %g %g\n", res_dbl.f, res_dbl.g, res_dbl.h);
|
83
95
|
/* { dg-output "\nres: 2 4 6" } */
|
96
|
+
CHECK_FLOAT_EQ(res_dbl.f, 2);
|
97
|
+
CHECK_FLOAT_EQ(res_dbl.g, 4);
|
98
|
+
CHECK_FLOAT_EQ(res_dbl.h, 6);
|
84
99
|
|
85
100
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3float_gn, NULL, code) ==
|
86
101
|
FFI_OK);
|
@@ -90,6 +105,9 @@ int main (void)
|
|
90
105
|
/* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */
|
91
106
|
printf("res: %g %g %g\n", res_dbl.f, res_dbl.g, res_dbl.h);
|
92
107
|
/* { dg-output "\nres: 2 4 6" } */
|
108
|
+
CHECK_FLOAT_EQ(res_dbl.f, 2);
|
109
|
+
CHECK_FLOAT_EQ(res_dbl.g, 4);
|
110
|
+
CHECK_FLOAT_EQ(res_dbl.h, 6);
|
93
111
|
|
94
112
|
exit(0);
|
95
113
|
}
|
@@ -30,6 +30,20 @@ cls_struct_4_1byte cls_struct_4_1byte_fn(struct cls_struct_4_1byte a1,
|
|
30
30
|
a2.a, a2.b, a2.c, a2.d,
|
31
31
|
result.a, result.b, result.c, result.d);
|
32
32
|
|
33
|
+
CHECK(a1.a == 12);
|
34
|
+
CHECK(a1.b == 13);
|
35
|
+
CHECK(a1.c == 14);
|
36
|
+
CHECK(a1.d == 15);
|
37
|
+
|
38
|
+
CHECK(a2.a == 178);
|
39
|
+
CHECK(a2.b == 179);
|
40
|
+
CHECK(a2.c == 180);
|
41
|
+
CHECK(a2.d == 181);
|
42
|
+
|
43
|
+
CHECK(result.a == 190);
|
44
|
+
CHECK(result.b == 192);
|
45
|
+
CHECK(result.c == 194);
|
46
|
+
CHECK(result.d == 196);
|
33
47
|
return result;
|
34
48
|
}
|
35
49
|
|
@@ -86,6 +100,10 @@ int main (void)
|
|
86
100
|
/* { dg-output "12 13 14 15 178 179 180 181: 190 192 194 196" } */
|
87
101
|
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
|
88
102
|
/* { dg-output "\nres: 190 192 194 196" } */
|
103
|
+
CHECK(res_dbl.a == 190);
|
104
|
+
CHECK(res_dbl.b == 192);
|
105
|
+
CHECK(res_dbl.c == 194);
|
106
|
+
CHECK(res_dbl.d == 196);
|
89
107
|
|
90
108
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK);
|
91
109
|
|
@@ -93,6 +111,10 @@ int main (void)
|
|
93
111
|
/* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */
|
94
112
|
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
|
95
113
|
/* { dg-output "\nres: 190 192 194 196" } */
|
114
|
+
CHECK(res_dbl.a == 190);
|
115
|
+
CHECK(res_dbl.b == 192);
|
116
|
+
CHECK(res_dbl.c == 194);
|
117
|
+
CHECK(res_dbl.d == 196);
|
96
118
|
|
97
119
|
exit(0);
|
98
120
|
}
|
@@ -24,6 +24,15 @@ cls_struct_4byte cls_struct_4byte_fn(struct cls_struct_4byte a1,
|
|
24
24
|
|
25
25
|
printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b);
|
26
26
|
|
27
|
+
CHECK(a1.a == 127);
|
28
|
+
CHECK(a1.b == 120);
|
29
|
+
|
30
|
+
CHECK(a2.a == 12);
|
31
|
+
CHECK(a2.b == 128);
|
32
|
+
|
33
|
+
CHECK(result.a == 139);
|
34
|
+
CHECK(result.b == 248);
|
35
|
+
|
27
36
|
return result;
|
28
37
|
}
|
29
38
|
|
@@ -78,6 +87,8 @@ int main (void)
|
|
78
87
|
/* { dg-output "127 120 12 128: 139 248" } */
|
79
88
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
80
89
|
/* { dg-output "\nres: 139 248" } */
|
90
|
+
CHECK(res_dbl.a == 139);
|
91
|
+
CHECK(res_dbl.b == 248);
|
81
92
|
|
82
93
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK);
|
83
94
|
|
@@ -85,6 +96,8 @@ int main (void)
|
|
85
96
|
/* { dg-output "\n127 120 12 128: 139 248" } */
|
86
97
|
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
|
87
98
|
/* { dg-output "\nres: 139 248" } */
|
99
|
+
CHECK(res_dbl.a == 139);
|
100
|
+
CHECK(res_dbl.b == 248);
|
88
101
|
|
89
102
|
exit(0);
|
90
103
|
}
|