ffi 1.15.5 → 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (343) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +118 -0
  4. data/Gemfile +10 -3
  5. data/README.md +4 -3
  6. data/Rakefile +25 -10
  7. data/ext/ffi_c/AbstractMemory.c +99 -74
  8. data/ext/ffi_c/AbstractMemory.h +3 -2
  9. data/ext/ffi_c/ArrayType.c +51 -15
  10. data/ext/ffi_c/ArrayType.h +1 -0
  11. data/ext/ffi_c/Buffer.c +90 -33
  12. data/ext/ffi_c/Call.c +29 -12
  13. data/ext/ffi_c/Call.h +3 -2
  14. data/ext/ffi_c/DynamicLibrary.c +90 -27
  15. data/ext/ffi_c/Function.c +244 -98
  16. data/ext/ffi_c/Function.h +1 -0
  17. data/ext/ffi_c/FunctionInfo.c +81 -25
  18. data/ext/ffi_c/LastError.c +29 -11
  19. data/ext/ffi_c/MappedType.c +66 -23
  20. data/ext/ffi_c/MappedType.h +0 -2
  21. data/ext/ffi_c/MemoryPointer.c +36 -9
  22. data/ext/ffi_c/MethodHandle.c +3 -1
  23. data/ext/ffi_c/Pointer.c +82 -40
  24. data/ext/ffi_c/Pointer.h +1 -0
  25. data/ext/ffi_c/Struct.c +166 -84
  26. data/ext/ffi_c/Struct.h +7 -4
  27. data/ext/ffi_c/StructByValue.c +48 -16
  28. data/ext/ffi_c/StructLayout.c +130 -61
  29. data/ext/ffi_c/Type.c +120 -51
  30. data/ext/ffi_c/Type.h +3 -1
  31. data/ext/ffi_c/Types.c +8 -2
  32. data/ext/ffi_c/Types.h +0 -1
  33. data/ext/ffi_c/Variadic.c +71 -26
  34. data/ext/ffi_c/compat.h +22 -22
  35. data/ext/ffi_c/extconf.rb +19 -2
  36. data/ext/ffi_c/ffi.c +4 -0
  37. data/ext/ffi_c/libffi/.allow-ai-service +0 -0
  38. data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
  39. data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
  40. data/ext/ffi_c/libffi/.appveyor.yml +27 -9
  41. data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
  42. data/ext/ffi_c/libffi/{.travis → .ci}/build-in-container.sh +4 -6
  43. data/ext/ffi_c/libffi/.ci/build.sh +124 -0
  44. data/ext/ffi_c/libffi/{.travis → .ci}/install.sh +14 -7
  45. data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
  46. data/ext/ffi_c/libffi/{.travis → .ci}/site.exp +5 -3
  47. data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
  48. data/ext/ffi_c/libffi/.github/workflows/build.yml +479 -0
  49. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +172 -0
  50. data/ext/ffi_c/libffi/.gitignore +10 -2
  51. data/ext/ffi_c/libffi/LICENSE +1 -1
  52. data/ext/ffi_c/libffi/Makefile.am +12 -5
  53. data/ext/ffi_c/libffi/Makefile.in +118 -51
  54. data/ext/ffi_c/libffi/README.md +150 -105
  55. data/ext/ffi_c/libffi/acinclude.m4 +10 -112
  56. data/ext/ffi_c/libffi/compile +348 -0
  57. data/ext/ffi_c/libffi/config.guess +623 -556
  58. data/ext/ffi_c/libffi/config.sub +75 -34
  59. data/ext/ffi_c/libffi/configure +4571 -3830
  60. data/ext/ffi_c/libffi/configure.ac +64 -28
  61. data/ext/ffi_c/libffi/configure.host +26 -7
  62. data/ext/ffi_c/libffi/doc/Makefile.in +9 -6
  63. data/ext/ffi_c/libffi/doc/libffi.texi +82 -33
  64. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  65. data/ext/ffi_c/libffi/fficonfig.h.in +12 -47
  66. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +163 -52
  67. data/ext/ffi_c/libffi/include/Makefile.am +1 -1
  68. data/ext/ffi_c/libffi/include/Makefile.in +10 -9
  69. data/ext/ffi_c/libffi/include/ffi.h.in +55 -60
  70. data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
  71. data/ext/ffi_c/libffi/include/ffi_common.h +33 -2
  72. data/ext/ffi_c/libffi/include/tramp.h +45 -0
  73. data/ext/ffi_c/libffi/install-sh +92 -69
  74. data/ext/ffi_c/libffi/libffi.map.in +5 -0
  75. data/ext/ffi_c/libffi/libtool-version +2 -2
  76. data/ext/ffi_c/libffi/ltmain.sh +518 -333
  77. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +18 -14
  78. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
  79. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -45
  80. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
  81. data/ext/ffi_c/libffi/man/Makefile.in +9 -6
  82. data/ext/ffi_c/libffi/missing +1 -1
  83. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +2 -2
  84. data/ext/ffi_c/libffi/msvcc.sh +1 -1
  85. data/ext/ffi_c/libffi/src/aarch64/ffi.c +172 -55
  86. data/ext/ffi_c/libffi/src/aarch64/internal.h +32 -0
  87. data/ext/ffi_c/libffi/src/aarch64/sysv.S +331 -87
  88. data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
  89. data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
  90. data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
  91. data/ext/ffi_c/libffi/src/arm/ffi.c +62 -17
  92. data/ext/ffi_c/libffi/src/arm/ffitarget.h +3 -3
  93. data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
  94. data/ext/ffi_c/libffi/src/arm/sysv.S +113 -42
  95. data/ext/ffi_c/libffi/src/closures.c +136 -50
  96. data/ext/ffi_c/libffi/src/debug.c +2 -2
  97. data/ext/ffi_c/libffi/src/dlmalloc.c +6 -1
  98. data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
  99. data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
  100. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +624 -0
  101. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
  102. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
  103. data/ext/ffi_c/libffi/src/m32r/ffi.c +31 -14
  104. data/ext/ffi_c/libffi/src/mips/ffi.c +250 -67
  105. data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -0
  106. data/ext/ffi_c/libffi/src/mips/n32.S +193 -33
  107. data/ext/ffi_c/libffi/src/mips/o32.S +61 -4
  108. data/ext/ffi_c/libffi/src/moxie/ffi.c +47 -22
  109. data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
  110. data/ext/ffi_c/libffi/src/pa/ffi.c +32 -33
  111. data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
  112. data/ext/ffi_c/libffi/src/pa/ffitarget.h +22 -8
  113. data/ext/ffi_c/libffi/src/pa/hpux32.S +83 -36
  114. data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
  115. data/ext/ffi_c/libffi/src/pa/linux.S +82 -35
  116. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
  117. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1 -1
  118. data/ext/ffi_c/libffi/src/powerpc/linux64.S +2 -0
  119. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +2 -0
  120. data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
  121. data/ext/ffi_c/libffi/src/prep_cif.c +22 -2
  122. data/ext/ffi_c/libffi/src/riscv/ffi.c +37 -4
  123. data/ext/ffi_c/libffi/src/sparc/ffi64.c +23 -1
  124. data/ext/ffi_c/libffi/src/tramp.c +716 -0
  125. data/ext/ffi_c/libffi/src/types.c +4 -6
  126. data/ext/ffi_c/libffi/src/wasm32/ffi.c +947 -0
  127. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
  128. data/ext/ffi_c/libffi/src/x86/ffi.c +99 -37
  129. data/ext/ffi_c/libffi/src/x86/ffi64.c +67 -12
  130. data/ext/ffi_c/libffi/src/x86/ffitarget.h +9 -5
  131. data/ext/ffi_c/libffi/src/x86/ffiw64.c +44 -1
  132. data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
  133. data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
  134. data/ext/ffi_c/libffi/src/x86/sysv.S +172 -38
  135. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +91 -88
  136. data/ext/ffi_c/libffi/src/x86/unix64.S +96 -6
  137. data/ext/ffi_c/libffi/src/x86/win64.S +20 -7
  138. data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
  139. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
  140. data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
  141. data/ext/ffi_c/libffi/testsuite/Makefile.am +79 -114
  142. data/ext/ffi_c/libffi/testsuite/Makefile.in +89 -121
  143. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
  144. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
  145. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +86 -0
  146. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
  147. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
  148. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
  149. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +43 -21
  150. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
  151. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -0
  152. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
  153. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
  154. data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
  155. data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
  156. data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
  157. data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
  158. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
  159. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
  160. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
  161. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
  162. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
  163. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
  164. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +8 -9
  165. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
  166. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
  167. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
  168. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
  169. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
  170. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
  171. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
  172. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
  173. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
  174. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
  175. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
  176. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
  177. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
  178. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -119
  179. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
  180. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
  181. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +13 -0
  182. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
  183. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -0
  184. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +3 -2
  185. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +2 -0
  186. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +2 -0
  187. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +21 -1
  188. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +2 -0
  189. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +2 -0
  190. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +2 -0
  191. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +7 -6
  192. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +6 -0
  193. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +18 -0
  194. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +22 -0
  195. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +24 -0
  196. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +29 -0
  197. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +4 -0
  198. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +19 -1
  199. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +21 -1
  200. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +35 -3
  201. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +13 -0
  202. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +19 -0
  203. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +13 -0
  204. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +13 -0
  205. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +18 -0
  206. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +22 -0
  207. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +13 -0
  208. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +29 -1
  209. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +19 -1
  210. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +24 -0
  211. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +28 -1
  212. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +24 -2
  213. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +39 -1
  214. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +25 -1
  215. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +14 -0
  216. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +14 -1
  217. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +14 -2
  218. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +19 -1
  219. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +19 -1
  220. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +20 -1
  221. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +40 -25
  222. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +40 -3
  223. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +19 -1
  224. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +18 -1
  225. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +18 -3
  226. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +18 -1
  227. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +18 -1
  228. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +19 -1
  229. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +19 -1
  230. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +3 -1
  231. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +9 -1
  232. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +4 -0
  233. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +11 -1
  234. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +22 -3
  235. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +5 -1
  236. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +6 -1
  237. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +9 -1
  238. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +9 -1
  239. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +6 -2
  240. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +9 -1
  241. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +5 -0
  242. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +10 -0
  243. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +3 -0
  244. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +2 -0
  245. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +3 -0
  246. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +11 -0
  247. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +3 -0
  248. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +4 -0
  249. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +4 -0
  250. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +4 -0
  251. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +2 -0
  252. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +3 -0
  253. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -138
  254. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +21 -21
  255. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +32 -9
  256. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +1 -1
  257. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +12 -0
  258. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +21 -5
  259. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
  260. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
  261. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +10 -1
  262. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +10 -1
  263. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +9 -0
  264. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +9 -0
  265. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +11 -0
  266. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +9 -0
  267. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +11 -0
  268. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +11 -0
  269. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
  270. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
  271. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
  272. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +1 -1
  273. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +1 -1
  274. data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +6 -1
  275. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +2 -1
  276. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +1 -0
  277. data/ext/ffi_c/libffi.bsd.mk +2 -2
  278. data/ext/ffi_c/libffi.darwin.mk +2 -2
  279. data/ext/ffi_c/libffi.gnu.mk +2 -2
  280. data/ext/ffi_c/rbffi.h +1 -1
  281. data/ffi.gemspec +3 -3
  282. data/lib/ffi/autopointer.rb +8 -31
  283. data/lib/ffi/compat.rb +43 -0
  284. data/lib/ffi/data_converter.rb +2 -2
  285. data/lib/ffi/dynamic_library.rb +118 -0
  286. data/lib/ffi/enum.rb +18 -12
  287. data/lib/ffi/ffi.rb +3 -0
  288. data/lib/ffi/function.rb +71 -0
  289. data/lib/ffi/io.rb +2 -2
  290. data/lib/ffi/library.rb +72 -88
  291. data/lib/ffi/library_path.rb +109 -0
  292. data/lib/ffi/managedstruct.rb +1 -1
  293. data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
  294. data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
  295. data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
  296. data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
  297. data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
  298. data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
  299. data/lib/ffi/platform.rb +15 -13
  300. data/lib/ffi/pointer.rb +6 -6
  301. data/lib/ffi/struct.rb +6 -5
  302. data/lib/ffi/struct_layout.rb +3 -3
  303. data/lib/ffi/struct_layout_builder.rb +9 -9
  304. data/lib/ffi/types.rb +65 -37
  305. data/lib/ffi/variadic.rb +19 -8
  306. data/lib/ffi/version.rb +1 -1
  307. data/samples/hello_ractor.rb +11 -0
  308. data/samples/qsort_ractor.rb +28 -0
  309. data/sig/ffi/abstract_memory.rbs +165 -0
  310. data/sig/ffi/auto_pointer.rbs +27 -0
  311. data/sig/ffi/buffer.rbs +18 -0
  312. data/sig/ffi/data_converter.rbs +10 -0
  313. data/sig/ffi/dynamic_library.rbs +9 -0
  314. data/sig/ffi/enum.rbs +38 -0
  315. data/sig/ffi/function.rbs +39 -0
  316. data/sig/ffi/library.rbs +42 -0
  317. data/sig/ffi/native_type.rbs +86 -0
  318. data/sig/ffi/pointer.rbs +42 -0
  319. data/sig/ffi/struct.rbs +76 -0
  320. data/sig/ffi/struct_by_reference.rbs +11 -0
  321. data/sig/ffi/struct_by_value.rbs +7 -0
  322. data/sig/ffi/struct_layout.rbs +9 -0
  323. data/sig/ffi/struct_layout_builder.rbs +5 -0
  324. data/sig/ffi/type.rbs +39 -0
  325. data/sig/ffi.rbs +26 -0
  326. data.tar.gz.sig +0 -0
  327. metadata +122 -28
  328. metadata.gz.sig +1 -0
  329. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +0 -14
  330. data/ext/ffi_c/libffi/.travis/build.sh +0 -142
  331. data/ext/ffi_c/libffi/.travis.yml +0 -83
  332. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar_va.c +0 -44
  333. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort_va.c +0 -44
  334. /data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
  335. /data/ext/ffi_c/libffi/{.travis → .ci}/bfin-sim.exp +0 -0
  336. /data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
  337. /data/ext/ffi_c/libffi/{.travis → .ci}/m32r-sim.exp +0 -0
  338. /data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +0 -0
  339. /data/ext/ffi_c/libffi/{.travis → .ci}/or1k-sim.exp +0 -0
  340. /data/ext/ffi_c/libffi/{.travis → .ci}/powerpc-eabisim.exp +0 -0
  341. /data/ext/ffi_c/libffi/{.travis → .ci}/wine-sim.exp +0 -0
  342. /data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
  343. /data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +0 -0
