ffi 1.15.5 → 1.16.1

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