ffi 1.9.24 → 1.16.3
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 +348 -0
- data/Gemfile +4 -5
- data/README.md +44 -17
- data/Rakefile +74 -148
- data/ext/ffi_c/AbstractMemory.c +89 -70
- data/ext/ffi_c/AbstractMemory.h +3 -2
- data/ext/ffi_c/ArrayType.c +49 -13
- data/ext/ffi_c/ArrayType.h +1 -0
- data/ext/ffi_c/Buffer.c +90 -38
- data/ext/ffi_c/Call.c +55 -56
- data/ext/ffi_c/Call.h +12 -6
- data/ext/ffi_c/ClosurePool.c +333 -0
- data/ext/ffi_c/{Closure.h → ClosurePool.h} +25 -13
- data/ext/ffi_c/DynamicLibrary.c +91 -33
- data/ext/ffi_c/Function.c +306 -235
- data/ext/ffi_c/Function.h +3 -5
- data/ext/ffi_c/FunctionInfo.c +87 -32
- data/ext/ffi_c/LastError.c +74 -15
- data/ext/ffi_c/LongDouble.c +12 -10
- data/ext/ffi_c/LongDouble.h +0 -4
- data/ext/ffi_c/MappedType.c +66 -23
- data/ext/ffi_c/MappedType.h +0 -2
- data/ext/ffi_c/MemoryPointer.c +37 -15
- data/ext/ffi_c/MemoryPointer.h +0 -4
- data/ext/ffi_c/MethodHandle.c +265 -38
- data/ext/ffi_c/MethodHandle.h +3 -2
- data/ext/ffi_c/Platform.c +5 -56
- data/ext/ffi_c/Pointer.c +93 -55
- data/ext/ffi_c/Pointer.h +1 -4
- data/ext/ffi_c/Struct.c +202 -134
- data/ext/ffi_c/Struct.h +18 -9
- data/ext/ffi_c/StructByValue.c +50 -23
- data/ext/ffi_c/StructLayout.c +135 -64
- data/ext/ffi_c/Thread.c +4 -228
- data/ext/ffi_c/Thread.h +1 -20
- data/ext/ffi_c/Type.c +105 -55
- data/ext/ffi_c/Type.h +3 -2
- data/ext/ffi_c/Types.c +8 -9
- data/ext/ffi_c/Types.h +3 -4
- data/ext/ffi_c/Variadic.c +88 -47
- data/ext/ffi_c/compat.h +26 -22
- data/ext/ffi_c/extconf.rb +75 -32
- data/ext/ffi_c/ffi.c +9 -10
- 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 +53 -19
- data/ext/ffi_c/libffi/.ci/bfin-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
- data/ext/ffi_c/libffi/.ci/build-in-container.sh +10 -0
- data/ext/ffi_c/libffi/.ci/build.sh +124 -0
- data/ext/ffi_c/libffi/.ci/install.sh +78 -0
- data/ext/ffi_c/libffi/.ci/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +1 -1
- data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
- data/ext/ffi_c/libffi/.ci/or1k-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/site.exp +29 -0
- data/ext/ffi_c/libffi/.ci/wine-sim.exp +55 -0
- data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
- data/ext/ffi_c/libffi/.gitattributes +4 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +460 -0
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +171 -0
- data/ext/ffi_c/libffi/.gitignore +10 -2
- data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
- data/ext/ffi_c/libffi/Makefile.am +64 -73
- data/ext/ffi_c/libffi/Makefile.in +553 -235
- data/ext/ffi_c/libffi/README.md +165 -100
- data/ext/ffi_c/libffi/acinclude.m4 +10 -112
- data/ext/ffi_c/libffi/compile +348 -0
- data/ext/ffi_c/libffi/config.guess +950 -662
- data/ext/ffi_c/libffi/config.sub +1362 -1306
- data/ext/ffi_c/libffi/configure +4909 -4096
- data/ext/ffi_c/libffi/configure.ac +93 -32
- data/ext/ffi_c/libffi/configure.host +76 -28
- data/ext/ffi_c/libffi/doc/Makefile.in +15 -8
- data/ext/ffi_c/libffi/doc/libffi.texi +107 -46
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +22 -44
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +165 -56
- data/ext/ffi_c/libffi/include/Makefile.am +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +17 -12
- data/ext/ffi_c/libffi/include/ffi.h.in +64 -48
- data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +34 -1
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +107 -74
- data/ext/ffi_c/libffi/libffi.map.in +8 -12
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +576 -284
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
- 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_check_compile_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -44
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/man/Makefile.in +15 -8
- data/ext/ffi_c/libffi/missing +8 -8
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
- data/ext/ffi_c/libffi/msvcc.sh +39 -14
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +286 -98
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +19 -3
- data/ext/ffi_c/libffi/src/aarch64/internal.h +33 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +142 -37
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- 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 +112 -10
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +117 -44
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/closures.c +189 -48
- data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
- data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
- data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
- data/ext/ffi_c/libffi/src/dlmalloc.c +6 -1
- data/ext/ffi_c/libffi/src/frv/ffi.c +1 -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/kvx/asm.h +5 -0
- data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
- data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
- data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
- data/ext/ffi_c/libffi/src/loongarch64/ffi.c +621 -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/metag/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/mips/ffi.c +245 -66
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/mips/n32.S +137 -28
- data/ext/ffi_c/libffi/src/mips/o32.S +63 -4
- data/ext/ffi_c/libffi/src/moxie/ffi.c +48 -23
- data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
- data/ext/ffi_c/libffi/src/pa/ffi.c +62 -108
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +20 -11
- data/ext/ffi_c/libffi/src/pa/hpux32.S +87 -38
- data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +109 -39
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +93 -28
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +83 -5
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +26 -4
- data/ext/ffi_c/libffi/src/riscv/ffi.c +79 -10
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +16 -0
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +934 -0
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +128 -49
- data/ext/ffi_c/libffi/src/x86/ffi64.c +89 -23
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +21 -4
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +63 -10
- 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 +274 -45
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +998 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +190 -4
- data/ext/ffi_c/libffi/src/x86/win64.S +32 -10
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
- 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 +127 -109
- data/ext/ffi_c/libffi/testsuite/Makefile.in +144 -88
- 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 +80 -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 +71 -25
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +5 -4
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
- 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/call.exp +12 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
- 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.exp +67 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +3 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +21 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +7 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +6 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +18 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +29 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +21 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +35 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +19 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +18 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +29 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +28 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +24 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +39 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +25 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +14 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +14 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +14 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +20 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +40 -25
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +40 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +18 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +3 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +11 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +22 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +5 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +6 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +5 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +10 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +24 -22
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +32 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +12 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → 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.call → libffi.closures}/nested_struct2.c +10 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +10 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → 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.call → libffi.closures}/stret_medium.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +2 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +1 -0
- data/ext/ffi_c/libffi.bsd.mk +2 -2
- data/ext/ffi_c/libffi.darwin.mk +1 -1
- data/ext/ffi_c/libffi.gnu.mk +2 -2
- data/ext/ffi_c/rbffi.h +1 -3
- data/ffi.gemspec +15 -9
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +8 -23
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/dynamic_library.rb +89 -0
- data/lib/ffi/enum.rb +18 -11
- data/lib/ffi/ffi.rb +6 -0
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +3 -3
- data/lib/ffi/library.rb +65 -77
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +3 -3
- data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
- data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +181 -0
- data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
- data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
- data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
- data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/arm-linux/types.conf +110 -82
- 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/i386-cygwin/types.conf +1 -1
- data/lib/ffi/platform/i386-darwin/types.conf +63 -63
- data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
- data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/i386-gnu/types.conf +84 -84
- data/lib/ffi/platform/i386-linux/types.conf +77 -77
- data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
- data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
- data/lib/ffi/platform/i386-solaris/types.conf +96 -96
- data/lib/ffi/platform/i386-windows/types.conf +43 -96
- data/lib/ffi/platform/ia64-linux/types.conf +79 -79
- data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
- data/lib/ffi/platform/mips-linux/types.conf +79 -79
- data/lib/ffi/platform/mips64-linux/types.conf +81 -81
- data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
- data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
- data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
- data/lib/ffi/platform/powerpc-linux/types.conf +108 -78
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
- data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
- data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
- data/lib/ffi/platform/s390-linux/types.conf +79 -79
- data/lib/ffi/platform/s390x-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
- data/lib/ffi/platform/x86_64-darwin/types.conf +88 -84
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -90
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
- data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +107 -77
- data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
- data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
- data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
- data/lib/ffi/platform/x86_64-windows/types.conf +42 -110
- data/lib/ffi/platform.rb +43 -20
- data/lib/ffi/pointer.rb +26 -20
- data/lib/ffi/struct.rb +14 -68
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/struct_layout_builder.rb +1 -1
- data/lib/ffi/tools/const_generator.rb +11 -8
- data/lib/ffi/tools/generator.rb +47 -2
- data/lib/ffi/tools/generator_task.rb +13 -17
- data/lib/ffi/tools/struct_generator.rb +6 -5
- data/lib/ffi/tools/types_generator.rb +7 -4
- data/lib/ffi/types.rb +33 -7
- data/lib/ffi/variadic.rb +20 -18
- data/lib/ffi/version.rb +1 -1
- data/lib/ffi.rb +10 -3
- data/rakelib/ffi_gem_helper.rb +65 -0
- data/samples/getlogin.rb +1 -1
- data/samples/getpid.rb +1 -1
- data/samples/gettimeofday.rb +8 -8
- data/samples/hello.rb +2 -1
- data/samples/hello_ractor.rb +11 -0
- data/samples/inotify.rb +1 -1
- data/samples/pty.rb +1 -2
- data/samples/qsort.rb +0 -1
- data/samples/qsort_ractor.rb +28 -0
- data.tar.gz.sig +0 -0
- metadata +252 -153
- metadata.gz.sig +0 -0
- data/.gitignore +0 -22
- data/.gitmodules +0 -3
- data/.travis.yml +0 -52
- data/.yardopts +0 -5
- data/appveyor.yml +0 -22
- data/ext/ffi_c/Closure.c +0 -54
- data/ext/ffi_c/DataConverter.c +0 -91
- data/ext/ffi_c/StructByReference.c +0 -190
- data/ext/ffi_c/StructByReference.h +0 -50
- data/ext/ffi_c/libffi/.travis/build.sh +0 -34
- data/ext/ffi_c/libffi/.travis/install.sh +0 -22
- data/ext/ffi_c/libffi/.travis/site.exp +0 -18
- data/ext/ffi_c/libffi/.travis.yml +0 -34
- data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
- data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
- data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +0 -44
- data/ext/ffi_c/win32/stdbool.h +0 -8
- data/ext/ffi_c/win32/stdint.h +0 -201
- data/samples/sample_helper.rb +0 -6
- data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
- data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +79 -79
@@ -5,6 +5,9 @@
|
|
5
5
|
#include <ffi.h>
|
6
6
|
#include "fficonfig.h"
|
7
7
|
|
8
|
+
#include <float.h>
|
9
|
+
#include <math.h>
|
10
|
+
|
8
11
|
#if defined HAVE_STDINT_H
|
9
12
|
#include <stdint.h>
|
10
13
|
#endif
|
@@ -15,7 +18,29 @@
|
|
15
18
|
|
16
19
|
#define MAX_ARGS 256
|
17
20
|
|
18
|
-
#define CHECK(x)
|
21
|
+
#define CHECK(x) \
|
22
|
+
do { \
|
23
|
+
if(!(x)){ \
|
24
|
+
printf("Check failed:\n%s\n", #x); \
|
25
|
+
abort(); \
|
26
|
+
} \
|
27
|
+
} while(0)
|
28
|
+
|
29
|
+
#define CHECK_FLOAT_EQ(x, y) \
|
30
|
+
do { \
|
31
|
+
if(fabs((x) - (y)) > FLT_EPSILON){ \
|
32
|
+
printf("Check failed CHECK_FLOAT_EQ(%s, %s)\n", #x, #y); \
|
33
|
+
abort(); \
|
34
|
+
} \
|
35
|
+
} while(0)
|
36
|
+
|
37
|
+
#define CHECK_DOUBLE_EQ(x, y) \
|
38
|
+
do { \
|
39
|
+
if(fabs((x) - (y)) > DBL_EPSILON){ \
|
40
|
+
printf("Check failed CHECK_FLOAT_EQ(%s, %s)\n", #x, #y); \
|
41
|
+
abort(); \
|
42
|
+
} \
|
43
|
+
} while(0)
|
19
44
|
|
20
45
|
/* Define macros so that compilers other than gcc can run the tests. */
|
21
46
|
#undef __UNUSED__
|
@@ -63,8 +88,8 @@
|
|
63
88
|
|
64
89
|
#endif
|
65
90
|
|
66
|
-
/*
|
67
|
-
#if defined(
|
91
|
+
/* msvc kludge. */
|
92
|
+
#if defined(_MSC_VER)
|
68
93
|
#define PRIdLL "I64d"
|
69
94
|
#define PRIuLL "I64u"
|
70
95
|
#else
|
@@ -33,19 +33,20 @@ int main (void)
|
|
33
33
|
|
34
34
|
f = 3.14159;
|
35
35
|
|
36
|
-
#if
|
37
|
-
/*
|
38
|
-
|
39
|
-
|
36
|
+
#if defined(__sun) && defined(__GNUC__)
|
37
|
+
/* long double support under SunOS/gcc is pretty much non-existent.
|
38
|
+
You'll get the odd bus error in library routines like printf() */
|
39
|
+
#else
|
40
40
|
printf ("%Lf\n", ldblit(f));
|
41
41
|
#endif
|
42
|
+
|
42
43
|
ld = 666;
|
43
44
|
ffi_call(&cif, FFI_FN(ldblit), &ld, values);
|
44
45
|
|
45
|
-
#if
|
46
|
-
/*
|
47
|
-
|
48
|
-
|
46
|
+
#if defined(__sun) && defined(__GNUC__)
|
47
|
+
/* long double support under SunOS/gcc is pretty much non-existent.
|
48
|
+
You'll get the odd bus error in library routines like printf() */
|
49
|
+
#else
|
49
50
|
printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
|
50
51
|
#endif
|
51
52
|
|
@@ -74,6 +74,7 @@ int main (void)
|
|
74
74
|
/* { dg-output "\n0: 2.0 : total: 2.0" } */
|
75
75
|
printf("ffi: %.1f\n", resfp);
|
76
76
|
/* { dg-output "\nffi: 2.0" } */
|
77
|
+
CHECK_DOUBLE_EQ(resfp, 2);
|
77
78
|
|
78
79
|
/* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */
|
79
80
|
/* Call it statically and then via ffi */
|
@@ -81,6 +82,7 @@ int main (void)
|
|
81
82
|
/* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
|
82
83
|
printf("compiled: %.1f\n", resfp);
|
83
84
|
/* { dg-output "\ncompiled: 11.0" } */
|
85
|
+
CHECK_DOUBLE_EQ(resfp, 11);
|
84
86
|
|
85
87
|
arg_types[0] = &ffi_type_uint;
|
86
88
|
arg_types[1] = &ffi_type_double;
|
@@ -102,6 +104,7 @@ int main (void)
|
|
102
104
|
/* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
|
103
105
|
printf("ffi: %.1f\n", resfp);
|
104
106
|
/* { dg-output "\nffi: 11.0" } */
|
107
|
+
CHECK_DOUBLE_EQ(resfp, 11);
|
105
108
|
|
106
109
|
exit(0);
|
107
110
|
}
|
@@ -9,6 +9,9 @@
|
|
9
9
|
#include "ffitest.h"
|
10
10
|
static long long return_ll(int ll0, long long ll1, int ll2)
|
11
11
|
{
|
12
|
+
CHECK(ll0 == 11111111);
|
13
|
+
CHECK(ll1 == 11111111111000LL);
|
14
|
+
CHECK(ll2 == 11111111);
|
12
15
|
return ll0 + ll1 + ll2;
|
13
16
|
}
|
14
17
|
|
@@ -39,5 +42,7 @@ int main (void)
|
|
39
42
|
ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
|
40
43
|
printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2);
|
41
44
|
/* { dg-output "res: 11111133333222, 11111133333222" } */
|
45
|
+
CHECK(rlonglong == 11111133333222);
|
46
|
+
CHECK(ll0 + ll1 + ll2 == 11111133333222);
|
42
47
|
exit(0);
|
43
48
|
}
|
@@ -8,6 +8,8 @@
|
|
8
8
|
#include "ffitest.h"
|
9
9
|
static long return_sl(long l1, long l2)
|
10
10
|
{
|
11
|
+
CHECK(l1 == 1073741823L);
|
12
|
+
CHECK(l2 == 1073741824L);
|
11
13
|
return l1 - l2;
|
12
14
|
}
|
13
15
|
|
@@ -33,6 +35,8 @@ int main (void)
|
|
33
35
|
ffi_call(&cif, FFI_FN(return_sl), &res, values);
|
34
36
|
printf("res: %ld, %ld\n", (long)res, l1 - l2);
|
35
37
|
/* { dg-output "res: -1, -1" } */
|
38
|
+
CHECK((long)res == -1);
|
39
|
+
CHECK(l1 + 1 == l2);
|
36
40
|
|
37
41
|
exit(0);
|
38
42
|
}
|
@@ -8,6 +8,8 @@
|
|
8
8
|
#include "ffitest.h"
|
9
9
|
static unsigned long return_ul(unsigned long ul1, unsigned long ul2)
|
10
10
|
{
|
11
|
+
CHECK(ul1 == 1073741823L);
|
12
|
+
CHECK(ul2 == 1073741824L);
|
11
13
|
return ul1 + ul2;
|
12
14
|
}
|
13
15
|
|
@@ -33,6 +35,8 @@ int main (void)
|
|
33
35
|
ffi_call(&cif, FFI_FN(return_ul), &res, values);
|
34
36
|
printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2);
|
35
37
|
/* { dg-output "res: 2147483647, 2147483647" } */
|
38
|
+
CHECK(res == 2147483647L);
|
39
|
+
CHECK(ul1 + ul2 == 2147483647L);
|
36
40
|
|
37
41
|
exit(0);
|
38
42
|
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: From the original ffitest.c */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
typedef struct
|
11
|
+
{
|
12
|
+
float f;
|
13
|
+
} s55;
|
14
|
+
|
15
|
+
static s55 ABI_ATTR f55(s55 ts, float f)
|
16
|
+
{
|
17
|
+
s55 r;
|
18
|
+
r.f = ts.f + f;
|
19
|
+
printf ("f55>> %g + %g = %g\n", ts.f, f, r.f);
|
20
|
+
return r;
|
21
|
+
}
|
22
|
+
|
23
|
+
int main (void)
|
24
|
+
{
|
25
|
+
ffi_cif cif;
|
26
|
+
s55 F, Fr;
|
27
|
+
float f;
|
28
|
+
void *values[] = { &F, &f };
|
29
|
+
ffi_type s55_type;
|
30
|
+
ffi_type *args[] = { &s55_type, &ffi_type_float };
|
31
|
+
ffi_type *s55_type_elements[] = { &ffi_type_float, NULL };
|
32
|
+
|
33
|
+
/* This is a hack to get a properly aligned result buffer */
|
34
|
+
s55 *s55_result =
|
35
|
+
(s55 *) malloc (sizeof(s55));
|
36
|
+
|
37
|
+
s55_type.size = 0;
|
38
|
+
s55_type.alignment = 0;
|
39
|
+
s55_type.type = FFI_TYPE_STRUCT;
|
40
|
+
s55_type.elements = s55_type_elements;
|
41
|
+
|
42
|
+
/* Initialize the cif */
|
43
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &s55_type, args) == FFI_OK);
|
44
|
+
|
45
|
+
F.f = 1;
|
46
|
+
Fr = f55(F, 2.14);
|
47
|
+
printf ("%g\n", Fr.f);
|
48
|
+
|
49
|
+
F.f = 1;
|
50
|
+
f = 2.14;
|
51
|
+
ffi_call(&cif, FFI_FN(f55), s55_result, values);
|
52
|
+
printf ("%g\n", s55_result->f);
|
53
|
+
|
54
|
+
fflush(0);
|
55
|
+
|
56
|
+
CHECK(fabs(Fr.f - s55_result->f) < FLT_EPSILON);
|
57
|
+
|
58
|
+
free (s55_result);
|
59
|
+
exit(0);
|
60
|
+
}
|
@@ -7,9 +7,9 @@
|
|
7
7
|
/* { dg-do run } */
|
8
8
|
#include "ffitest.h"
|
9
9
|
|
10
|
-
static
|
10
|
+
static unsigned int ABI_ATTR my_strlen(char *s)
|
11
11
|
{
|
12
|
-
return (strlen(s));
|
12
|
+
return (unsigned int) (strlen(s));
|
13
13
|
}
|
14
14
|
|
15
15
|
int main (void)
|
@@ -22,23 +22,22 @@ int main (void)
|
|
22
22
|
|
23
23
|
args[0] = &ffi_type_pointer;
|
24
24
|
values[0] = (void*) &s;
|
25
|
-
|
25
|
+
|
26
26
|
/* Initialize the cif */
|
27
27
|
CHECK(ffi_prep_cif(&cif, ABI_NUM, 1,
|
28
|
-
&
|
29
|
-
|
28
|
+
&ffi_type_uint, args) == FFI_OK);
|
29
|
+
|
30
30
|
s = "a";
|
31
31
|
ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
|
32
32
|
CHECK(rint == 1);
|
33
|
-
|
33
|
+
|
34
34
|
s = "1234567";
|
35
35
|
ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
|
36
36
|
CHECK(rint == 7);
|
37
|
-
|
37
|
+
|
38
38
|
s = "1234567890123456789012345";
|
39
39
|
ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
|
40
40
|
CHECK(rint == 25);
|
41
|
-
|
41
|
+
|
42
42
|
exit (0);
|
43
43
|
}
|
44
|
-
|
@@ -8,9 +8,9 @@
|
|
8
8
|
|
9
9
|
#include "ffitest.h"
|
10
10
|
|
11
|
-
static
|
11
|
+
static int ABI_ATTR my_f(float a, char *s, int i)
|
12
12
|
{
|
13
|
-
return (
|
13
|
+
return (int) strlen(s) + (int) a + i;
|
14
14
|
}
|
15
15
|
|
16
16
|
int main (void)
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: From the original ffitest.c */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
typedef struct
|
11
|
+
{
|
12
|
+
unsigned int ui01;
|
13
|
+
unsigned int ui02;
|
14
|
+
} test_structure_1;
|
15
|
+
|
16
|
+
static test_structure_1 ABI_ATTR struct1(test_structure_1 ts)
|
17
|
+
{
|
18
|
+
ts.ui02++;
|
19
|
+
|
20
|
+
return ts;
|
21
|
+
}
|
22
|
+
|
23
|
+
int main (void)
|
24
|
+
{
|
25
|
+
ffi_cif cif;
|
26
|
+
ffi_type *args[MAX_ARGS];
|
27
|
+
void *values[MAX_ARGS];
|
28
|
+
ffi_type ts1_type;
|
29
|
+
ffi_type *ts1_type_elements[3];
|
30
|
+
|
31
|
+
test_structure_1 ts1_arg;
|
32
|
+
|
33
|
+
/* This is a hack to get a properly aligned result buffer */
|
34
|
+
test_structure_1 *ts1_result =
|
35
|
+
(test_structure_1 *) malloc (sizeof(test_structure_1));
|
36
|
+
|
37
|
+
ts1_type.size = 0;
|
38
|
+
ts1_type.alignment = 0;
|
39
|
+
ts1_type.type = FFI_TYPE_STRUCT;
|
40
|
+
ts1_type.elements = ts1_type_elements;
|
41
|
+
ts1_type_elements[0] = &ffi_type_uint;
|
42
|
+
ts1_type_elements[1] = &ffi_type_uint;
|
43
|
+
ts1_type_elements[2] = NULL;
|
44
|
+
|
45
|
+
args[0] = &ts1_type;
|
46
|
+
values[0] = &ts1_arg;
|
47
|
+
|
48
|
+
/* Initialize the cif */
|
49
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 1,
|
50
|
+
&ts1_type, args) == FFI_OK);
|
51
|
+
|
52
|
+
ts1_arg.ui02 = 555;
|
53
|
+
|
54
|
+
ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
|
55
|
+
|
56
|
+
CHECK(ts1_result->ui02 == 556);
|
57
|
+
|
58
|
+
/* This will fail if ffi_call isn't passing the struct by value. */
|
59
|
+
CHECK(ts1_arg.ui02 == 555);
|
60
|
+
|
61
|
+
free (ts1_result);
|
62
|
+
exit(0);
|
63
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: From the original ffitest.c */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
typedef struct
|
11
|
+
{
|
12
|
+
unsigned int ui01;
|
13
|
+
unsigned int ui02;
|
14
|
+
unsigned int ui03;
|
15
|
+
} test_structure_1;
|
16
|
+
|
17
|
+
static test_structure_1 ABI_ATTR struct1(test_structure_1 ts)
|
18
|
+
{
|
19
|
+
ts.ui03++;
|
20
|
+
|
21
|
+
return ts;
|
22
|
+
}
|
23
|
+
|
24
|
+
int main (void)
|
25
|
+
{
|
26
|
+
ffi_cif cif;
|
27
|
+
ffi_type *args[MAX_ARGS];
|
28
|
+
void *values[MAX_ARGS];
|
29
|
+
ffi_type ts1_type;
|
30
|
+
ffi_type *ts1_type_elements[4];
|
31
|
+
|
32
|
+
test_structure_1 ts1_arg;
|
33
|
+
|
34
|
+
/* This is a hack to get a properly aligned result buffer */
|
35
|
+
test_structure_1 *ts1_result =
|
36
|
+
(test_structure_1 *) malloc (sizeof(test_structure_1));
|
37
|
+
|
38
|
+
ts1_type.size = 0;
|
39
|
+
ts1_type.alignment = 0;
|
40
|
+
ts1_type.type = FFI_TYPE_STRUCT;
|
41
|
+
ts1_type.elements = ts1_type_elements;
|
42
|
+
ts1_type_elements[0] = &ffi_type_uint;
|
43
|
+
ts1_type_elements[1] = &ffi_type_uint;
|
44
|
+
ts1_type_elements[2] = &ffi_type_uint;
|
45
|
+
ts1_type_elements[3] = NULL;
|
46
|
+
|
47
|
+
args[0] = &ts1_type;
|
48
|
+
values[0] = &ts1_arg;
|
49
|
+
|
50
|
+
/* Initialize the cif */
|
51
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 1,
|
52
|
+
&ts1_type, args) == FFI_OK);
|
53
|
+
|
54
|
+
ts1_arg.ui03 = 555;
|
55
|
+
|
56
|
+
ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
|
57
|
+
|
58
|
+
CHECK(ts1_result->ui03 == 556);
|
59
|
+
|
60
|
+
/* This will fail if ffi_call isn't passing the struct by value. */
|
61
|
+
CHECK(ts1_arg.ui03 == 555);
|
62
|
+
|
63
|
+
free (ts1_result);
|
64
|
+
exit(0);
|
65
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: From the original ffitest.c */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
typedef struct
|
11
|
+
{
|
12
|
+
float f01;
|
13
|
+
float f02;
|
14
|
+
float f03;
|
15
|
+
} test_structure_1;
|
16
|
+
|
17
|
+
static test_structure_1 ABI_ATTR struct1(test_structure_1 ts)
|
18
|
+
{
|
19
|
+
ts.f03++;
|
20
|
+
|
21
|
+
return ts;
|
22
|
+
}
|
23
|
+
|
24
|
+
int main (void)
|
25
|
+
{
|
26
|
+
ffi_cif cif;
|
27
|
+
ffi_type *args[MAX_ARGS];
|
28
|
+
void *values[MAX_ARGS];
|
29
|
+
ffi_type ts1_type;
|
30
|
+
ffi_type *ts1_type_elements[5];
|
31
|
+
|
32
|
+
test_structure_1 ts1_arg;
|
33
|
+
|
34
|
+
/* This is a hack to get a properly aligned result buffer */
|
35
|
+
test_structure_1 *ts1_result =
|
36
|
+
(test_structure_1 *) malloc (sizeof(test_structure_1));
|
37
|
+
|
38
|
+
ts1_type.size = 0;
|
39
|
+
ts1_type.alignment = 0;
|
40
|
+
ts1_type.type = FFI_TYPE_STRUCT;
|
41
|
+
ts1_type.elements = ts1_type_elements;
|
42
|
+
ts1_type_elements[0] = &ffi_type_float;
|
43
|
+
ts1_type_elements[1] = &ffi_type_float;
|
44
|
+
ts1_type_elements[2] = &ffi_type_float;
|
45
|
+
ts1_type_elements[3] = NULL;
|
46
|
+
|
47
|
+
args[0] = &ts1_type;
|
48
|
+
values[0] = &ts1_arg;
|
49
|
+
|
50
|
+
/* Initialize the cif */
|
51
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 1,
|
52
|
+
&ts1_type, args) == FFI_OK);
|
53
|
+
|
54
|
+
ts1_arg.f03 = 555.5;
|
55
|
+
|
56
|
+
ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
|
57
|
+
|
58
|
+
CHECK(fabs(ts1_result->f03 - 556.5) < FLT_EPSILON);
|
59
|
+
|
60
|
+
/* This will fail if ffi_call isn't passing the struct by value. */
|
61
|
+
CHECK(fabs(ts1_arg.f03 - 555.5) < FLT_EPSILON);
|
62
|
+
|
63
|
+
free (ts1_result);
|
64
|
+
exit(0);
|
65
|
+
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: From the original ffitest.c */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
typedef struct
|
11
|
+
{
|
12
|
+
unsigned int ui01;
|
13
|
+
unsigned int ui02;
|
14
|
+
unsigned int ui03;
|
15
|
+
unsigned int ui04;
|
16
|
+
} test_structure_1;
|
17
|
+
|
18
|
+
static test_structure_1 ABI_ATTR struct1(test_structure_1 ts)
|
19
|
+
{
|
20
|
+
ts.ui04++;
|
21
|
+
|
22
|
+
return ts;
|
23
|
+
}
|
24
|
+
|
25
|
+
int main (void)
|
26
|
+
{
|
27
|
+
ffi_cif cif;
|
28
|
+
ffi_type *args[MAX_ARGS];
|
29
|
+
void *values[MAX_ARGS];
|
30
|
+
ffi_type ts1_type;
|
31
|
+
ffi_type *ts1_type_elements[5];
|
32
|
+
|
33
|
+
test_structure_1 ts1_arg;
|
34
|
+
|
35
|
+
/* This is a hack to get a properly aligned result buffer */
|
36
|
+
test_structure_1 *ts1_result =
|
37
|
+
(test_structure_1 *) malloc (sizeof(test_structure_1));
|
38
|
+
|
39
|
+
ts1_type.size = 0;
|
40
|
+
ts1_type.alignment = 0;
|
41
|
+
ts1_type.type = FFI_TYPE_STRUCT;
|
42
|
+
ts1_type.elements = ts1_type_elements;
|
43
|
+
ts1_type_elements[0] = &ffi_type_uint;
|
44
|
+
ts1_type_elements[1] = &ffi_type_uint;
|
45
|
+
ts1_type_elements[2] = &ffi_type_uint;
|
46
|
+
ts1_type_elements[3] = &ffi_type_uint;
|
47
|
+
ts1_type_elements[4] = NULL;
|
48
|
+
|
49
|
+
args[0] = &ts1_type;
|
50
|
+
values[0] = &ts1_arg;
|
51
|
+
|
52
|
+
/* Initialize the cif */
|
53
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 1,
|
54
|
+
&ts1_type, args) == FFI_OK);
|
55
|
+
|
56
|
+
ts1_arg.ui04 = 555;
|
57
|
+
|
58
|
+
ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
|
59
|
+
|
60
|
+
CHECK(ts1_result->ui04 == 556);
|
61
|
+
|
62
|
+
/* This will fail if ffi_call isn't passing the struct by value. */
|
63
|
+
CHECK(ts1_arg.ui04 == 555);
|
64
|
+
|
65
|
+
free (ts1_result);
|
66
|
+
exit(0);
|
67
|
+
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: From the original ffitest.c */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
typedef struct
|
11
|
+
{
|
12
|
+
float f01;
|
13
|
+
float f02;
|
14
|
+
float f03;
|
15
|
+
float f04;
|
16
|
+
} test_structure_1;
|
17
|
+
|
18
|
+
static test_structure_1 ABI_ATTR struct1(test_structure_1 ts)
|
19
|
+
{
|
20
|
+
ts.f04++;
|
21
|
+
|
22
|
+
return ts;
|
23
|
+
}
|
24
|
+
|
25
|
+
int main (void)
|
26
|
+
{
|
27
|
+
ffi_cif cif;
|
28
|
+
ffi_type *args[MAX_ARGS];
|
29
|
+
void *values[MAX_ARGS];
|
30
|
+
ffi_type ts1_type;
|
31
|
+
ffi_type *ts1_type_elements[5];
|
32
|
+
|
33
|
+
test_structure_1 ts1_arg;
|
34
|
+
|
35
|
+
/* This is a hack to get a properly aligned result buffer */
|
36
|
+
test_structure_1 *ts1_result =
|
37
|
+
(test_structure_1 *) malloc (sizeof(test_structure_1));
|
38
|
+
|
39
|
+
ts1_type.size = 0;
|
40
|
+
ts1_type.alignment = 0;
|
41
|
+
ts1_type.type = FFI_TYPE_STRUCT;
|
42
|
+
ts1_type.elements = ts1_type_elements;
|
43
|
+
ts1_type_elements[0] = &ffi_type_float;
|
44
|
+
ts1_type_elements[1] = &ffi_type_float;
|
45
|
+
ts1_type_elements[2] = &ffi_type_float;
|
46
|
+
ts1_type_elements[3] = &ffi_type_float;
|
47
|
+
ts1_type_elements[4] = NULL;
|
48
|
+
|
49
|
+
args[0] = &ts1_type;
|
50
|
+
values[0] = &ts1_arg;
|
51
|
+
|
52
|
+
/* Initialize the cif */
|
53
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 1,
|
54
|
+
&ts1_type, args) == FFI_OK);
|
55
|
+
|
56
|
+
ts1_arg.f04 = 555.5;
|
57
|
+
|
58
|
+
ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
|
59
|
+
|
60
|
+
CHECK(fabs(ts1_result->f04 - 556.5) < FLT_EPSILON);
|
61
|
+
|
62
|
+
/* This will fail if ffi_call isn't passing the struct by value. */
|
63
|
+
CHECK(fabs(ts1_arg.f04 - 555.5) < FLT_EPSILON);
|
64
|
+
|
65
|
+
free (ts1_result);
|
66
|
+
exit(0);
|
67
|
+
}
|