@@ -16,7 +16,7 @@ typedef struct cls_struct_5byte {
16
16
  unsigned char e;
17
17
  } cls_struct_5byte;
18
18
 
19
- cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1,
19
+ static cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1,
20
20
  struct cls_struct_5byte a2)
21
21
  {
22
22
  struct cls_struct_5byte result;
@@ -32,6 +32,24 @@ cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1,
32
32
  a2.a, a2.b, a2.c, a2.d, a2.e,
33
33
  result.a, result.b, result.c, result.d, result.e);
34
34
 
35
+ CHECK(a1.a == 127);
36
+ CHECK(a1.b == 120);
37
+ CHECK(a1.c == 1);
38
+ CHECK(a1.d == 3);
39
+ CHECK(a1.e == 4);
40
+
41
+ CHECK(a2.a == 12);
42
+ CHECK(a2.b == 128);
43
+ CHECK(a2.c == 9);
44
+ CHECK(a2.d == 3);
45
+ CHECK(a2.e == 4);
46
+
47
+ CHECK(result.a == 139);
48
+ CHECK(result.b == 248);
49
+ CHECK(result.c == 10);
50
+ CHECK(result.d == 6);
51
+ CHECK(result.e == 8);
52
+
35
53
  return result;
36
54
  }
37
55
 
