ffi 1.17.2 → 1.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +34 -0
- data/Gemfile +7 -4
- data/README.md +1 -0
- data/Rakefile +7 -4
- data/Steepfile +8 -0
- data/ext/ffi_c/DynamicLibrary.c +1 -1
- data/ext/ffi_c/Function.c +2 -0
- data/ext/ffi_c/MethodHandle.c +4 -2
- data/ext/ffi_c/StructLayout.c +129 -12
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/Makefile.am +17 -13
- data/ext/ffi_c/libffi/Makefile.in +37 -30
- data/ext/ffi_c/libffi/README.md +22 -3
- data/ext/ffi_c/libffi/configure +105 -121
- data/ext/ffi_c/libffi/configure.ac +21 -8
- data/ext/ffi_c/libffi/configure.host +6 -1
- data/ext/ffi_c/libffi/doc/Makefile.in +3 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +24 -1
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -28
- data/ext/ffi_c/libffi/include/Makefile.in +3 -0
- data/ext/ffi_c/libffi/include/ffi.h.in +19 -1
- data/ext/ffi_c/libffi/libffi.map.in +13 -1
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +28 -11
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +13 -3
- data/ext/ffi_c/libffi/man/Makefile.in +3 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +7 -1
- data/ext/ffi_c/libffi/src/arm/sysv.S +1 -1
- data/ext/ffi_c/libffi/src/pa/linux.S +4 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -0
- data/ext/ffi_c/libffi/src/riscv/ffi.c +39 -16
- data/ext/ffi_c/libffi/src/riscv/internal.h +7 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +24 -0
- data/ext/ffi_c/libffi/src/tramp.c +6 -1
- data/ext/ffi_c/libffi/src/types.c +23 -1
- data/ext/ffi_c/libffi/src/{wasm32 → wasm}/ffi.c +157 -54
- data/ext/ffi_c/libffi/src/{wasm32 → wasm}/ffitarget.h +17 -0
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -3
- data/ext/ffi_c/libffi/src/x86/sysv.S +1 -3
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +1 -3
- data/ext/ffi_c/libffi/testsuite/Makefile.in +6 -2
- data/ext/ffi_c/libffi.mk +5 -0
- data/ffi.gemspec +7 -6
- data/lib/ffi/autopointer.rb +6 -0
- data/lib/ffi/compat.rb +11 -0
- data/lib/ffi/function.rb +23 -0
- data/lib/ffi/library.rb +19 -3
- data/lib/ffi/struct_by_reference.rb +1 -1
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +9 -1
- data/samples/qsort_ractor.rb +9 -1
- data/sig/ffi/auto_pointer.rbs +1 -1
- data/sig/ffi/errno.rbs +8 -0
- data/sig/ffi/platform.rbs +49 -0
- data/sig/ffi/struct.rbs +2 -2
- data/sig/ffi/struct_by_reference.rbs +1 -1
- data/sig/ffi.rbs +4 -1
- data.tar.gz.sig +0 -0
- metadata +24 -338
- metadata.gz.sig +0 -0
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- data/ext/ffi_c/libffi/.appveyor/site.exp +0 -16
- data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +0 -7
- data/ext/ffi_c/libffi/.appveyor.yml +0 -84
- data/ext/ffi_c/libffi/.ci/ar-lib +0 -270
- data/ext/ffi_c/libffi/.ci/bfin-sim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +0 -18
- data/ext/ffi_c/libffi/.ci/build-in-container.sh +0 -10
- data/ext/ffi_c/libffi/.ci/build.sh +0 -124
- data/ext/ffi_c/libffi/.ci/compile +0 -351
- data/ext/ffi_c/libffi/.ci/install.sh +0 -78
- data/ext/ffi_c/libffi/.ci/m32r-sim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/moxie-sim.exp +0 -60
- data/ext/ffi_c/libffi/.ci/msvs-detect +0 -1103
- data/ext/ffi_c/libffi/.ci/or1k-sim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +0 -58
- data/ext/ffi_c/libffi/.ci/site.exp +0 -29
- data/ext/ffi_c/libffi/.ci/wine-sim.exp +0 -55
- data/ext/ffi_c/libffi/.gitattributes +0 -4
- data/ext/ffi_c/libffi/.github/issue_template.md +0 -10
- data/ext/ffi_c/libffi/.github/workflows/build.yml +0 -479
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +0 -160
- data/ext/ffi_c/libffi/.gitignore +0 -46
- data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -88
- data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +0 -34
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +0 -46
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +0 -86
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +0 -23
- data/ext/ffi_c/libffi/testsuite/emscripten/test.html +0 -7
- data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +0 -51
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -682
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
- data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +0 -28
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +0 -50
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +0 -1746
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +0 -2885
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +0 -747
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -54
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +0 -99
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +0 -108
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +0 -114
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +0 -119
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -163
- data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -110
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/overread.c +0 -54
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
- data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc_tc.c +0 -114
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -48
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +0 -57
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +0 -65
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +0 -65
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +0 -93
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_int_float.c +0 -88
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +0 -220
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +0 -154
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -134
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -135
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -141
- data/ext/ffi_c/libffi/testsuite/libffi.call/x32.c +0 -31
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +0 -83
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +0 -83
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +0 -102
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +0 -94
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +0 -92
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +0 -96
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +0 -112
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +0 -117
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +0 -131
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +0 -93
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +0 -145
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +0 -114
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +0 -137
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +0 -116
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +0 -148
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +0 -140
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +0 -155
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +0 -102
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +0 -103
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +0 -147
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +0 -152
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +0 -108
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +0 -106
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +0 -108
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +0 -68
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +0 -69
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +0 -115
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +0 -80
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +0 -70
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +0 -79
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +0 -94
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +0 -99
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +0 -94
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +0 -79
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +0 -152
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +0 -47
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +0 -125
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +0 -47
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.closures/err_bad_abi.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +0 -343
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +0 -175
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +0 -161
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +0 -146
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +0 -137
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +0 -115
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +0 -119
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +0 -142
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +0 -120
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +0 -142
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +0 -142
- data/ext/ffi_c/libffi/testsuite/libffi.closures/problem1.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +0 -102
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +0 -101
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large.c +0 -145
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large2.c +0 -148
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +0 -124
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +0 -125
- data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +0 -75
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +0 -118
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
- data/lib/ffi/tools/types_generator.rb +0 -137
- data/rakelib/ffi_gem_helper.rb +0 -65
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
#include <stdlib.h>
|
|
2
|
-
#include <stdio.h>
|
|
3
|
-
#include <string.h>
|
|
4
|
-
#include <fcntl.h>
|
|
5
|
-
#include <ffi.h>
|
|
6
|
-
#include "fficonfig.h"
|
|
7
|
-
|
|
8
|
-
#include <float.h>
|
|
9
|
-
#include <math.h>
|
|
10
|
-
|
|
11
|
-
#if defined HAVE_STDINT_H
|
|
12
|
-
#include <stdint.h>
|
|
13
|
-
#endif
|
|
14
|
-
|
|
15
|
-
#if defined HAVE_INTTYPES_H
|
|
16
|
-
#include <inttypes.h>
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
|
-
#define MAX_ARGS 256
|
|
20
|
-
|
|
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)
|
|
44
|
-
|
|
45
|
-
/* Define macros so that compilers other than gcc can run the tests. */
|
|
46
|
-
#undef __UNUSED__
|
|
47
|
-
#if defined(__GNUC__)
|
|
48
|
-
#define __UNUSED__ __attribute__((__unused__))
|
|
49
|
-
#define __STDCALL__ __attribute__((stdcall))
|
|
50
|
-
#define __THISCALL__ __attribute__((thiscall))
|
|
51
|
-
#define __FASTCALL__ __attribute__((fastcall))
|
|
52
|
-
#define __MSABI__ __attribute__((ms_abi))
|
|
53
|
-
#else
|
|
54
|
-
#define __UNUSED__
|
|
55
|
-
#define __STDCALL__ __stdcall
|
|
56
|
-
#define __THISCALL__ __thiscall
|
|
57
|
-
#define __FASTCALL__ __fastcall
|
|
58
|
-
#endif
|
|
59
|
-
|
|
60
|
-
#ifndef ABI_NUM
|
|
61
|
-
#define ABI_NUM FFI_DEFAULT_ABI
|
|
62
|
-
#define ABI_ATTR
|
|
63
|
-
#endif
|
|
64
|
-
|
|
65
|
-
/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a
|
|
66
|
-
file open. */
|
|
67
|
-
#ifdef HAVE_MMAP_ANON
|
|
68
|
-
# undef HAVE_MMAP_DEV_ZERO
|
|
69
|
-
|
|
70
|
-
# include <sys/mman.h>
|
|
71
|
-
# ifndef MAP_FAILED
|
|
72
|
-
# define MAP_FAILED -1
|
|
73
|
-
# endif
|
|
74
|
-
# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
|
|
75
|
-
# define MAP_ANONYMOUS MAP_ANON
|
|
76
|
-
# endif
|
|
77
|
-
# define USING_MMAP
|
|
78
|
-
|
|
79
|
-
#endif
|
|
80
|
-
|
|
81
|
-
#ifdef HAVE_MMAP_DEV_ZERO
|
|
82
|
-
|
|
83
|
-
# include <sys/mman.h>
|
|
84
|
-
# ifndef MAP_FAILED
|
|
85
|
-
# define MAP_FAILED -1
|
|
86
|
-
# endif
|
|
87
|
-
# define USING_MMAP
|
|
88
|
-
|
|
89
|
-
#endif
|
|
90
|
-
|
|
91
|
-
/* msvc kludge. */
|
|
92
|
-
#if defined(_MSC_VER)
|
|
93
|
-
#define PRIdLL "I64d"
|
|
94
|
-
#define PRIuLL "I64u"
|
|
95
|
-
#else
|
|
96
|
-
#define PRIdLL "lld"
|
|
97
|
-
#define PRIuLL "llu"
|
|
98
|
-
#endif
|
|
99
|
-
|
|
100
|
-
/* Tru64 UNIX kludge. */
|
|
101
|
-
#if defined(__alpha__) && defined(__osf__)
|
|
102
|
-
/* Tru64 UNIX V4.0 doesn't support %lld/%lld, but long is 64-bit. */
|
|
103
|
-
#undef PRIdLL
|
|
104
|
-
#define PRIdLL "ld"
|
|
105
|
-
#undef PRIuLL
|
|
106
|
-
#define PRIuLL "lu"
|
|
107
|
-
#define PRId8 "hd"
|
|
108
|
-
#define PRIu8 "hu"
|
|
109
|
-
#define PRId64 "ld"
|
|
110
|
-
#define PRIu64 "lu"
|
|
111
|
-
#define PRIuPTR "lu"
|
|
112
|
-
#endif
|
|
113
|
-
|
|
114
|
-
/* PA HP-UX kludge. */
|
|
115
|
-
#if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR)
|
|
116
|
-
#define PRIuPTR "lu"
|
|
117
|
-
#endif
|
|
118
|
-
|
|
119
|
-
/* IRIX kludge. */
|
|
120
|
-
#if defined(__sgi)
|
|
121
|
-
/* IRIX 6.5 <inttypes.h> provides all definitions, but only for C99
|
|
122
|
-
compilations. */
|
|
123
|
-
#define PRId8 "hhd"
|
|
124
|
-
#define PRIu8 "hhu"
|
|
125
|
-
#if (_MIPS_SZLONG == 32)
|
|
126
|
-
#define PRId64 "lld"
|
|
127
|
-
#define PRIu64 "llu"
|
|
128
|
-
#endif
|
|
129
|
-
/* This doesn't match <inttypes.h>, which always has "lld" here, but the
|
|
130
|
-
arguments are uint64_t, int64_t, which are unsigned long, long for
|
|
131
|
-
64-bit in <sgidefs.h>. */
|
|
132
|
-
#if (_MIPS_SZLONG == 64)
|
|
133
|
-
#define PRId64 "ld"
|
|
134
|
-
#define PRIu64 "lu"
|
|
135
|
-
#endif
|
|
136
|
-
/* This doesn't match <inttypes.h>, which has "u" here, but the arguments
|
|
137
|
-
are uintptr_t, which is always unsigned long. */
|
|
138
|
-
#define PRIuPTR "lu"
|
|
139
|
-
#endif
|
|
140
|
-
|
|
141
|
-
/* Solaris < 10 kludge. */
|
|
142
|
-
#if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR)
|
|
143
|
-
#if defined(__arch64__) || defined (__x86_64__)
|
|
144
|
-
#define PRIuPTR "lu"
|
|
145
|
-
#else
|
|
146
|
-
#define PRIuPTR "u"
|
|
147
|
-
#endif
|
|
148
|
-
#endif
|
|
149
|
-
|
|
150
|
-
/* MSVC kludge. */
|
|
151
|
-
#if defined _MSC_VER
|
|
152
|
-
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
|
|
153
|
-
#define PRIuPTR "lu"
|
|
154
|
-
#define PRIu8 "u"
|
|
155
|
-
#define PRId8 "d"
|
|
156
|
-
#define PRIu64 "I64u"
|
|
157
|
-
#define PRId64 "I64d"
|
|
158
|
-
#endif
|
|
159
|
-
#endif
|
|
160
|
-
|
|
161
|
-
#ifndef PRIuPTR
|
|
162
|
-
#define PRIuPTR "u"
|
|
163
|
-
#endif
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call
|
|
2
|
-
Purpose: Check return value float.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: From the original ffitest.c */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
|
|
9
|
-
#include "ffitest.h"
|
|
10
|
-
|
|
11
|
-
static int floating(int a, float b, double c, long double d)
|
|
12
|
-
{
|
|
13
|
-
int i;
|
|
14
|
-
|
|
15
|
-
i = (int) ((float)a/b + ((float)c/(float)d));
|
|
16
|
-
|
|
17
|
-
return i;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
int main (void)
|
|
21
|
-
{
|
|
22
|
-
ffi_cif cif;
|
|
23
|
-
ffi_type *args[MAX_ARGS];
|
|
24
|
-
void *values[MAX_ARGS];
|
|
25
|
-
ffi_arg rint;
|
|
26
|
-
|
|
27
|
-
float f;
|
|
28
|
-
signed int si1;
|
|
29
|
-
double d;
|
|
30
|
-
long double ld;
|
|
31
|
-
|
|
32
|
-
args[0] = &ffi_type_sint;
|
|
33
|
-
values[0] = &si1;
|
|
34
|
-
args[1] = &ffi_type_float;
|
|
35
|
-
values[1] = &f;
|
|
36
|
-
args[2] = &ffi_type_double;
|
|
37
|
-
values[2] = &d;
|
|
38
|
-
args[3] = &ffi_type_longdouble;
|
|
39
|
-
values[3] = &ld;
|
|
40
|
-
|
|
41
|
-
/* Initialize the cif */
|
|
42
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
|
|
43
|
-
&ffi_type_sint, args) == FFI_OK);
|
|
44
|
-
|
|
45
|
-
si1 = 6;
|
|
46
|
-
f = 3.14159;
|
|
47
|
-
d = (double)1.0/(double)3.0;
|
|
48
|
-
ld = 2.71828182846L;
|
|
49
|
-
|
|
50
|
-
floating (si1, f, d, ld);
|
|
51
|
-
|
|
52
|
-
ffi_call(&cif, FFI_FN(floating), &rint, values);
|
|
53
|
-
|
|
54
|
-
printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld));
|
|
55
|
-
|
|
56
|
-
CHECK((int)rint == floating(si1, f, d, ld));
|
|
57
|
-
|
|
58
|
-
exit (0);
|
|
59
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call
|
|
2
|
-
Purpose: Check return value double.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: From the original ffitest.c */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
#include "float.h"
|
|
10
|
-
|
|
11
|
-
#include <math.h>
|
|
12
|
-
|
|
13
|
-
typedef union
|
|
14
|
-
{
|
|
15
|
-
double d;
|
|
16
|
-
unsigned char c[sizeof (double)];
|
|
17
|
-
} value_type;
|
|
18
|
-
|
|
19
|
-
#define CANARY 0xba
|
|
20
|
-
|
|
21
|
-
static double dblit(float f)
|
|
22
|
-
{
|
|
23
|
-
return f/3.0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
int main (void)
|
|
27
|
-
{
|
|
28
|
-
ffi_cif cif;
|
|
29
|
-
ffi_type *args[MAX_ARGS];
|
|
30
|
-
void *values[MAX_ARGS];
|
|
31
|
-
float f;
|
|
32
|
-
value_type result[2];
|
|
33
|
-
unsigned int i;
|
|
34
|
-
|
|
35
|
-
args[0] = &ffi_type_float;
|
|
36
|
-
values[0] = &f;
|
|
37
|
-
|
|
38
|
-
/* Initialize the cif */
|
|
39
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
|
40
|
-
&ffi_type_double, args) == FFI_OK);
|
|
41
|
-
|
|
42
|
-
f = 3.14159;
|
|
43
|
-
|
|
44
|
-
/* Put a canary in the return array. This is a regression test for
|
|
45
|
-
a buffer overrun. */
|
|
46
|
-
memset(result[1].c, CANARY, sizeof (double));
|
|
47
|
-
|
|
48
|
-
ffi_call(&cif, FFI_FN(dblit), &result[0].d, values);
|
|
49
|
-
|
|
50
|
-
/* These are not always the same!! Check for a reasonable delta */
|
|
51
|
-
|
|
52
|
-
CHECK(fabs(result[0].d - dblit(f)) < DBL_EPSILON);
|
|
53
|
-
|
|
54
|
-
/* Check the canary. */
|
|
55
|
-
for (i = 0; i < sizeof (double); ++i)
|
|
56
|
-
CHECK(result[1].c[i] == CANARY);
|
|
57
|
-
|
|
58
|
-
exit(0);
|
|
59
|
-
|
|
60
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call
|
|
2
|
-
Purpose: Check return value long double.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: From the original ffitest.c */
|
|
6
|
-
/* { dg-do run } */
|
|
7
|
-
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
#include "float.h"
|
|
10
|
-
|
|
11
|
-
#include <math.h>
|
|
12
|
-
|
|
13
|
-
static long double ldblit(float f)
|
|
14
|
-
{
|
|
15
|
-
return (long double) (((long double) f)/ (long double) 3.0);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
int main (void)
|
|
19
|
-
{
|
|
20
|
-
ffi_cif cif;
|
|
21
|
-
ffi_type *args[MAX_ARGS];
|
|
22
|
-
void *values[MAX_ARGS];
|
|
23
|
-
float f;
|
|
24
|
-
long double ld;
|
|
25
|
-
long double original;
|
|
26
|
-
|
|
27
|
-
args[0] = &ffi_type_float;
|
|
28
|
-
values[0] = &f;
|
|
29
|
-
|
|
30
|
-
/* Initialize the cif */
|
|
31
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
|
32
|
-
&ffi_type_longdouble, args) == FFI_OK);
|
|
33
|
-
|
|
34
|
-
f = 3.14159;
|
|
35
|
-
|
|
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
|
-
printf ("%Lf\n", ldblit(f));
|
|
41
|
-
#endif
|
|
42
|
-
|
|
43
|
-
ld = 666;
|
|
44
|
-
ffi_call(&cif, FFI_FN(ldblit), &ld, values);
|
|
45
|
-
|
|
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
|
|
50
|
-
printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
|
|
51
|
-
#endif
|
|
52
|
-
|
|
53
|
-
/* These are not always the same!! Check for a reasonable delta */
|
|
54
|
-
original = ldblit(f);
|
|
55
|
-
if (((ld > original) ? (ld - original) : (original - ld)) < LDBL_EPSILON)
|
|
56
|
-
puts("long double return value tests ok!");
|
|
57
|
-
else
|
|
58
|
-
CHECK(0);
|
|
59
|
-
|
|
60
|
-
exit(0);
|
|
61
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call
|
|
2
|
-
Purpose: Check float arguments with different orders.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: From the original ffitest.c */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
|
|
9
|
-
#include "ffitest.h"
|
|
10
|
-
#include "float.h"
|
|
11
|
-
|
|
12
|
-
#include <math.h>
|
|
13
|
-
|
|
14
|
-
static double floating_1(float a, double b, long double c)
|
|
15
|
-
{
|
|
16
|
-
return (double) a + b + (double) c;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static double floating_2(long double a, double b, float c)
|
|
20
|
-
{
|
|
21
|
-
return (double) a + b + (double) c;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
int main (void)
|
|
25
|
-
{
|
|
26
|
-
ffi_cif cif;
|
|
27
|
-
ffi_type *args[MAX_ARGS];
|
|
28
|
-
void *values[MAX_ARGS];
|
|
29
|
-
double rd;
|
|
30
|
-
|
|
31
|
-
float f;
|
|
32
|
-
double d;
|
|
33
|
-
long double ld;
|
|
34
|
-
|
|
35
|
-
args[0] = &ffi_type_float;
|
|
36
|
-
values[0] = &f;
|
|
37
|
-
args[1] = &ffi_type_double;
|
|
38
|
-
values[1] = &d;
|
|
39
|
-
args[2] = &ffi_type_longdouble;
|
|
40
|
-
values[2] = &ld;
|
|
41
|
-
|
|
42
|
-
/* Initialize the cif */
|
|
43
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
|
|
44
|
-
&ffi_type_double, args) == FFI_OK);
|
|
45
|
-
|
|
46
|
-
f = 3.14159;
|
|
47
|
-
d = (double)1.0/(double)3.0;
|
|
48
|
-
ld = 2.71828182846L;
|
|
49
|
-
|
|
50
|
-
floating_1 (f, d, ld);
|
|
51
|
-
|
|
52
|
-
ffi_call(&cif, FFI_FN(floating_1), &rd, values);
|
|
53
|
-
|
|
54
|
-
CHECK(fabs(rd - floating_1(f, d, ld)) < DBL_EPSILON);
|
|
55
|
-
|
|
56
|
-
args[0] = &ffi_type_longdouble;
|
|
57
|
-
values[0] = &ld;
|
|
58
|
-
args[1] = &ffi_type_double;
|
|
59
|
-
values[1] = &d;
|
|
60
|
-
args[2] = &ffi_type_float;
|
|
61
|
-
values[2] = &f;
|
|
62
|
-
|
|
63
|
-
/* Initialize the cif */
|
|
64
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
|
|
65
|
-
&ffi_type_double, args) == FFI_OK);
|
|
66
|
-
|
|
67
|
-
floating_2 (ld, d, f);
|
|
68
|
-
|
|
69
|
-
ffi_call(&cif, FFI_FN(floating_2), &rd, values);
|
|
70
|
-
|
|
71
|
-
CHECK(fabs(rd - floating_2(ld, d, f)) < DBL_EPSILON);
|
|
72
|
-
|
|
73
|
-
exit (0);
|
|
74
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call
|
|
2
|
-
Purpose: Check denorm double value.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: PR26483.
|
|
5
|
-
Originator: From the original ffitest.c */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
/* { dg-options "-mieee" { target alpha*-*-* } } */
|
|
9
|
-
|
|
10
|
-
#include "ffitest.h"
|
|
11
|
-
#include "float.h"
|
|
12
|
-
|
|
13
|
-
typedef union
|
|
14
|
-
{
|
|
15
|
-
double d;
|
|
16
|
-
unsigned char c[sizeof (double)];
|
|
17
|
-
} value_type;
|
|
18
|
-
|
|
19
|
-
#define CANARY 0xba
|
|
20
|
-
|
|
21
|
-
static double dblit(double d)
|
|
22
|
-
{
|
|
23
|
-
return d;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
int main (void)
|
|
27
|
-
{
|
|
28
|
-
ffi_cif cif;
|
|
29
|
-
ffi_type *args[MAX_ARGS];
|
|
30
|
-
void *values[MAX_ARGS];
|
|
31
|
-
double d;
|
|
32
|
-
value_type result[2];
|
|
33
|
-
unsigned int i;
|
|
34
|
-
|
|
35
|
-
args[0] = &ffi_type_double;
|
|
36
|
-
values[0] = &d;
|
|
37
|
-
|
|
38
|
-
/* Initialize the cif */
|
|
39
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
|
40
|
-
&ffi_type_double, args) == FFI_OK);
|
|
41
|
-
|
|
42
|
-
d = DBL_MIN / 2;
|
|
43
|
-
|
|
44
|
-
/* Put a canary in the return array. This is a regression test for
|
|
45
|
-
a buffer overrun. */
|
|
46
|
-
memset(result[1].c, CANARY, sizeof (double));
|
|
47
|
-
|
|
48
|
-
ffi_call(&cif, FFI_FN(dblit), &result[0].d, values);
|
|
49
|
-
|
|
50
|
-
/* The standard delta check doesn't work for denorms. Since we didn't do
|
|
51
|
-
any arithmetic, we should get the original result back, and hence an
|
|
52
|
-
exact check should be OK here. */
|
|
53
|
-
|
|
54
|
-
CHECK(result[0].d == dblit(d));
|
|
55
|
-
|
|
56
|
-
/* Check the canary. */
|
|
57
|
-
for (i = 0; i < sizeof (double); ++i)
|
|
58
|
-
CHECK(result[1].c[i] == CANARY);
|
|
59
|
-
|
|
60
|
-
exit(0);
|
|
61
|
-
|
|
62
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/* Area: fp and variadics
|
|
2
|
-
Purpose: check fp inputs and returns work on variadics, even the fixed params
|
|
3
|
-
Limitations: None
|
|
4
|
-
PR: none
|
|
5
|
-
Originator: <david.gilbert@linaro.org> 2011-01-25
|
|
6
|
-
|
|
7
|
-
Intended to stress the difference in ABI on ARM vfp
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/* { dg-do run } */
|
|
11
|
-
|
|
12
|
-
#include <stdarg.h>
|
|
13
|
-
|
|
14
|
-
#include "ffitest.h"
|
|
15
|
-
|
|
16
|
-
/* prints out all the parameters, and returns the sum of them all.
|
|
17
|
-
* 'x' is the number of variadic parameters all of which are double in this test
|
|
18
|
-
*/
|
|
19
|
-
double float_va_fn(unsigned int x, double y,...)
|
|
20
|
-
{
|
|
21
|
-
double total=0.0;
|
|
22
|
-
va_list ap;
|
|
23
|
-
unsigned int i;
|
|
24
|
-
|
|
25
|
-
total+=(double)x;
|
|
26
|
-
total+=y;
|
|
27
|
-
|
|
28
|
-
printf("%u: %.1f :", x, y);
|
|
29
|
-
|
|
30
|
-
va_start(ap, y);
|
|
31
|
-
for(i=0;i<x;i++)
|
|
32
|
-
{
|
|
33
|
-
double arg=va_arg(ap, double);
|
|
34
|
-
total+=arg;
|
|
35
|
-
printf(" %d:%.1f ", i, arg);
|
|
36
|
-
}
|
|
37
|
-
va_end(ap);
|
|
38
|
-
|
|
39
|
-
printf(" total: %.1f\n", total);
|
|
40
|
-
|
|
41
|
-
return total;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
int main (void)
|
|
45
|
-
{
|
|
46
|
-
ffi_cif cif;
|
|
47
|
-
|
|
48
|
-
ffi_type *arg_types[5];
|
|
49
|
-
void *values[5];
|
|
50
|
-
double doubles[5];
|
|
51
|
-
unsigned int firstarg;
|
|
52
|
-
double resfp;
|
|
53
|
-
|
|
54
|
-
/* First test, pass float_va_fn(0,2.0) - note there are no actual
|
|
55
|
-
* variadic parameters, but it's declared variadic so the ABI may be
|
|
56
|
-
* different. */
|
|
57
|
-
/* Call it statically and then via ffi */
|
|
58
|
-
resfp=float_va_fn(0,2.0);
|
|
59
|
-
/* { dg-output "0: 2.0 : total: 2.0" } */
|
|
60
|
-
printf("compiled: %.1f\n", resfp);
|
|
61
|
-
/* { dg-output "\ncompiled: 2.0" } */
|
|
62
|
-
|
|
63
|
-
arg_types[0] = &ffi_type_uint;
|
|
64
|
-
arg_types[1] = &ffi_type_double;
|
|
65
|
-
arg_types[2] = NULL;
|
|
66
|
-
CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 2, 2,
|
|
67
|
-
&ffi_type_double, arg_types) == FFI_OK);
|
|
68
|
-
|
|
69
|
-
firstarg = 0;
|
|
70
|
-
doubles[0] = 2.0;
|
|
71
|
-
values[0] = &firstarg;
|
|
72
|
-
values[1] = &doubles[0];
|
|
73
|
-
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
|
|
74
|
-
/* { dg-output "\n0: 2.0 : total: 2.0" } */
|
|
75
|
-
printf("ffi: %.1f\n", resfp);
|
|
76
|
-
/* { dg-output "\nffi: 2.0" } */
|
|
77
|
-
CHECK_DOUBLE_EQ(resfp, 2);
|
|
78
|
-
|
|
79
|
-
/* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */
|
|
80
|
-
/* Call it statically and then via ffi */
|
|
81
|
-
resfp=float_va_fn(2,2.0,3.0,4.0);
|
|
82
|
-
/* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
|
|
83
|
-
printf("compiled: %.1f\n", resfp);
|
|
84
|
-
/* { dg-output "\ncompiled: 11.0" } */
|
|
85
|
-
CHECK_DOUBLE_EQ(resfp, 11);
|
|
86
|
-
|
|
87
|
-
arg_types[0] = &ffi_type_uint;
|
|
88
|
-
arg_types[1] = &ffi_type_double;
|
|
89
|
-
arg_types[2] = &ffi_type_double;
|
|
90
|
-
arg_types[3] = &ffi_type_double;
|
|
91
|
-
arg_types[4] = NULL;
|
|
92
|
-
CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 2, 4,
|
|
93
|
-
&ffi_type_double, arg_types) == FFI_OK);
|
|
94
|
-
|
|
95
|
-
firstarg = 2;
|
|
96
|
-
doubles[0] = 2.0;
|
|
97
|
-
doubles[1] = 3.0;
|
|
98
|
-
doubles[2] = 4.0;
|
|
99
|
-
values[0] = &firstarg;
|
|
100
|
-
values[1] = &doubles[0];
|
|
101
|
-
values[2] = &doubles[1];
|
|
102
|
-
values[3] = &doubles[2];
|
|
103
|
-
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
|
|
104
|
-
/* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
|
|
105
|
-
printf("ffi: %.1f\n", resfp);
|
|
106
|
-
/* { dg-output "\nffi: 11.0" } */
|
|
107
|
-
CHECK_DOUBLE_EQ(resfp, 11);
|
|
108
|
-
|
|
109
|
-
exit(0);
|
|
110
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call
|
|
2
|
-
Purpose: Check return value float, with many arguments
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: From the original ffitest.c */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
|
|
10
|
-
#include <stdlib.h>
|
|
11
|
-
#include <float.h>
|
|
12
|
-
#include <math.h>
|
|
13
|
-
|
|
14
|
-
static float ABI_ATTR many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13)
|
|
15
|
-
{
|
|
16
|
-
#if 0
|
|
17
|
-
printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n",
|
|
18
|
-
(double) f1, (double) f2, (double) f3, (double) f4, (double) f5,
|
|
19
|
-
(double) f6, (double) f7, (double) f8, (double) f9, (double) f10,
|
|
20
|
-
(double) f11, (double) f12, (double) f13);
|
|
21
|
-
#endif
|
|
22
|
-
|
|
23
|
-
return f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
int main (void)
|
|
27
|
-
{
|
|
28
|
-
ffi_cif cif;
|
|
29
|
-
ffi_type *args[13];
|
|
30
|
-
void *values[13];
|
|
31
|
-
float fa[13];
|
|
32
|
-
float f, ff;
|
|
33
|
-
int i;
|
|
34
|
-
|
|
35
|
-
for (i = 0; i < 13; i++)
|
|
36
|
-
{
|
|
37
|
-
args[i] = &ffi_type_float;
|
|
38
|
-
values[i] = &fa[i];
|
|
39
|
-
fa[i] = (float) i;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* Initialize the cif */
|
|
43
|
-
CHECK(ffi_prep_cif(&cif, ABI_NUM, 13,
|
|
44
|
-
&ffi_type_float, args) == FFI_OK);
|
|
45
|
-
|
|
46
|
-
ffi_call(&cif, FFI_FN(many), &f, values);
|
|
47
|
-
|
|
48
|
-
ff = many(fa[0], fa[1],
|
|
49
|
-
fa[2], fa[3],
|
|
50
|
-
fa[4], fa[5],
|
|
51
|
-
fa[6], fa[7],
|
|
52
|
-
fa[8], fa[9],
|
|
53
|
-
fa[10],fa[11],fa[12]);
|
|
54
|
-
|
|
55
|
-
if (fabs(f - ff) < FLT_EPSILON)
|
|
56
|
-
exit(0);
|
|
57
|
-
else
|
|
58
|
-
abort();
|
|
59
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call
|
|
2
|
-
Purpose: Check uint8_t arguments.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: PR45677.
|
|
5
|
-
Originator: Dan Witte <dwitte@gmail.com> 20100916 */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
|
|
9
|
-
#include "ffitest.h"
|
|
10
|
-
|
|
11
|
-
#define NARGS 7
|
|
12
|
-
|
|
13
|
-
typedef unsigned char u8;
|
|
14
|
-
|
|
15
|
-
#ifdef __GNUC__
|
|
16
|
-
__attribute__((noinline))
|
|
17
|
-
#endif
|
|
18
|
-
uint8_t
|
|
19
|
-
foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d,
|
|
20
|
-
uint8_t e, uint8_t f, uint8_t g)
|
|
21
|
-
{
|
|
22
|
-
return a + b + c + d + e + f + g;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
uint8_t ABI_ATTR
|
|
26
|
-
bar (uint8_t a, uint8_t b, uint8_t c, uint8_t d,
|
|
27
|
-
uint8_t e, uint8_t f, uint8_t g)
|
|
28
|
-
{
|
|
29
|
-
return foo (a, b, c, d, e, f, g);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
int
|
|
33
|
-
main (void)
|
|
34
|
-
{
|
|
35
|
-
ffi_type *ffitypes[NARGS];
|
|
36
|
-
int i;
|
|
37
|
-
ffi_cif cif;
|
|
38
|
-
ffi_arg result = 0;
|
|
39
|
-
uint8_t args[NARGS];
|
|
40
|
-
void *argptrs[NARGS];
|
|
41
|
-
|
|
42
|
-
for (i = 0; i < NARGS; ++i)
|
|
43
|
-
ffitypes[i] = &ffi_type_uint8;
|
|
44
|
-
|
|
45
|
-
CHECK (ffi_prep_cif (&cif, ABI_NUM, NARGS,
|
|
46
|
-
&ffi_type_uint8, ffitypes) == FFI_OK);
|
|
47
|
-
|
|
48
|
-
for (i = 0; i < NARGS; ++i)
|
|
49
|
-
{
|
|
50
|
-
args[i] = i;
|
|
51
|
-
argptrs[i] = &args[i];
|
|
52
|
-
}
|
|
53
|
-
ffi_call (&cif, FFI_FN (bar), &result, argptrs);
|
|
54
|
-
|
|
55
|
-
CHECK (result == 21);
|
|
56
|
-
return 0;
|
|
57
|
-
}
|