ffi 1.15.4 → 1.16.3

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