@@ -90,6 +108,11 @@ int main (void)
90
108
  printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
91
109
  res_dbl.d, res_dbl.e);
92
110
  /* { dg-output "\nres: 139 248 10 6 8" } */
111
+ CHECK(res_dbl.a == 139);
112
+ CHECK(res_dbl.b == 248);
113
+ CHECK(res_dbl.c == 10);
114
+ CHECK(res_dbl.d == 6);
115
+ CHECK(res_dbl.e == 8);
93
116
 
94
117
  res_dbl.a = 0;
95
118
  res_dbl.b = 0;
@@ -104,6 +127,11 @@ int main (void)
104
127
  printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
105
128
  res_dbl.d, res_dbl.e);
106
129
  /* { dg-output "\nres: 139 248 10 6 8" } */
130
+ CHECK(res_dbl.a == 139);
131
+ CHECK(res_dbl.b == 248);
132
+ CHECK(res_dbl.c == 10);
133
+ CHECK(res_dbl.d == 6);
134
+ CHECK(res_dbl.e == 8);
107
135
 
108
136
  exit(0);
109
137
  }
@@ -14,7 +14,7 @@ typedef struct cls_struct_5byte {
14
14
  unsigned char c;
15
15
  } cls_struct_5byte;
16
16
 
17
- cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1,
17
+ static cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1,
18
18
  struct cls_struct_5byte a2)
