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,115 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call, closure_call
|
|
2
|
-
Purpose: Check long double arguments.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: Blake Chaffin */
|
|
6
|
-
|
|
7
|
-
/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have
|
|
8
|
-
remove the xfail for arm*-*-* below, until we know more. */
|
|
9
|
-
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
|
|
10
|
-
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux-gnu* } } */
|
|
11
|
-
|
|
12
|
-
#include "ffitest.h"
|
|
13
|
-
|
|
14
|
-
long double cls_ldouble_fn(
|
|
15
|
-
long double a1,
|
|
16
|
-
long double a2,
|
|
17
|
-
long double a3,
|
|
18
|
-
long double a4,
|
|
19
|
-
long double a5,
|
|
20
|
-
long double a6,
|
|
21
|
-
long double a7,
|
|
22
|
-
long double a8)
|
|
23
|
-
{
|
|
24
|
-
long double r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8;
|
|
25
|
-
|
|
26
|
-
printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: %Lg\n",
|
|
27
|
-
a1, a2, a3, a4, a5, a6, a7, a8, r);
|
|
28
|
-
CHECK(a1 == 1);
|
|
29
|
-
CHECK(a2 == 2);
|
|
30
|
-
CHECK(a3 == 3);
|
|
31
|
-
CHECK(a4 == 4);
|
|
32
|
-
CHECK(a5 == 5);
|
|
33
|
-
CHECK(a6 == 6);
|
|
34
|
-
CHECK(a7 == 7);
|
|
35
|
-
CHECK(a8 == 8);
|
|
36
|
-
|
|
37
|
-
return r;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static void
|
|
41
|
-
cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp,
|
|
42
|
-
void** args, void* userdata __UNUSED__)
|
|
43
|
-
{
|
|
44
|
-
long double a1 = *(long double*)args[0];
|
|
45
|
-
long double a2 = *(long double*)args[1];
|
|
46
|
-
long double a3 = *(long double*)args[2];
|
|
47
|
-
long double a4 = *(long double*)args[3];
|
|
48
|
-
long double a5 = *(long double*)args[4];
|
|
49
|
-
long double a6 = *(long double*)args[5];
|
|
50
|
-
long double a7 = *(long double*)args[6];
|
|
51
|
-
long double a8 = *(long double*)args[7];
|
|
52
|
-
|
|
53
|
-
*(long double*)resp = cls_ldouble_fn(
|
|
54
|
-
a1, a2, a3, a4, a5, a6, a7, a8);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
int main(void)
|
|
58
|
-
{
|
|
59
|
-
ffi_cif cif;
|
|
60
|
-
void* code;
|
|
61
|
-
ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
|
62
|
-
void* args[9];
|
|
63
|
-
ffi_type* arg_types[9];
|
|
64
|
-
long double res = 0;
|
|
65
|
-
|
|
66
|
-
long double arg1 = 1;
|
|
67
|
-
long double arg2 = 2;
|
|
68
|
-
long double arg3 = 3;
|
|
69
|
-
long double arg4 = 4;
|
|
70
|
-
long double arg5 = 5;
|
|
71
|
-
long double arg6 = 6;
|
|
72
|
-
long double arg7 = 7;
|
|
73
|
-
long double arg8 = 8;
|
|
74
|
-
|
|
75
|
-
arg_types[0] = &ffi_type_longdouble;
|
|
76
|
-
arg_types[1] = &ffi_type_longdouble;
|
|
77
|
-
arg_types[2] = &ffi_type_longdouble;
|
|
78
|
-
arg_types[3] = &ffi_type_longdouble;
|
|
79
|
-
arg_types[4] = &ffi_type_longdouble;
|
|
80
|
-
arg_types[5] = &ffi_type_longdouble;
|
|
81
|
-
arg_types[6] = &ffi_type_longdouble;
|
|
82
|
-
arg_types[7] = &ffi_type_longdouble;
|
|
83
|
-
arg_types[8] = NULL;
|
|
84
|
-
|
|
85
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 8, &ffi_type_longdouble,
|
|
86
|
-
arg_types) == FFI_OK);
|
|
87
|
-
|
|
88
|
-
args[0] = &arg1;
|
|
89
|
-
args[1] = &arg2;
|
|
90
|
-
args[2] = &arg3;
|
|
91
|
-
args[3] = &arg4;
|
|
92
|
-
args[4] = &arg5;
|
|
93
|
-
args[5] = &arg6;
|
|
94
|
-
args[6] = &arg7;
|
|
95
|
-
args[7] = &arg8;
|
|
96
|
-
args[8] = NULL;
|
|
97
|
-
|
|
98
|
-
ffi_call(&cif, FFI_FN(cls_ldouble_fn), &res, args);
|
|
99
|
-
/* { dg-output "1 2 3 4 5 6 7 8: 36" } */
|
|
100
|
-
printf("res: %Lg\n", res);
|
|
101
|
-
/* { dg-output "\nres: 36" } */
|
|
102
|
-
CHECK(res == 36);
|
|
103
|
-
|
|
104
|
-
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK);
|
|
105
|
-
|
|
106
|
-
res = ((long double(*)(long double, long double, long double, long double,
|
|
107
|
-
long double, long double, long double, long double))(code))(arg1, arg2,
|
|
108
|
-
arg3, arg4, arg5, arg6, arg7, arg8);
|
|
109
|
-
/* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */
|
|
110
|
-
printf("res: %Lg\n", res);
|
|
111
|
-
/* { dg-output "\nres: 36" } */
|
|
112
|
-
CHECK(res == 36);
|
|
113
|
-
|
|
114
|
-
return 0;
|
|
115
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call, closure_call
|
|
2
|
-
Purpose: Test long doubles passed in variable argument lists.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: Blake Chaffin 6/6/2007 */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
|
|
8
|
-
/* { dg-output "" { xfail avr32*-*-* } } */
|
|
9
|
-
/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */
|
|
10
|
-
|
|
11
|
-
#include "ffitest.h"
|
|
12
|
-
#include <stdarg.h>
|
|
13
|
-
|
|
14
|
-
#define BUF_SIZE 50
|
|
15
|
-
static char buffer[BUF_SIZE];
|
|
16
|
-
|
|
17
|
-
static int
|
|
18
|
-
wrap_printf(char* fmt, ...) {
|
|
19
|
-
va_list ap;
|
|
20
|
-
va_start(ap, fmt);
|
|
21
|
-
long double ldArg = va_arg(ap, long double);
|
|
22
|
-
va_end(ap);
|
|
23
|
-
CHECK((int)ldArg == 7);
|
|
24
|
-
return printf(fmt, ldArg);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static void
|
|
28
|
-
cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp,
|
|
29
|
-
void** args, void* userdata __UNUSED__)
|
|
30
|
-
{
|
|
31
|
-
char* format = *(char**)args[0];
|
|
32
|
-
long double ldValue = *(long double*)args[1];
|
|
33
|
-
|
|
34
|
-
*(ffi_arg*)resp = printf(format, ldValue);
|
|
35
|
-
CHECK(*(ffi_arg*)resp == 4);
|
|
36
|
-
snprintf(buffer, BUF_SIZE, format, ldValue);
|
|
37
|
-
CHECK(strncmp(buffer, "7.0\n", BUF_SIZE) == 0);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
int main (void)
|
|
41
|
-
{
|
|
42
|
-
ffi_cif cif;
|
|
43
|
-
void *code;
|
|
44
|
-
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
|
45
|
-
void* args[3];
|
|
46
|
-
ffi_type* arg_types[3];
|
|
47
|
-
|
|
48
|
-
char* format = "%.1Lf\n";
|
|
49
|
-
long double ldArg = 7;
|
|
50
|
-
ffi_arg res = 0;
|
|
51
|
-
|
|
52
|
-
arg_types[0] = &ffi_type_pointer;
|
|
53
|
-
arg_types[1] = &ffi_type_longdouble;
|
|
54
|
-
arg_types[2] = NULL;
|
|
55
|
-
|
|
56
|
-
/* This printf call is variadic */
|
|
57
|
-
CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint,
|
|
58
|
-
arg_types) == FFI_OK);
|
|
59
|
-
|
|
60
|
-
args[0] = &format;
|
|
61
|
-
args[1] = &ldArg;
|
|
62
|
-
args[2] = NULL;
|
|
63
|
-
|
|
64
|
-
ffi_call(&cif, FFI_FN(wrap_printf), &res, args);
|
|
65
|
-
/* { dg-output "7.0" } */
|
|
66
|
-
printf("res: %d\n", (int) res);
|
|
67
|
-
/* { dg-output "\nres: 4" } */
|
|
68
|
-
CHECK(res == 4);
|
|
69
|
-
|
|
70
|
-
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL,
|
|
71
|
-
code) == FFI_OK);
|
|
72
|
-
|
|
73
|
-
res = ((int(*)(char*, ...))(code))(format, ldArg);
|
|
74
|
-
/* { dg-output "\n7.0" } */
|
|
75
|
-
printf("res: %d\n", (int) res);
|
|
76
|
-
/* { dg-output "\nres: 4" } */
|
|
77
|
-
CHECK(res == 4);
|
|
78
|
-
|
|
79
|
-
exit(0);
|
|
80
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/* Area: closure_call
|
|
2
|
-
Purpose: Check closures called with many args of mixed types
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: <david.schneider@picle.org> */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
#include <float.h>
|
|
10
|
-
#include <math.h>
|
|
11
|
-
|
|
12
|
-
#define NARGS 16
|
|
13
|
-
|
|
14
|
-
static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
|
|
15
|
-
void* userdata __UNUSED__)
|
|
16
|
-
{
|
|
17
|
-
int i;
|
|
18
|
-
double r = 0;
|
|
19
|
-
double t;
|
|
20
|
-
for(i = 0; i < NARGS; i++)
|
|
21
|
-
{
|
|
22
|
-
if(i == 4 || i == 9 || i == 11 || i == 13 || i == 15)
|
|
23
|
-
{
|
|
24
|
-
t = *(long int *)args[i];
|
|
25
|
-
CHECK(t == i+1);
|
|
26
|
-
}
|
|
27
|
-
else
|
|
28
|
-
{
|
|
29
|
-
t = *(double *)args[i];
|
|
30
|
-
CHECK(fabs(t - ((i+1) * 0.1)) < FLT_EPSILON);
|
|
31
|
-
}
|
|
32
|
-
r += t;
|
|
33
|
-
}
|
|
34
|
-
*(double *)resp = r;
|
|
35
|
-
}
|
|
36
|
-
typedef double (*cls_ret_double)(double, double, double, double, long int,
|
|
37
|
-
double, double, double, double, long int, double, long int, double, long int,
|
|
38
|
-
double, long int);
|
|
39
|
-
|
|
40
|
-
int main (void)
|
|
41
|
-
{
|
|
42
|
-
ffi_cif cif;
|
|
43
|
-
void *code;
|
|
44
|
-
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
|
45
|
-
ffi_type * cl_arg_types[NARGS];
|
|
46
|
-
double res;
|
|
47
|
-
int i;
|
|
48
|
-
double expected = 64.9;
|
|
49
|
-
|
|
50
|
-
for(i = 0; i < NARGS; i++)
|
|
51
|
-
{
|
|
52
|
-
if(i == 4 || i == 9 || i == 11 || i == 13 || i == 15)
|
|
53
|
-
cl_arg_types[i] = &ffi_type_slong;
|
|
54
|
-
else
|
|
55
|
-
cl_arg_types[i] = &ffi_type_double;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/* Initialize the cif */
|
|
59
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, NARGS,
|
|
60
|
-
&ffi_type_double, cl_arg_types) == FFI_OK);
|
|
61
|
-
|
|
62
|
-
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK);
|
|
63
|
-
|
|
64
|
-
res = (((cls_ret_double)code))(0.1, 0.2, 0.3, 0.4, 5, 0.6, 0.7, 0.8, 0.9, 10,
|
|
65
|
-
1.1, 12, 1.3, 14, 1.5, 16);
|
|
66
|
-
if (fabs(res - expected) < FLT_EPSILON)
|
|
67
|
-
exit(0);
|
|
68
|
-
else
|
|
69
|
-
abort();
|
|
70
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/* Area: closure_call
|
|
2
|
-
Purpose: Check register allocation for closure calls with many float and double arguments
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: none.
|
|
5
|
-
Originator: <david.schneider@picle.org> */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
#include <float.h>
|
|
10
|
-
#include <math.h>
|
|
11
|
-
|
|
12
|
-
#define NARGS 16
|
|
13
|
-
|
|
14
|
-
static void cls_mixed_float_double_fn(ffi_cif* cif , void* ret, void** args,
|
|
15
|
-
void* userdata __UNUSED__)
|
|
16
|
-
{
|
|
17
|
-
double r = 0;
|
|
18
|
-
unsigned int i;
|
|
19
|
-
double t;
|
|
20
|
-
for(i=0; i < cif->nargs; i++)
|
|
21
|
-
{
|
|
22
|
-
if(cif->arg_types[i] == &ffi_type_double) {
|
|
23
|
-
t = *(((double**)(args))[i]);
|
|
24
|
-
} else {
|
|
25
|
-
t = *(((float**)(args))[i]);
|
|
26
|
-
}
|
|
27
|
-
r += t;
|
|
28
|
-
}
|
|
29
|
-
*((double*)ret) = r;
|
|
30
|
-
}
|
|
31
|
-
typedef double (*cls_mixed)(double, float, double, double, double, double, double, float, float, double, float, float);
|
|
32
|
-
|
|
33
|
-
int main (void)
|
|
34
|
-
{
|
|
35
|
-
ffi_cif cif;
|
|
36
|
-
ffi_closure *closure;
|
|
37
|
-
void* code;
|
|
38
|
-
ffi_type *argtypes[12] = {&ffi_type_double, &ffi_type_float, &ffi_type_double,
|
|
39
|
-
&ffi_type_double, &ffi_type_double, &ffi_type_double,
|
|
40
|
-
&ffi_type_double, &ffi_type_float, &ffi_type_float,
|
|
41
|
-
&ffi_type_double, &ffi_type_float, &ffi_type_float};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
closure = ffi_closure_alloc(sizeof(ffi_closure), (void**)&code);
|
|
45
|
-
if(closure ==NULL)
|
|
46
|
-
abort();
|
|
47
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 12, &ffi_type_double, argtypes) == FFI_OK);
|
|
48
|
-
CHECK(ffi_prep_closure_loc(closure, &cif, cls_mixed_float_double_fn, NULL, code) == FFI_OK);
|
|
49
|
-
double ret = ((cls_mixed)code)(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2);
|
|
50
|
-
ffi_closure_free(closure);
|
|
51
|
-
if(fabs(ret - 7.8) < FLT_EPSILON)
|
|
52
|
-
exit(0);
|
|
53
|
-
else
|
|
54
|
-
abort();
|
|
55
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call, closure_call
|
|
2
|
-
Purpose: Check passing of multiple signed char values.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: PR13221.
|
|
5
|
-
Originator: <hos@tamanegi.org> 20031129 */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
|
|
10
|
-
static signed char test_func_fn(signed char a1, signed char a2)
|
|
11
|
-
{
|
|
12
|
-
signed char result;
|
|
13
|
-
|
|
14
|
-
result = a1 + a2;
|
|
15
|
-
|
|
16
|
-
printf("%d %d: %d\n", a1, a2, result);
|
|
17
|
-
|
|
18
|
-
return result;
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals,
|
|
23
|
-
void *data __UNUSED__)
|
|
24
|
-
{
|
|
25
|
-
signed char a1, a2;
|
|
26
|
-
|
|
27
|
-
a1 = *(signed char *)avals[0];
|
|
28
|
-
a2 = *(signed char *)avals[1];
|
|
29
|
-
CHECK(a1 == 2);
|
|
30
|
-
CHECK(a2 == 125);
|
|
31
|
-
|
|
32
|
-
*(ffi_arg *)rval = test_func_fn(a1, a2);
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
typedef signed char (*test_type)(signed char, signed char);
|
|
37
|
-
|
|
38
|
-
int main (void)
|
|
39
|
-
{
|
|
40
|
-
ffi_cif cif;
|
|
41
|
-
void *code;
|
|
42
|
-
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
|
43
|
-
void * args_dbl[3];
|
|
44
|
-
ffi_type * cl_arg_types[3];
|
|
45
|
-
ffi_arg res_call;
|
|
46
|
-
signed char a, b, res_closure;
|
|
47
|
-
|
|
48
|
-
a = 2;
|
|
49
|
-
b = 125;
|
|
50
|
-
|
|
51
|
-
args_dbl[0] = &a;
|
|
52
|
-
args_dbl[1] = &b;
|
|
53
|
-
args_dbl[2] = NULL;
|
|
54
|
-
|
|
55
|
-
cl_arg_types[0] = &ffi_type_schar;
|
|
56
|
-
cl_arg_types[1] = &ffi_type_schar;
|
|
57
|
-
cl_arg_types[2] = NULL;
|
|
58
|
-
|
|
59
|
-
/* Initialize the cif */
|
|
60
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2,
|
|
61
|
-
&ffi_type_schar, cl_arg_types) == FFI_OK);
|
|
62
|
-
|
|
63
|
-
ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl);
|
|
64
|
-
/* { dg-output "2 125: 127" } */
|
|
65
|
-
printf("res: %d\n", (signed char)res_call);
|
|
66
|
-
/* { dg-output "\nres: 127" } */
|
|
67
|
-
CHECK((signed char)res_call == 127);
|
|
68
|
-
|
|
69
|
-
CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
|
|
70
|
-
|
|
71
|
-
res_closure = (*((test_type)code))(2, 125);
|
|
72
|
-
/* { dg-output "\n2 125: 127" } */
|
|
73
|
-
printf("res: %d\n", res_closure);
|
|
74
|
-
/* { dg-output "\nres: 127" } */
|
|
75
|
-
CHECK(res_closure == 127);
|
|
76
|
-
|
|
77
|
-
exit(0);
|
|
78
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call, closure_call
|
|
2
|
-
Purpose: Check passing of multiple signed short values.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: PR13221.
|
|
5
|
-
Originator: <andreast@gcc.gnu.org> 20031129 */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
|
|
10
|
-
static signed short test_func_fn(signed short a1, signed short a2)
|
|
11
|
-
{
|
|
12
|
-
signed short result;
|
|
13
|
-
|
|
14
|
-
result = a1 + a2;
|
|
15
|
-
|
|
16
|
-
printf("%d %d: %d\n", a1, a2, result);
|
|
17
|
-
CHECK(a1 == 2);
|
|
18
|
-
CHECK(a2 == 32765);
|
|
19
|
-
CHECK(result == 32767);
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals,
|
|
26
|
-
void *data __UNUSED__)
|
|
27
|
-
{
|
|
28
|
-
signed short a1, a2;
|
|
29
|
-
|
|
30
|
-
a1 = *(signed short *)avals[0];
|
|
31
|
-
a2 = *(signed short *)avals[1];
|
|
32
|
-
|
|
33
|
-
*(ffi_arg *)rval = test_func_fn(a1, a2);
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
typedef signed short (*test_type)(signed short, signed short);
|
|
38
|
-
|
|
39
|
-
int main (void)
|
|
40
|
-
{
|
|
41
|
-
ffi_cif cif;
|
|
42
|
-
void *code;
|
|
43
|
-
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
|
44
|
-
void * args_dbl[3];
|
|
45
|
-
ffi_type * cl_arg_types[3];
|
|
46
|
-
ffi_arg res_call;
|
|
47
|
-
unsigned short a, b, res_closure;
|
|
48
|
-
|
|
49
|
-
a = 2;
|
|
50
|
-
b = 32765;
|
|
51
|
-
|
|
52
|
-
args_dbl[0] = &a;
|
|
53
|
-
args_dbl[1] = &b;
|
|
54
|
-
args_dbl[2] = NULL;
|
|
55
|
-
|
|
56
|
-
cl_arg_types[0] = &ffi_type_sshort;
|
|
57
|
-
cl_arg_types[1] = &ffi_type_sshort;
|
|
58
|
-
cl_arg_types[2] = NULL;
|
|
59
|
-
|
|
60
|
-
/* Initialize the cif */
|
|
61
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2,
|
|
62
|
-
&ffi_type_sshort, cl_arg_types) == FFI_OK);
|
|
63
|
-
|
|
64
|
-
ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl);
|
|
65
|
-
/* { dg-output "2 32765: 32767" } */
|
|
66
|
-
printf("res: %d\n", (unsigned short)res_call);
|
|
67
|
-
/* { dg-output "\nres: 32767" } */
|
|
68
|
-
CHECK((unsigned short)res_call == 32767);
|
|
69
|
-
|
|
70
|
-
CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
|
|
71
|
-
|
|
72
|
-
res_closure = (*((test_type)code))(2, 32765);
|
|
73
|
-
/* { dg-output "\n2 32765: 32767" } */
|
|
74
|
-
printf("res: %d\n", res_closure);
|
|
75
|
-
/* { dg-output "\nres: 32767" } */
|
|
76
|
-
CHECK(res_closure == 32767);
|
|
77
|
-
|
|
78
|
-
exit(0);
|
|
79
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call, closure_call
|
|
2
|
-
Purpose: Check passing of multiple signed short/char values.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: PR13221.
|
|
5
|
-
Originator: <andreast@gcc.gnu.org> 20031129 */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
|
|
10
|
-
static signed short test_func_fn(signed char a1, signed short a2,
|
|
11
|
-
signed char a3, signed short a4)
|
|
12
|
-
{
|
|
13
|
-
signed short result;
|
|
14
|
-
|
|
15
|
-
result = a1 + a2 + a3 + a4;
|
|
16
|
-
|
|
17
|
-
printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result);
|
|
18
|
-
|
|
19
|
-
CHECK(a1 == 1);
|
|
20
|
-
CHECK(a2 == 32765);
|
|
21
|
-
CHECK(a3 == 127);
|
|
22
|
-
CHECK(a4 == -128);
|
|
23
|
-
CHECK(result == 32765);
|
|
24
|
-
|
|
25
|
-
return result;
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals,
|
|
30
|
-
void *data __UNUSED__)
|
|
31
|
-
{
|
|
32
|
-
signed char a1, a3;
|
|
33
|
-
signed short a2, a4;
|
|
34
|
-
|
|
35
|
-
a1 = *(signed char *)avals[0];
|
|
36
|
-
a2 = *(signed short *)avals[1];
|
|
37
|
-
a3 = *(signed char *)avals[2];
|
|
38
|
-
a4 = *(signed short *)avals[3];
|
|
39
|
-
|
|
40
|
-
*(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4);
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
typedef signed short (*test_type)(signed char, signed short,
|
|
45
|
-
signed char, signed short);
|
|
46
|
-
|
|
47
|
-
int main (void)
|
|
48
|
-
{
|
|
49
|
-
ffi_cif cif;
|
|
50
|
-
void *code;
|
|
51
|
-
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
|
52
|
-
void * args_dbl[5];
|
|
53
|
-
ffi_type * cl_arg_types[5];
|
|
54
|
-
ffi_arg res_call;
|
|
55
|
-
signed char a, c;
|
|
56
|
-
signed short b, d, res_closure;
|
|
57
|
-
|
|
58
|
-
a = 1;
|
|
59
|
-
b = 32765;
|
|
60
|
-
c = 127;
|
|
61
|
-
d = -128;
|
|
62
|
-
|
|
63
|
-
args_dbl[0] = &a;
|
|
64
|
-
args_dbl[1] = &b;
|
|
65
|
-
args_dbl[2] = &c;
|
|
66
|
-
args_dbl[3] = &d;
|
|
67
|
-
args_dbl[4] = NULL;
|
|
68
|
-
|
|
69
|
-
cl_arg_types[0] = &ffi_type_schar;
|
|
70
|
-
cl_arg_types[1] = &ffi_type_sshort;
|
|
71
|
-
cl_arg_types[2] = &ffi_type_schar;
|
|
72
|
-
cl_arg_types[3] = &ffi_type_sshort;
|
|
73
|
-
cl_arg_types[4] = NULL;
|
|
74
|
-
|
|
75
|
-
/* Initialize the cif */
|
|
76
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
|
|
77
|
-
&ffi_type_sshort, cl_arg_types) == FFI_OK);
|
|
78
|
-
|
|
79
|
-
ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl);
|
|
80
|
-
/* { dg-output "1 32765 127 -128: 32765" } */
|
|
81
|
-
printf("res: %d\n", (signed short)res_call);
|
|
82
|
-
/* { dg-output "\nres: 32765" } */
|
|
83
|
-
CHECK((signed short)res_call == 32765);
|
|
84
|
-
|
|
85
|
-
CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
|
|
86
|
-
|
|
87
|
-
res_closure = (*((test_type)code))(1, 32765, 127, -128);
|
|
88
|
-
/* { dg-output "\n1 32765 127 -128: 32765" } */
|
|
89
|
-
printf("res: %d\n", res_closure);
|
|
90
|
-
/* { dg-output "\nres: 32765" } */
|
|
91
|
-
CHECK(res_closure == 32765);
|
|
92
|
-
|
|
93
|
-
exit(0);
|
|
94
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/* Area: ffi_call, closure_call
|
|
2
|
-
Purpose: Check passing of multiple unsigned char values.
|
|
3
|
-
Limitations: none.
|
|
4
|
-
PR: PR13221.
|
|
5
|
-
Originator: <andreast@gcc.gnu.org> 20031129 */
|
|
6
|
-
|
|
7
|
-
/* { dg-do run } */
|
|
8
|
-
#include "ffitest.h"
|
|
9
|
-
|
|
10
|
-
static unsigned char test_func_fn(unsigned char a1, unsigned char a2,
|
|
11
|
-
unsigned char a3, unsigned char a4)
|
|
12
|
-
{
|
|
13
|
-
unsigned char result;
|
|
14
|
-
|
|
15
|
-
result = a1 + a2 + a3 + a4;
|
|
16
|
-
|
|
17
|
-
printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result);
|
|
18
|
-
|
|
19
|
-
CHECK(a1 == 1);
|
|
20
|
-
CHECK(a2 == 2);
|
|
21
|
-
CHECK(a3 == 127);
|
|
22
|
-
CHECK(a4 == 125);
|
|
23
|
-
CHECK(result == 255);
|
|
24
|
-
|
|
25
|
-
return result;
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals,
|
|
30
|
-
void *data __UNUSED__)
|
|
31
|
-
{
|
|
32
|
-
unsigned char a1, a2, a3, a4;
|
|
33
|
-
|
|
34
|
-
a1 = *(unsigned char *)avals[0];
|
|
35
|
-
a2 = *(unsigned char *)avals[1];
|
|
36
|
-
a3 = *(unsigned char *)avals[2];
|
|
37
|
-
a4 = *(unsigned char *)avals[3];
|
|
38
|
-
|
|
39
|
-
*(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4);
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
typedef unsigned char (*test_type)(unsigned char, unsigned char,
|
|
44
|
-
unsigned char, unsigned char);
|
|
45
|
-
|
|
46
|
-
void test_func(ffi_cif *cif __UNUSED__, void *rval __UNUSED__, void **avals,
|
|
47
|
-
void *data __UNUSED__)
|
|
48
|
-
{
|
|
49
|
-
printf("%d %d %d %d\n", *(unsigned char *)avals[0],
|
|
50
|
-
*(unsigned char *)avals[1], *(unsigned char *)avals[2],
|
|
51
|
-
*(unsigned char *)avals[3]);
|
|
52
|
-
}
|
|
53
|
-
int main (void)
|
|
54
|
-
{
|
|
55
|
-
ffi_cif cif;
|
|
56
|
-
void *code;
|
|
57
|
-
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
|
58
|
-
void * args_dbl[5];
|
|
59
|
-
ffi_type * cl_arg_types[5];
|
|
60
|
-
ffi_arg res_call;
|
|
61
|
-
unsigned char a, b, c, d, res_closure;
|
|
62
|
-
|
|
63
|
-
a = 1;
|
|
64
|
-
b = 2;
|
|
65
|
-
c = 127;
|
|
66
|
-
d = 125;
|
|
67
|
-
|
|
68
|
-
args_dbl[0] = &a;
|
|
69
|
-
args_dbl[1] = &b;
|
|
70
|
-
args_dbl[2] = &c;
|
|
71
|
-
args_dbl[3] = &d;
|
|
72
|
-
args_dbl[4] = NULL;
|
|
73
|
-
|
|
74
|
-
cl_arg_types[0] = &ffi_type_uchar;
|
|
75
|
-
cl_arg_types[1] = &ffi_type_uchar;
|
|
76
|
-
cl_arg_types[2] = &ffi_type_uchar;
|
|
77
|
-
cl_arg_types[3] = &ffi_type_uchar;
|
|
78
|
-
cl_arg_types[4] = NULL;
|
|
79
|
-
|
|
80
|
-
/* Initialize the cif */
|
|
81
|
-
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
|
|
82
|
-
&ffi_type_uchar, cl_arg_types) == FFI_OK);
|
|
83
|
-
|
|
84
|
-
ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl);
|
|
85
|
-
/* { dg-output "1 2 127 125: 255" } */
|
|
86
|
-
printf("res: %d\n", (unsigned char)res_call);
|
|
87
|
-
/* { dg-output "\nres: 255" } */
|
|
88
|
-
CHECK((unsigned char)res_call == 255);
|
|
89
|
-
|
|
90
|
-
CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
|
|
91
|
-
|
|
92
|
-
res_closure = (*((test_type)code))(1, 2, 127, 125);
|
|
93
|
-
/* { dg-output "\n1 2 127 125: 255" } */
|
|
94
|
-
printf("res: %d\n", res_closure);
|
|
95
|
-
/* { dg-output "\nres: 255" } */
|
|
96
|
-
CHECK(res_closure == 255);
|
|
97
|
-
|
|
98
|
-
exit(0);
|
|
99
|
-
}
|