19
19
  {
20
20
  struct cls_struct_5byte result;
@@ -27,6 +27,18 @@ cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1,
27
27
  a2.a, a2.b, a2.c,
28
28
  result.a, result.b, result.c);
29
29
 
30
+ CHECK(a1.a == 127);
31
+ CHECK(a1.b == 120);
32
+ CHECK(a1.c == 1);
33
+
34
+ CHECK(a2.a == 12);
35
+ CHECK(a2.b == 128);
36
+ CHECK(a2.c == 9);
37
+
38
+ CHECK(result.a == 139);
39
+ CHECK(result.b == 248);
40
+ CHECK(result.c == 10);
41
+
30
42
  return result;
31
43
  }
32
44
 
@@ -82,6 +94,9 @@ int main (void)
82
94
  /* { dg-output "127 120 1 12 128 9: 139 248 10" } */
83
95
  printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
84
96
  /* { dg-output "\nres: 139 248 10" } */
97
+ CHECK(res_dbl.a == 139);
98
+ CHECK(res_dbl.b == 248);
99
+ CHECK(res_dbl.c == 10);
85
100
 
86
101
  res_dbl.a = 0;
87
102
  res_dbl.b = 0;
@@ -93,6 +108,9 @@ int main (void)
93
108
  /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */
94
109
  printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
95
110
  /* { dg-output "\nres: 139 248 10" } */
111
+ CHECK(res_dbl.a == 139);
112
+ CHECK(res_dbl.b == 248);
113
+ CHECK(res_dbl.c == 10);
96
114
 
97
115
  exit(0);
98
116
  }
@@ -38,6 +38,14 @@ cls_struct_64byte cls_struct_64byte_fn(struct cls_struct_64byte b0,
38
38
 
39
39
  printf("%g %g %g %g %g %g %g %g\n", result.a, result.b, result.c,
40
40
  result.d, result.e, result.f, result.g, result.h);
41
+ CHECK(result.a == 22);
42
+ CHECK(result.b == 15);
43
+ CHECK(result.c == 17);
44
+ CHECK(result.d == 25);
45
+ CHECK(result.e == 6);
46
+ CHECK(result.f == 13);
47
+ CHECK(result.g == 19);
48
+ CHECK(result.h == 18);
41
49
 
42
50
  return result;
43
51
  }
@@ -107,6 +115,14 @@ int main (void)
107
115
  printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c,
108
116
  res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h);
109
117
  /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */
118
+ CHECK(res_dbl.a == 22);
119
+ CHECK(res_dbl.b == 15);
120
+ CHECK(res_dbl.c == 17);
121
+ CHECK(res_dbl.d == 25);
122
+ CHECK(res_dbl.e == 6);
123
+ CHECK(res_dbl.f == 13);
124
+ CHECK(res_dbl.g == 19);
125
+ CHECK(res_dbl.h == 18);
110
126
 
111
127
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK);
112
128
 
@@ -119,6 +135,14 @@ int main (void)
119
135
  printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c,
120
136
  res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h);
121
137
  /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */
138
+ CHECK(res_dbl.a == 22);
139
+ CHECK(res_dbl.b == 15);
140
+ CHECK(res_dbl.c == 17);
141
+ CHECK(res_dbl.d == 25);
142
+ CHECK(res_dbl.e == 6);
143
+ CHECK(res_dbl.f == 13);
144
+ CHECK(res_dbl.g == 19);
145
+ CHECK(res_dbl.h == 18);
122
146
 
123
147
  exit(0);
124
148
  }
@@ -17,7 +17,7 @@ typedef struct cls_struct_6byte {
17
17
  unsigned char f;
18
18
  } cls_struct_6byte;
19
19
 
20
- cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1,
20
+ static cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1,
21
21
  struct cls_struct_6byte a2)
22
22
  {
23
23
  struct cls_struct_6byte result;
@@ -34,6 +34,27 @@ cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1,
34
34
  a2.a, a2.b, a2.c, a2.d, a2.e, a2.f,
35
35
  result.a, result.b, result.c, result.d, result.e, result.f);
36
36
 
37
+ CHECK(a1.a == 127);
38
+ CHECK(a1.b == 120);
39
+ CHECK(a1.c == 1);
40
+ CHECK(a1.d == 3);
41
+ CHECK(a1.e == 4);
42
+ CHECK(a1.f == 5);
43
+
44
+ CHECK(a2.a == 12);
45
+ CHECK(a2.b == 128);
46
+ CHECK(a2.c == 9);
47
+ CHECK(a2.d == 3);
48
+ CHECK(a2.e == 4);
49
+ CHECK(a2.f == 5);
50
+
51
+ CHECK(result.a == 139);
52
+ CHECK(result.b == 248);
53
+ CHECK(result.c == 10);
54
+ CHECK(result.d == 6);
55
+ CHECK(result.e == 8);
56
+ CHECK(result.f == 10);
57
+
37
58
  return result;
38
59
  }
39
60
 
@@ -109,5 +130,11 @@ int main (void)
109
130
  res_dbl.d, res_dbl.e, res_dbl.f);
110
131
  /* { dg-output "\nres: 139 248 10 6 8 10" } */
111
132
 
133
+ CHECK(res_dbl.a == 139);
134
+ CHECK(res_dbl.b == 248);
135
+ CHECK(res_dbl.c == 10);
136
+ CHECK(res_dbl.d == 6);
137
+ CHECK(res_dbl.e == 8);
138
+ CHECK(res_dbl.f == 10);
112
139
  exit(0);
113
140
  }
@@ -16,7 +16,7 @@ typedef struct cls_struct_6byte {
16
16
  unsigned char d;
17
17
  } cls_struct_6byte;
18
18
 
19
- cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1,
19
+ static cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1,
20
20
  struct cls_struct_6byte a2)
21
21
  {
22
22
  struct cls_struct_6byte result;
@@ -30,6 +30,21 @@ cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1,
30
30
  a2.a, a2.b, a2.c, a2.d,
31
31
  result.a, result.b, result.c, result.d);
32
32
 
33
+ CHECK(a1.a == 127);
34
+ CHECK(a1.b == 120);
35
+ CHECK(a1.c == 1);
36
+ CHECK(a1.d == 128);
37
+
38
+ CHECK(a2.a == 12);
39
+ CHECK(a2.b == 128);
40
+ CHECK(a2.c == 9);
41
+ CHECK(a2.d == 127);
42
+
43
+ CHECK(result.a == 139);
44
+ CHECK(result.b == 248);
45
+ CHECK(result.c == 10);
46
+ CHECK(result.d == 255);
47
+
33
48
  return result;
34
49
  }
35
50
 
@@ -86,6 +101,10 @@ int main (void)
86
101
  /* { dg-output "127 120 1 128 12 128 9 127: 139 248 10 255" } */
87
102
  printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
88
103
  /* { dg-output "\nres: 139 248 10 255" } */
104
+ CHECK(res_dbl.a == 139);
105
+ CHECK(res_dbl.b == 248);
106
+ CHECK(res_dbl.c == 10);
107
+ CHECK(res_dbl.d == 255);
89
108
 
90
109
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK);
91
110
 
@@ -93,7 +112,10 @@ int main (void)
93
112
  /* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */
94
113
  printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
95
114
  /* { dg-output "\nres: 139 248 10 255" } */
96
-
115
+ CHECK(res_dbl.a == 139);
116
+ CHECK(res_dbl.b == 248);
117
+ CHECK(res_dbl.c == 10);
118
+ CHECK(res_dbl.d == 255);
97
119
 
98
120
  exit(0);
99
121
  }
@@ -18,7 +18,7 @@ typedef struct cls_struct_7byte {
18
18
  unsigned char g;
19
19
  } cls_struct_7byte;
20
20
 
21
- cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1,
21
+ static cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1,
22
22
  struct cls_struct_7byte a2)
23
23
  {
24
24
  struct cls_struct_7byte result;
@@ -36,6 +36,30 @@ cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1,
36
36
  a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g,
37
37
  result.a, result.b, result.c, result.d, result.e, result.f, result.g);
38
38
 
39
+ CHECK(a1.a == 127);
40
+ CHECK(a1.b == 120);
41
+ CHECK(a1.c == 1);
42
+ CHECK(a1.d == 3);
43
+ CHECK(a1.e == 4);
44
+ CHECK(a1.f == 5);
45
+ CHECK(a1.g == 6);
46
+
47
+ CHECK(a2.a == 12);
48
+ CHECK(a2.b == 128);
49
+ CHECK(a2.c == 9);
50
+ CHECK(a2.d == 3);
51
+ CHECK(a2.e == 4);
52
+ CHECK(a2.f == 5);
53
+ CHECK(a2.g == 6);
54
+
55
+ CHECK(result.a == 139);
56
+ CHECK(result.b == 248);
57
+ CHECK(result.c == 10);
58
+ CHECK(result.d == 6);
59
+ CHECK(result.e == 8);
60
+ CHECK(result.f == 10);
61
+ CHECK(result.g == 12);
62
+
39
63
  return result;
40
64
  }
41
65
 
@@ -96,6 +120,13 @@ int main (void)
96
120
  printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
97
121
  res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
98
122
  /* { dg-output "\nres: 139 248 10 6 8 10 12" } */
123
+ CHECK(res_dbl.a == 139);
124
+ CHECK(res_dbl.b == 248);
125
+ CHECK(res_dbl.c == 10);
126
+ CHECK(res_dbl.d == 6);
127
+ CHECK(res_dbl.e == 8);
128
+ CHECK(res_dbl.f == 10);
129
+ CHECK(res_dbl.g == 12);
99
130
 
100
131
  res_dbl.a = 0;
101
132
  res_dbl.b = 0;
@@ -112,6 +143,13 @@ int main (void)
112
143
  printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
113
144
  res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
114
145
  /* { dg-output "\nres: 139 248 10 6 8 10 12" } */
146
+ CHECK(res_dbl.a == 139);
147
+ CHECK(res_dbl.b == 248);
148
+ CHECK(res_dbl.c == 10);
149
+ CHECK(res_dbl.d == 6);
150
+ CHECK(res_dbl.e == 8);
151
+ CHECK(res_dbl.f == 10);
152
+ CHECK(res_dbl.g == 12);
115
153
 
116
154
  exit(0);
117
155
  }
@@ -15,7 +15,7 @@ typedef struct cls_struct_7byte {
15
15
  unsigned short d;
16
16
  } cls_struct_7byte;
17
17
 
18
- cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1,
18
+ static cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1,
19
19
  struct cls_struct_7byte a2)
20
20
  {
21
21
  struct cls_struct_7byte result;
@@ -29,6 +29,22 @@ cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1,
29
29
  a2.a, a2.b, a2.c, a2.d,
30
30
  result.a, result.b, result.c, result.d);
31
31
 
32
+ CHECK(a1.a == 127);
33
+ CHECK(a1.b == 120);
34
+ CHECK(a1.c == 1);
35
+ CHECK(a1.d == 254);
36
+
37
+ CHECK(a2.a == 12);
38
+ CHECK(a2.b == 128);
39
+ CHECK(a2.c == 9);
40
+ CHECK(a2.d == 255);
41
+
42
+ CHECK(result.a == 139);
43
+ CHECK(result.b == 248);
44
+ CHECK(result.c == 10);
45
+ CHECK(result.d == 509);
46
+
47
+
32
48
  return result;
33
49
  }
34
50
 
@@ -85,6 +101,10 @@ int main (void)
85
101
  /* { dg-output "127 120 1 254 12 128 9 255: 139 248 10 509" } */
86
102
  printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
87
103
  /* { dg-output "\nres: 139 248 10 509" } */
104
+ CHECK(res_dbl.a == 139);
105
+ CHECK(res_dbl.b == 248);
106
+ CHECK(res_dbl.c == 10);
107
+ CHECK(res_dbl.d == 509);
88
108
 
89
109
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK);
90
110
 
@@ -92,6 +112,10 @@ int main (void)
92
112
  /* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */
93
113
  printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
94
114
  /* { dg-output "\nres: 139 248 10 509" } */
115
+ CHECK(res_dbl.a == 139);
116
+ CHECK(res_dbl.b == 248);
117
+ CHECK(res_dbl.c == 10);
118
+ CHECK(res_dbl.d == 509);
95
119
 
96
120
  exit(0);
97
121
  }
@@ -23,6 +23,15 @@ cls_struct_8byte cls_struct_8byte_fn(struct cls_struct_8byte a1,
23
23
 
24
24
  printf("%d %g %d %g: %d %g\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b);
25
25
 
26
+ CHECK(a1.a == 1);
27
+ CHECK_FLOAT_EQ(a1.b, 2);
28
+
29
+ CHECK(a2.a == 4);
30
+ CHECK_FLOAT_EQ(a2.b, 5);
31
+
32
+ CHECK(result.a == 5);
33
+ CHECK_FLOAT_EQ(result.b, 7);
34
+
26
35
  return result;
27
36
  }
28
37
 
@@ -76,6 +85,9 @@ int main (void)
76
85
  ffi_call(&cif, FFI_FN(cls_struct_8byte_fn), &res_dbl, args_dbl);
77
86
  /* { dg-output "1 2 4 5: 5 7" } */
78
87
  printf("res: %d %g\n", res_dbl.a, res_dbl.b);
88
+ CHECK(res_dbl.a == 5);
89
+ CHECK_FLOAT_EQ(res_dbl.b, 7);
90
+
79
91
  /* { dg-output "\nres: 5 7" } */
80
92
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK);
81
93
 
@@ -83,6 +95,8 @@ int main (void)
83
95
  /* { dg-output "\n1 2 4 5: 5 7" } */
84
96
  printf("res: %d %g\n", res_dbl.a, res_dbl.b);
85
97
  /* { dg-output "\nres: 5 7" } */
98
+ CHECK(res_dbl.a == 5);
99
+ CHECK_FLOAT_EQ(res_dbl.b, 7);
86
100
 
87
101
  exit(0);
88
102
  }
@@ -15,7 +15,7 @@ typedef struct cls_struct_9byte {
15
15
  double b;
16
16
  } cls_struct_9byte;
17
17
 
18
- cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1,
18
+ static cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1,
19
19
  struct cls_struct_9byte b2)
20
20
  {
21
21
  struct cls_struct_9byte result;
@@ -26,6 +26,15 @@ cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1,
26
26
  printf("%d %g %d %g: %d %g\n", b1.a, b1.b, b2.a, b2.b,
27
27
  result.a, result.b);
28
28
 
29
+ CHECK(b1.a == 7);
30
+ CHECK(b1.b == 8);
31
+
32
+ CHECK(b2.a == 1);
33
+ CHECK(b2.b == 9);
34
+
35
+ CHECK(result.a == 8);
36
+ CHECK(result.b == 17);
37
+
29
38
  return result;
30
39
  }
31
40
 
@@ -78,6 +87,8 @@ int main (void)
78
87
  /* { dg-output "7 8 1 9: 8 17" } */
79
88
  printf("res: %d %g\n", res_dbl.a, res_dbl.b);
80
89
  /* { dg-output "\nres: 8 17" } */
90
+ CHECK(res_dbl.a == 8);
91
+ CHECK(res_dbl.b == 17);
81
92
 
82
93
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK);
83
94
 
@@ -85,6 +96,8 @@ int main (void)
85
96
  /* { dg-output "\n7 8 1 9: 8 17" } */
86
97
  printf("res: %d %g\n", res_dbl.a, res_dbl.b);
87
98
  /* { dg-output "\nres: 8 17" } */
99
+ CHECK(res_dbl.a == 8);
100
+ CHECK(res_dbl.b == 17);
88
101
 
89
102
  exit(0);
90
103
  }
@@ -15,7 +15,7 @@ typedef struct cls_struct_9byte {
15
15
  int b;
16
16
  } cls_struct_9byte;
17
17
 
18
- cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1,
18
+ static cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1,
19
19
  struct cls_struct_9byte b2)
20
20
  {
21
21
  struct cls_struct_9byte result;
@@ -26,6 +26,15 @@ cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1,
26
26
  printf("%g %d %g %d: %g %d\n", b1.a, b1.b, b2.a, b2.b,
27
27
  result.a, result.b);
28
28
 
29
+ CHECK(b1.a == 7);
30
+ CHECK(b1.b == 8);
31
+
32
+ CHECK(b2.a == 1);
33
+ CHECK(b2.b == 9);
34
+
35
+ CHECK(result.a == 8);
36
+ CHECK(result.b == 17);
37
+
29
38
  return result;
30
39
  }
31
40
 
@@ -78,7 +87,8 @@ int main (void)
78
87
  /* { dg-output "7 8 1 9: 8 17" } */
79
88
  printf("res: %g %d\n", res_dbl.a, res_dbl.b);
80
89
  /* { dg-output "\nres: 8 17" } */
81
-
90
+ CHECK(res_dbl.a == 8);
91
+ CHECK(res_dbl.b == 17);
82
92
 
83
93
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK);
84
94
 
@@ -86,6 +96,8 @@ int main (void)
86
96
  /* { dg-output "\n7 8 1 9: 8 17" } */
87
97
  printf("res: %g %d\n", res_dbl.a, res_dbl.b);
88
98
  /* { dg-output "\nres: 8 17" } */
99
+ CHECK(res_dbl.a == 8);
100
+ CHECK(res_dbl.b == 17);
89
101
 
90
102
  exit(0);
91
103
  }
@@ -15,7 +15,7 @@ typedef struct cls_struct_align {
15
15
  unsigned char c;
16
16
  } cls_struct_align;
17
17
 
18
- cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
18
+ static cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
19
19
  struct cls_struct_align a2)
20
20
  {
21
21
  struct cls_struct_align result;
@@ -26,6 +26,18 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
26
26
 
27
27
  printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
28
28
 
29
+ CHECK(a1.a == 12);
30
+ CHECK(a1.b == 4951);
31
+ CHECK(a1.c == 127);
32
+
33
+ CHECK(a2.a == 1);
34
+ CHECK(a2.b == 9320);
35
+ CHECK(a2.c == 13);
36
+
37
+ CHECK(result.a == 13);
38
+ CHECK(result.b == 14271);
39
+ CHECK(result.c == 140);
40
+
29
41
  return result;
30
42
  }
31
43
 
@@ -81,6 +93,9 @@ int main (void)
81
93
  /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
82
94
  printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
83
95
  /* { dg-output "\nres: 13 14271 140" } */
96
+ CHECK(res_dbl.a == 13);
97
+ CHECK(res_dbl.b == 14271);
98
+ CHECK(res_dbl.c == 140);
84
99
 
85
100
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
86
101
 
@@ -88,6 +103,9 @@ int main (void)
88
103
  /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
89
104
  printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
90
105
  /* { dg-output "\nres: 13 14271 140" } */
106
+ CHECK(res_dbl.a == 13);
107
+ CHECK(res_dbl.b == 14271);
108
+ CHECK(res_dbl.c == 140);
91
109
 
92
110
  exit(0);
93
111
  }
@@ -13,7 +13,7 @@ typedef struct cls_struct_align {
13
13
  unsigned char c;
14
14
  } cls_struct_align;
15
15
 
16
- cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
16
+ static cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
17
17
  struct cls_struct_align a2)
18
18
  {
19
19
  struct cls_struct_align result;
@@ -24,6 +24,18 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
24
24
 
25
25
  printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c);
26
26
 
27
+ CHECK(a1.a == 12);
28
+ CHECK_FLOAT_EQ(a1.b, 4951);
29
+ CHECK(a1.c == 127);
30
+
31
+ CHECK(a2.a == 1);
32
+ CHECK_FLOAT_EQ(a2.b, 9320);
33
+ CHECK(a2.c == 13);
34
+
35
+ CHECK(result.a == 13);
36
+ CHECK_FLOAT_EQ(result.b, 14271);
37
+ CHECK(result.c == 140);
38
+
27
39
  return result;
28
40
  }
29
41
 
@@ -79,6 +91,9 @@ int main (void)
79
91
  /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
80
92
  printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
81
93
  /* { dg-output "\nres: 13 14271 140" } */
94
+ CHECK(res_dbl.a == 13);
95
+ CHECK_FLOAT_EQ(res_dbl.b, 14271);
96
+ CHECK(res_dbl.c == 140);
82
97
 
83
98
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
84
99
 
@@ -86,6 +101,9 @@ int main (void)
86
101
  /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
87
102
  printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
88
103
  /* { dg-output "\nres: 13 14271 140" } */
104
+ CHECK(res_dbl.a == 13);
105
+ CHECK_FLOAT_EQ(res_dbl.b, 14271);
106
+ CHECK(res_dbl.c == 140);
89
107
 
90
108
  exit(0);
91
109
  }
@@ -14,7 +14,7 @@ typedef struct cls_struct_align {
14
14
  unsigned char c;
15
15
  } cls_struct_align;
16
16
 
17
- cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
17
+ static cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
18
18
  struct cls_struct_align a2)
19
19
  {
20
20
  struct cls_struct_align result;
@@ -25,6 +25,18 @@ cls_struct_align cls_struct_align_fn(struct cls_struct_align a1,
25
25
 
26
26
  printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c);
27
27
 
28
+ CHECK(a1.a == 12);
29
+ CHECK(a1.b == 4951);
30
+ CHECK(a1.c == 127);
31
+
32
+ CHECK(a2.a == 1);
33
+ CHECK(a2.b == 9320);
34
+ CHECK(a2.c == 13);
35
+
36
+ CHECK(result.a == 13);
37
+ CHECK(result.b == 14271);
38
+ CHECK(result.c == 140);
39
+
28
40
  return result;
29
41
  }
30
42
 
@@ -80,6 +92,10 @@ int main (void)
80
92
  /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
81
93
  printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
82
94
  /* { dg-output "\nres: 13 14271 140" } */
95
+ CHECK(res_dbl.a == 13);
96
+ CHECK(res_dbl.b == 14271);
97
+ CHECK(res_dbl.c == 140);
98
+
83
99
 
84
100
  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
85
101
 
@@ -87,6 +103,9 @@ int main (void)
87
103
  /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
88
104
  printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
89
105
  /* { dg-output "\nres: 13 14271 140" } */
106
+ CHECK(res_dbl.a == 13);
107
+ CHECK(res_dbl.b == 14271);
108
+ CHECK(res_dbl.c == 140);
90
109
 
91
110
  exit(0);
92
111
  }