ffi 1.16.3 → 1.17.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +28 -0
- data/Gemfile +9 -2
- data/README.md +1 -1
- data/Rakefile +17 -5
- data/ext/ffi_c/AbstractMemory.c +38 -38
- data/ext/ffi_c/ArrayType.c +2 -2
- data/ext/ffi_c/Buffer.c +4 -4
- data/ext/ffi_c/Call.c +12 -6
- data/ext/ffi_c/Call.h +3 -2
- data/ext/ffi_c/DynamicLibrary.c +2 -2
- data/ext/ffi_c/LastError.c +4 -4
- data/ext/ffi_c/MemoryPointer.c +2 -2
- data/ext/ffi_c/Pointer.c +14 -11
- data/ext/ffi_c/Struct.c +11 -4
- data/ext/ffi_c/StructLayout.c +6 -6
- data/ext/ffi_c/Type.c +17 -16
- data/ext/ffi_c/Types.c +7 -1
- data/ext/ffi_c/Types.h +0 -1
- data/ext/ffi_c/Variadic.c +5 -2
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +34 -15
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +2 -1
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/README.md +10 -5
- data/ext/ffi_c/libffi/configure +15 -15
- data/ext/ffi_c/libffi/configure.ac +2 -2
- data/ext/ffi_c/libffi/configure.host +1 -1
- data/ext/ffi_c/libffi/doc/libffi.texi +1 -1
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/include/ffi.h.in +2 -11
- data/ext/ffi_c/libffi/include/ffi_common.h +4 -2
- data/ext/ffi_c/libffi/libffi.map.in +5 -0
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/ltmain.sh +8 -20
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +26 -13
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +198 -46
- data/ext/ffi_c/libffi/src/closures.c +3 -3
- data/ext/ffi_c/libffi/src/debug.c +2 -2
- data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
- data/ext/ffi_c/libffi/src/loongarch64/ffi.c +3 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +12 -4
- data/ext/ffi_c/libffi/src/mips/n32.S +65 -14
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +7 -1
- data/ext/ffi_c/libffi/src/tramp.c +1 -1
- data/ext/ffi_c/libffi/src/types.c +4 -6
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +13 -0
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +1 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +79 -127
- data/ext/ffi_c/libffi/testsuite/Makefile.in +79 -127
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +6 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
- data/ext/ffi_c/libffi.darwin.mk +2 -2
- data/lib/ffi/dynamic_library.rb +34 -5
- data/lib/ffi/enum.rb +0 -1
- data/lib/ffi/function.rb +1 -1
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +23 -23
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +4 -4
- data/lib/ffi/struct_layout.rb +2 -2
- data/lib/ffi/struct_layout_builder.rb +8 -8
- data/lib/ffi/types.rb +51 -49
- data/lib/ffi/version.rb +1 -1
- data/sig/ffi/abstract_memory.rbs +164 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +37 -15
- metadata.gz.sig +0 -0
@@ -290,133 +290,85 @@ top_srcdir = @top_srcdir@
|
|
290
290
|
AUTOMAKE_OPTIONS = foreign dejagnu
|
291
291
|
EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
|
292
292
|
CLEANFILES = *.exe core* *.log *.sum
|
293
|
-
EXTRA_DIST = config/default.exp
|
294
|
-
|
295
|
-
|
296
|
-
libffi.bhaible/
|
297
|
-
libffi.bhaible/
|
298
|
-
libffi.
|
299
|
-
libffi.call/
|
300
|
-
libffi.call/
|
301
|
-
libffi.call/
|
302
|
-
libffi.call/
|
303
|
-
libffi.call/
|
304
|
-
libffi.call/
|
305
|
-
libffi.call/pyobjc_tc.c libffi.call/return_dbl.c
|
306
|
-
libffi.call/return_dbl1.c libffi.call/return_dbl2.c
|
307
|
-
libffi.call/
|
308
|
-
libffi.call/
|
309
|
-
libffi.call/
|
310
|
-
libffi.call/
|
311
|
-
libffi.call/
|
312
|
-
libffi.call/
|
313
|
-
libffi.call/
|
314
|
-
libffi.call/
|
315
|
-
libffi.call/
|
316
|
-
libffi.call/
|
317
|
-
libffi.call/
|
318
|
-
libffi.call/
|
319
|
-
libffi.call/
|
320
|
-
libffi.call/
|
321
|
-
libffi.call/
|
322
|
-
libffi.
|
323
|
-
libffi.
|
324
|
-
libffi.
|
325
|
-
libffi.
|
326
|
-
libffi.
|
327
|
-
libffi.
|
328
|
-
libffi.closures/
|
329
|
-
libffi.closures/
|
330
|
-
libffi.closures/
|
331
|
-
libffi.closures/
|
332
|
-
libffi.closures/
|
333
|
-
libffi.closures/
|
334
|
-
libffi.closures/
|
335
|
-
libffi.closures/
|
336
|
-
libffi.closures/
|
337
|
-
libffi.closures/
|
338
|
-
libffi.closures/
|
339
|
-
libffi.closures/
|
340
|
-
libffi.closures/
|
341
|
-
libffi.closures/
|
342
|
-
libffi.closures/
|
343
|
-
libffi.closures/
|
344
|
-
libffi.closures/
|
345
|
-
libffi.closures/
|
346
|
-
libffi.closures/
|
347
|
-
libffi.closures/
|
348
|
-
libffi.closures/
|
349
|
-
libffi.closures/
|
350
|
-
libffi.closures/
|
351
|
-
libffi.closures/
|
352
|
-
libffi.closures/
|
353
|
-
libffi.closures/
|
354
|
-
libffi.closures/
|
355
|
-
libffi.closures/
|
356
|
-
libffi.
|
357
|
-
libffi.
|
358
|
-
libffi.
|
359
|
-
libffi.
|
360
|
-
libffi.
|
361
|
-
libffi.
|
362
|
-
libffi.
|
363
|
-
libffi.
|
364
|
-
libffi.
|
365
|
-
libffi.
|
366
|
-
libffi.
|
367
|
-
libffi.
|
368
|
-
libffi.
|
369
|
-
libffi.
|
370
|
-
libffi.
|
371
|
-
libffi.
|
372
|
-
libffi.closures/nested_struct7.c libffi.closures/nested_struct8.c \
|
373
|
-
libffi.closures/nested_struct9.c libffi.closures/problem1.c \
|
374
|
-
libffi.closures/single_entry_structs1.c \
|
375
|
-
libffi.closures/single_entry_structs2.c \
|
376
|
-
libffi.closures/single_entry_structs3.c libffi.closures/stret_large.c \
|
377
|
-
libffi.closures/stret_large2.c libffi.closures/stret_medium.c \
|
378
|
-
libffi.closures/stret_medium2.c libffi.closures/testclosure.c \
|
379
|
-
libffi.closures/unwindtest.cc libffi.closures/unwindtest_ffi_call.cc \
|
380
|
-
libffi.closures/cls_align_longdouble_split.c \
|
381
|
-
libffi.closures/cls_align_longdouble_split2.c \
|
382
|
-
libffi.closures/cls_longdouble.c libffi.closures/huge_struct.c \
|
383
|
-
libffi.complex/cls_align_complex.inc \
|
384
|
-
libffi.complex/cls_align_complex_double.c \
|
385
|
-
libffi.complex/cls_align_complex_float.c \
|
386
|
-
libffi.complex/cls_align_complex_longdouble.c \
|
387
|
-
libffi.complex/cls_complex.inc libffi.complex/cls_complex_double.c \
|
388
|
-
libffi.complex/cls_complex_float.c \
|
389
|
-
libffi.complex/cls_complex_longdouble.c \
|
390
|
-
libffi.complex/cls_complex_struct.inc \
|
391
|
-
libffi.complex/cls_complex_struct_double.c \
|
392
|
-
libffi.complex/cls_complex_struct_float.c \
|
393
|
-
libffi.complex/cls_complex_struct_longdouble.c \
|
394
|
-
libffi.complex/cls_complex_va.inc \
|
395
|
-
libffi.complex/cls_complex_va_double.c \
|
396
|
-
libffi.complex/cls_complex_va_float.c \
|
397
|
-
libffi.complex/cls_complex_va_longdouble.c libffi.complex/complex.exp \
|
398
|
-
libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \
|
399
|
-
libffi.complex/complex_defs_float.inc \
|
400
|
-
libffi.complex/complex_defs_longdouble.inc \
|
401
|
-
libffi.complex/complex_double.c libffi.complex/complex_float.c \
|
402
|
-
libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \
|
403
|
-
libffi.complex/ffitest.h libffi.complex/many_complex.inc \
|
404
|
-
libffi.complex/many_complex_double.c \
|
405
|
-
libffi.complex/many_complex_float.c \
|
406
|
-
libffi.complex/many_complex_longdouble.c \
|
407
|
-
libffi.complex/return_complex.inc libffi.complex/return_complex1.inc \
|
408
|
-
libffi.complex/return_complex1_double.c \
|
409
|
-
libffi.complex/return_complex1_float.c \
|
410
|
-
libffi.complex/return_complex1_longdouble.c \
|
411
|
-
libffi.complex/return_complex2.inc \
|
412
|
-
libffi.complex/return_complex2_double.c \
|
413
|
-
libffi.complex/return_complex2_float.c \
|
414
|
-
libffi.complex/return_complex2_longdouble.c \
|
415
|
-
libffi.complex/return_complex_double.c \
|
416
|
-
libffi.complex/return_complex_float.c \
|
417
|
-
libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \
|
418
|
-
libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \
|
419
|
-
libffi.go/static-chain.h
|
293
|
+
EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
|
294
|
+
emscripten/node-tests.sh emscripten/test.html emscripten/test_libffi.py \
|
295
|
+
emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \
|
296
|
+
lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \
|
297
|
+
libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp libffi.bhaible/test-call.c \
|
298
|
+
libffi.bhaible/test-callback.c libffi.bhaible/testcases.c libffi.call/align_mixed.c \
|
299
|
+
libffi.call/align_stdcall.c libffi.call/bpo_38748.c libffi.call/call.exp \
|
300
|
+
libffi.call/err_bad_typedef.c libffi.call/ffitest.h libffi.call/float.c \
|
301
|
+
libffi.call/float1.c libffi.call/float2.c libffi.call/float3.c \
|
302
|
+
libffi.call/float4.c libffi.call/float_va.c libffi.call/many.c \
|
303
|
+
libffi.call/many2.c libffi.call/many_double.c libffi.call/many_mixed.c \
|
304
|
+
libffi.call/negint.c libffi.call/offsets.c libffi.call/pr1172638.c \
|
305
|
+
libffi.call/promotion.c libffi.call/pyobjc_tc.c libffi.call/return_dbl.c \
|
306
|
+
libffi.call/return_dbl1.c libffi.call/return_dbl2.c libffi.call/return_fl.c \
|
307
|
+
libffi.call/return_fl1.c libffi.call/return_fl2.c libffi.call/return_fl3.c \
|
308
|
+
libffi.call/return_ldl.c libffi.call/return_ll.c libffi.call/return_ll1.c \
|
309
|
+
libffi.call/return_sc.c libffi.call/return_sl.c libffi.call/return_uc.c \
|
310
|
+
libffi.call/return_ul.c libffi.call/s55.c libffi.call/strlen.c \
|
311
|
+
libffi.call/strlen2.c libffi.call/strlen3.c libffi.call/strlen4.c \
|
312
|
+
libffi.call/struct1.c libffi.call/struct10.c libffi.call/struct2.c \
|
313
|
+
libffi.call/struct3.c libffi.call/struct4.c libffi.call/struct5.c \
|
314
|
+
libffi.call/struct6.c libffi.call/struct7.c libffi.call/struct8.c \
|
315
|
+
libffi.call/struct9.c libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \
|
316
|
+
libffi.call/struct_by_value_3f.c libffi.call/struct_by_value_4.c libffi.call/struct_by_value_4f.c \
|
317
|
+
libffi.call/struct_by_value_big.c libffi.call/struct_by_value_small.c libffi.call/struct_return_2H.c \
|
318
|
+
libffi.call/struct_return_8H.c libffi.call/uninitialized.c libffi.call/va_1.c \
|
319
|
+
libffi.call/va_2.c libffi.call/va_3.c libffi.call/va_struct1.c \
|
320
|
+
libffi.call/va_struct2.c libffi.call/va_struct3.c libffi.call/callback.c \
|
321
|
+
libffi.call/callback2.c libffi.call/callback3.c libffi.call/callback4.c \
|
322
|
+
libffi.closures/closure.exp libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \
|
323
|
+
libffi.closures/closure_fn2.c libffi.closures/closure_fn3.c libffi.closures/closure_fn4.c \
|
324
|
+
libffi.closures/closure_fn5.c libffi.closures/closure_fn6.c libffi.closures/closure_loc_fn0.c \
|
325
|
+
libffi.closures/closure_simple.c libffi.closures/cls_12byte.c libffi.closures/cls_16byte.c \
|
326
|
+
libffi.closures/cls_18byte.c libffi.closures/cls_19byte.c libffi.closures/cls_1_1byte.c \
|
327
|
+
libffi.closures/cls_20byte.c libffi.closures/cls_20byte1.c libffi.closures/cls_24byte.c \
|
328
|
+
libffi.closures/cls_2byte.c libffi.closures/cls_3_1byte.c libffi.closures/cls_3byte1.c \
|
329
|
+
libffi.closures/cls_3byte2.c libffi.closures/cls_3float.c libffi.closures/cls_4_1byte.c \
|
330
|
+
libffi.closures/cls_4byte.c libffi.closures/cls_5_1_byte.c libffi.closures/cls_5byte.c \
|
331
|
+
libffi.closures/cls_64byte.c libffi.closures/cls_6_1_byte.c libffi.closures/cls_6byte.c \
|
332
|
+
libffi.closures/cls_7_1_byte.c libffi.closures/cls_7byte.c libffi.closures/cls_8byte.c \
|
333
|
+
libffi.closures/cls_9byte1.c libffi.closures/cls_9byte2.c libffi.closures/cls_align_double.c \
|
334
|
+
libffi.closures/cls_align_float.c libffi.closures/cls_align_longdouble.c libffi.closures/cls_align_longdouble_split.c \
|
335
|
+
libffi.closures/cls_align_longdouble_split2.c libffi.closures/cls_align_pointer.c libffi.closures/cls_align_sint16.c \
|
336
|
+
libffi.closures/cls_align_sint32.c libffi.closures/cls_align_sint64.c libffi.closures/cls_align_uint16.c \
|
337
|
+
libffi.closures/cls_align_uint32.c libffi.closures/cls_align_uint64.c libffi.closures/cls_dbls_struct.c \
|
338
|
+
libffi.closures/cls_double.c libffi.closures/cls_double_va.c libffi.closures/cls_float.c \
|
339
|
+
libffi.closures/cls_longdouble.c libffi.closures/cls_longdouble_va.c libffi.closures/cls_many_mixed_args.c \
|
340
|
+
libffi.closures/cls_many_mixed_float_double.c libffi.closures/cls_multi_schar.c libffi.closures/cls_multi_sshort.c \
|
341
|
+
libffi.closures/cls_multi_sshortchar.c libffi.closures/cls_multi_uchar.c libffi.closures/cls_multi_ushort.c \
|
342
|
+
libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_pointer.c libffi.closures/cls_pointer_stack.c \
|
343
|
+
libffi.closures/cls_schar.c libffi.closures/cls_sint.c libffi.closures/cls_sshort.c \
|
344
|
+
libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c libffi.closures/cls_uint.c \
|
345
|
+
libffi.closures/cls_uint_va.c libffi.closures/cls_ulong_va.c libffi.closures/cls_ulonglong.c \
|
346
|
+
libffi.closures/cls_ushort.c libffi.closures/err_bad_abi.c libffi.closures/ffitest.h \
|
347
|
+
libffi.closures/huge_struct.c libffi.closures/nested_struct.c libffi.closures/nested_struct1.c \
|
348
|
+
libffi.closures/nested_struct10.c libffi.closures/nested_struct11.c libffi.closures/nested_struct12.c \
|
349
|
+
libffi.closures/nested_struct13.c libffi.closures/nested_struct2.c libffi.closures/nested_struct3.c \
|
350
|
+
libffi.closures/nested_struct4.c libffi.closures/nested_struct5.c libffi.closures/nested_struct6.c \
|
351
|
+
libffi.closures/nested_struct7.c libffi.closures/nested_struct8.c libffi.closures/nested_struct9.c \
|
352
|
+
libffi.closures/problem1.c libffi.closures/single_entry_structs1.c libffi.closures/single_entry_structs2.c \
|
353
|
+
libffi.closures/single_entry_structs3.c libffi.closures/stret_large.c libffi.closures/stret_large2.c \
|
354
|
+
libffi.closures/stret_medium.c libffi.closures/stret_medium2.c libffi.closures/testclosure.c \
|
355
|
+
libffi.closures/unwindtest.cc libffi.closures/unwindtest_ffi_call.cc libffi.complex/cls_align_complex.inc \
|
356
|
+
libffi.complex/cls_align_complex_double.c libffi.complex/cls_align_complex_float.c libffi.complex/cls_align_complex_longdouble.c \
|
357
|
+
libffi.complex/cls_complex.inc libffi.complex/cls_complex_double.c libffi.complex/cls_complex_float.c \
|
358
|
+
libffi.complex/cls_complex_longdouble.c libffi.complex/cls_complex_struct.inc libffi.complex/cls_complex_struct_double.c \
|
359
|
+
libffi.complex/cls_complex_struct_float.c libffi.complex/cls_complex_struct_longdouble.c libffi.complex/cls_complex_va.inc \
|
360
|
+
libffi.complex/cls_complex_va_double.c libffi.complex/cls_complex_va_float.c libffi.complex/cls_complex_va_longdouble.c \
|
361
|
+
libffi.complex/complex.exp libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \
|
362
|
+
libffi.complex/complex_defs_float.inc libffi.complex/complex_defs_longdouble.inc libffi.complex/complex_double.c \
|
363
|
+
libffi.complex/complex_float.c libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \
|
364
|
+
libffi.complex/ffitest.h libffi.complex/many_complex.inc libffi.complex/many_complex_double.c \
|
365
|
+
libffi.complex/many_complex_float.c libffi.complex/many_complex_longdouble.c libffi.complex/return_complex.inc \
|
366
|
+
libffi.complex/return_complex1.inc libffi.complex/return_complex1_double.c libffi.complex/return_complex1_float.c \
|
367
|
+
libffi.complex/return_complex1_longdouble.c libffi.complex/return_complex2.inc libffi.complex/return_complex2_double.c \
|
368
|
+
libffi.complex/return_complex2_float.c libffi.complex/return_complex2_longdouble.c libffi.complex/return_complex_double.c \
|
369
|
+
libffi.complex/return_complex_float.c libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \
|
370
|
+
libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \
|
371
|
+
libffi.go/static-chain.h Makefile.am Makefile.in
|
420
372
|
|
421
373
|
all: all-am
|
422
374
|
|
@@ -3,6 +3,8 @@ from pytest import fixture
|
|
3
3
|
from pytest_pyodide.server import spawn_web_server
|
4
4
|
from pytest_pyodide import runner
|
5
5
|
|
6
|
+
import logging
|
7
|
+
|
6
8
|
TEST_PATH = Path(__file__).parents[1].resolve()
|
7
9
|
|
8
10
|
|
@@ -47,6 +49,10 @@ RUNNER_DICT = {x.browser: x for x in [FirefoxRunner, ChromeRunner]}
|
|
47
49
|
def selenium_class_scope(request, web_server_main):
|
48
50
|
server_hostname, server_port, server_log = web_server_main
|
49
51
|
assert request.param in RUNNER_DICT
|
52
|
+
|
53
|
+
logger = logging.getLogger('selenium')
|
54
|
+
logger.setLevel(logging.DEBUG)
|
55
|
+
|
50
56
|
cls = RUNNER_DICT[request.param]
|
51
57
|
selenium = cls(
|
52
58
|
test_dir=request.cls.TEST_BUILD_DIR,
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures with array and callback.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: David Tenty <daltenty@ibm.com> */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
int i=5;
|
11
|
+
|
12
|
+
void callback(void) { i++; }
|
13
|
+
|
14
|
+
typedef struct
|
15
|
+
{
|
16
|
+
unsigned char c1;
|
17
|
+
double s[2];
|
18
|
+
unsigned char c2;
|
19
|
+
} test_structure_12;
|
20
|
+
|
21
|
+
static test_structure_12 ABI_ATTR struct12 (test_structure_12 ts, void (*func)(void))
|
22
|
+
{
|
23
|
+
ts.c1 += 1;
|
24
|
+
ts.c2 += 1;
|
25
|
+
ts.s[0] += 1;
|
26
|
+
ts.s[1] += 1;
|
27
|
+
|
28
|
+
func();
|
29
|
+
return ts;
|
30
|
+
}
|
31
|
+
|
32
|
+
int main (void)
|
33
|
+
{
|
34
|
+
ffi_cif cif;
|
35
|
+
ffi_type *args[MAX_ARGS];
|
36
|
+
void *values[MAX_ARGS];
|
37
|
+
ffi_type ts12_type,ts12a_type;
|
38
|
+
ffi_type *ts12_type_elements[4];
|
39
|
+
ffi_type *ts12a_type_elements[3];
|
40
|
+
|
41
|
+
test_structure_12 ts12_arg;
|
42
|
+
void (*ptr)(void)=&callback;
|
43
|
+
|
44
|
+
test_structure_12 *ts12_result =
|
45
|
+
(test_structure_12 *) malloc (sizeof(test_structure_12));
|
46
|
+
|
47
|
+
ts12a_type.size = 0;
|
48
|
+
ts12a_type.alignment = 0;
|
49
|
+
ts12a_type.type = FFI_TYPE_STRUCT;
|
50
|
+
ts12a_type.elements = ts12a_type_elements;
|
51
|
+
ts12a_type_elements[0] = &ffi_type_double;
|
52
|
+
ts12a_type_elements[1] = &ffi_type_double;
|
53
|
+
ts12a_type_elements[2] = NULL;
|
54
|
+
|
55
|
+
ts12_type.size = 0;
|
56
|
+
ts12_type.alignment = 0;
|
57
|
+
ts12_type.type = FFI_TYPE_STRUCT;
|
58
|
+
ts12_type.elements = ts12_type_elements;
|
59
|
+
ts12_type_elements[0] = &ffi_type_uchar;
|
60
|
+
ts12_type_elements[1] = &ts12a_type;
|
61
|
+
ts12_type_elements[2] = &ffi_type_uchar;
|
62
|
+
ts12_type_elements[3] = NULL;
|
63
|
+
|
64
|
+
|
65
|
+
args[0] = &ts12_type;
|
66
|
+
args[1] = &ffi_type_pointer;
|
67
|
+
values[0] = &ts12_arg;
|
68
|
+
values[1] = &ptr;
|
69
|
+
|
70
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts12_type, args) == FFI_OK);
|
71
|
+
|
72
|
+
ts12_arg.c1 = 5;
|
73
|
+
ts12_arg.c2 = 6;
|
74
|
+
ts12_arg.s[0] = 7.77;
|
75
|
+
ts12_arg.s[1] = 8.88;
|
76
|
+
|
77
|
+
printf ("%u\n", ts12_arg.c1);
|
78
|
+
printf ("%u\n", ts12_arg.c2);
|
79
|
+
printf ("%g\n", ts12_arg.s[0]);
|
80
|
+
printf ("%g\n", ts12_arg.s[1]);
|
81
|
+
printf ("%d\n", i);
|
82
|
+
|
83
|
+
ffi_call(&cif, FFI_FN(struct12), ts12_result, values);
|
84
|
+
|
85
|
+
printf ("%u\n", ts12_result->c1);
|
86
|
+
printf ("%u\n", ts12_result->c2);
|
87
|
+
printf ("%g\n", ts12_result->s[0]);
|
88
|
+
printf ("%g\n", ts12_result->s[1]);
|
89
|
+
printf ("%d\n", i);
|
90
|
+
CHECK(ts12_result->c1 == 5 + 1);
|
91
|
+
CHECK(ts12_result->c2 == 6 + 1);
|
92
|
+
CHECK(ts12_result->s[0] == 7.77 + 1);
|
93
|
+
CHECK(ts12_result->s[1] == 8.88 + 1);
|
94
|
+
CHECK(i == 5 + 1);
|
95
|
+
CHECK(ts12_type.size == sizeof(test_structure_12));
|
96
|
+
|
97
|
+
free (ts12_result);
|
98
|
+
exit(0);
|
99
|
+
}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures with nested array and callback.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: David Tenty <daltenty@ibm.com> */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
int i=5;
|
11
|
+
|
12
|
+
void callback(void) { i++; }
|
13
|
+
|
14
|
+
typedef struct
|
15
|
+
{
|
16
|
+
struct { double d; } s1;
|
17
|
+
double s[2];
|
18
|
+
unsigned char c2;
|
19
|
+
} test_structure_12;
|
20
|
+
|
21
|
+
static test_structure_12 ABI_ATTR struct12 (test_structure_12 ts, void (*func)(void))
|
22
|
+
{
|
23
|
+
ts.s1.d += 1;
|
24
|
+
ts.c2 += 1;
|
25
|
+
ts.s[0] += 1;
|
26
|
+
ts.s[1] += 1;
|
27
|
+
|
28
|
+
func();
|
29
|
+
return ts;
|
30
|
+
}
|
31
|
+
|
32
|
+
int main (void)
|
33
|
+
{
|
34
|
+
ffi_cif cif;
|
35
|
+
ffi_type *args[MAX_ARGS];
|
36
|
+
void *values[MAX_ARGS];
|
37
|
+
ffi_type ts12_type,ts12a_type, ts12b_type;
|
38
|
+
ffi_type *ts12_type_elements[4];
|
39
|
+
ffi_type *ts12a_type_elements[2];
|
40
|
+
ffi_type *ts12b_type_elements[3];
|
41
|
+
|
42
|
+
|
43
|
+
test_structure_12 ts12_arg;
|
44
|
+
void (*ptr)(void)=&callback;
|
45
|
+
|
46
|
+
test_structure_12 *ts12_result =
|
47
|
+
(test_structure_12 *) malloc (sizeof(test_structure_12));
|
48
|
+
|
49
|
+
ts12a_type.size = 0;
|
50
|
+
ts12a_type.alignment = 0;
|
51
|
+
ts12a_type.type = FFI_TYPE_STRUCT;
|
52
|
+
ts12a_type.elements = ts12a_type_elements;
|
53
|
+
ts12a_type_elements[0] = &ffi_type_double;
|
54
|
+
ts12a_type_elements[1] = NULL;
|
55
|
+
|
56
|
+
ts12b_type.size = 0;
|
57
|
+
ts12b_type.alignment = 0;
|
58
|
+
ts12b_type.type = FFI_TYPE_STRUCT;
|
59
|
+
ts12b_type.elements = ts12b_type_elements;
|
60
|
+
ts12b_type_elements[0] = &ffi_type_double;
|
61
|
+
ts12b_type_elements[1] = &ffi_type_double;
|
62
|
+
ts12b_type_elements[2] = NULL;
|
63
|
+
|
64
|
+
ts12_type.size = 0;
|
65
|
+
ts12_type.alignment = 0;
|
66
|
+
ts12_type.type = FFI_TYPE_STRUCT;
|
67
|
+
ts12_type.elements = ts12_type_elements;
|
68
|
+
ts12_type_elements[0] = &ts12a_type;
|
69
|
+
ts12_type_elements[1] = &ts12b_type;
|
70
|
+
ts12_type_elements[2] = &ffi_type_uchar;
|
71
|
+
ts12_type_elements[3] = NULL;
|
72
|
+
|
73
|
+
|
74
|
+
args[0] = &ts12_type;
|
75
|
+
args[1] = &ffi_type_pointer;
|
76
|
+
values[0] = &ts12_arg;
|
77
|
+
values[1] = &ptr;
|
78
|
+
|
79
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts12_type, args) == FFI_OK);
|
80
|
+
|
81
|
+
ts12_arg.s1.d = 5.55;
|
82
|
+
ts12_arg.c2 = 6;
|
83
|
+
ts12_arg.s[0] = 7.77;
|
84
|
+
ts12_arg.s[1] = 8.88;
|
85
|
+
|
86
|
+
printf ("%g\n", ts12_arg.s1.d);
|
87
|
+
printf ("%u\n", ts12_arg.c2);
|
88
|
+
printf ("%g\n", ts12_arg.s[0]);
|
89
|
+
printf ("%g\n", ts12_arg.s[1]);
|
90
|
+
printf ("%d\n", i);
|
91
|
+
|
92
|
+
ffi_call(&cif, FFI_FN(struct12), ts12_result, values);
|
93
|
+
|
94
|
+
printf ("%g\n", ts12_result->s1.d);
|
95
|
+
printf ("%u\n", ts12_result->c2);
|
96
|
+
printf ("%g\n", ts12_result->s[0]);
|
97
|
+
printf ("%g\n", ts12_result->s[1]);
|
98
|
+
printf ("%d\n", i);
|
99
|
+
CHECK(ts12_result->s1.d == 5.55 + 1);
|
100
|
+
CHECK(ts12_result->c2 == 6 + 1);
|
101
|
+
CHECK(ts12_result->s[0] == 7.77 + 1);
|
102
|
+
CHECK(ts12_result->s[1] == 8.88 + 1);
|
103
|
+
CHECK(i == 5 + 1);
|
104
|
+
CHECK(ts12_type.size == sizeof(test_structure_12));
|
105
|
+
|
106
|
+
free (ts12_result);
|
107
|
+
exit(0);
|
108
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/* Area: ffi_call
|
2
|
+
Purpose: Check structures with array and callback.
|
3
|
+
Limitations: none.
|
4
|
+
PR: none.
|
5
|
+
Originator: David Tenty <daltenty@ibm.com> */
|
6
|
+
|
7
|
+
/* { dg-do run } */
|
8
|
+
#include "ffitest.h"
|
9
|
+
|
10
|
+
int i=5;
|
11
|
+
|
12
|
+
void callback(void) { i++; }
|
13
|
+
|
14
|
+
|
15
|
+
typedef struct
|
16
|
+
{
|
17
|
+
struct { unsigned char c; double d; } s1;
|
18
|
+
double s[2];
|
19
|
+
unsigned char c2;
|
20
|
+
} test_structure_12;
|
21
|
+
|
22
|
+
static test_structure_12 ABI_ATTR struct12 (test_structure_12 ts, void (*func)(void))
|
23
|
+
{
|
24
|
+
ts.s1.c += 1;
|
25
|
+
ts.s1.d += 1;
|
26
|
+
ts.c2 += 1;
|
27
|
+
ts.s[0] += 1;
|
28
|
+
ts.s[1] += 1;
|
29
|
+
|
30
|
+
func();
|
31
|
+
return ts;
|
32
|
+
}
|
33
|
+
|
34
|
+
int main (void)
|
35
|
+
{
|
36
|
+
ffi_cif cif;
|
37
|
+
ffi_type *args[MAX_ARGS];
|
38
|
+
void *values[MAX_ARGS];
|
39
|
+
ffi_type ts12_type,ts12b_type, ts12a_type;
|
40
|
+
ffi_type *ts12_type_elements[4];
|
41
|
+
ffi_type *ts12b_type_elements[3];
|
42
|
+
ffi_type *ts12a_type_elements[3];
|
43
|
+
|
44
|
+
test_structure_12 ts12_arg;
|
45
|
+
void (*ptr)(void)=&callback;
|
46
|
+
|
47
|
+
test_structure_12 *ts12_result =
|
48
|
+
(test_structure_12 *) malloc (sizeof(test_structure_12));
|
49
|
+
|
50
|
+
ts12a_type.size = 0;
|
51
|
+
ts12a_type.alignment = 0;
|
52
|
+
ts12a_type.type = FFI_TYPE_STRUCT;
|
53
|
+
ts12a_type.elements = ts12a_type_elements;
|
54
|
+
ts12a_type_elements[0] = &ffi_type_uchar;
|
55
|
+
ts12a_type_elements[1] = &ffi_type_double;
|
56
|
+
ts12a_type_elements[2] = NULL;
|
57
|
+
|
58
|
+
ts12b_type.size = 0;
|
59
|
+
ts12b_type.alignment = 0;
|
60
|
+
ts12b_type.type = FFI_TYPE_STRUCT;
|
61
|
+
ts12b_type.elements = ts12b_type_elements;
|
62
|
+
ts12b_type_elements[0] = &ffi_type_double;
|
63
|
+
ts12b_type_elements[1] = &ffi_type_double;
|
64
|
+
ts12b_type_elements[2] = NULL;
|
65
|
+
|
66
|
+
ts12_type.size = 0;
|
67
|
+
ts12_type.alignment = 0;
|
68
|
+
ts12_type.type = FFI_TYPE_STRUCT;
|
69
|
+
ts12_type.elements = ts12_type_elements;
|
70
|
+
ts12_type_elements[0] = &ts12a_type;
|
71
|
+
ts12_type_elements[1] = &ts12b_type;
|
72
|
+
ts12_type_elements[2] = &ffi_type_uchar;
|
73
|
+
ts12_type_elements[3] = NULL;
|
74
|
+
|
75
|
+
|
76
|
+
args[0] = &ts12_type;
|
77
|
+
args[1] = &ffi_type_pointer;
|
78
|
+
values[0] = &ts12_arg;
|
79
|
+
values[1] = &ptr;
|
80
|
+
|
81
|
+
CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts12_type, args) == FFI_OK);
|
82
|
+
|
83
|
+
ts12_arg.s1.c = 5;
|
84
|
+
ts12_arg.s1.d = 5.55;
|
85
|
+
ts12_arg.c2 = 6;
|
86
|
+
ts12_arg.s[0] = 7.77;
|
87
|
+
ts12_arg.s[1] = 8.88;
|
88
|
+
|
89
|
+
printf ("%d\n", ts12_arg.s1.c);
|
90
|
+
printf ("%g\n", ts12_arg.s1.d);
|
91
|
+
printf ("%u\n", ts12_arg.c2);
|
92
|
+
printf ("%g\n", ts12_arg.s[0]);
|
93
|
+
printf ("%g\n", ts12_arg.s[1]);
|
94
|
+
printf ("%d\n", i);
|
95
|
+
|
96
|
+
ffi_call(&cif, FFI_FN(struct12), ts12_result, values);
|
97
|
+
|
98
|
+
printf ("%d\n", ts12_result->s1.c);
|
99
|
+
printf ("%g\n", ts12_result->s1.d);
|
100
|
+
printf ("%u\n", ts12_result->c2);
|
101
|
+
printf ("%g\n", ts12_result->s[0]);
|
102
|
+
printf ("%g\n", ts12_result->s[1]);
|
103
|
+
printf ("%d\n", i);
|
104
|
+
CHECK(ts12_result->s1.c == 5 + 1);
|
105
|
+
CHECK(ts12_result->s1.d == 5.55 + 1);
|
106
|
+
CHECK(ts12_result->c2 == 6 + 1);
|
107
|
+
CHECK(ts12_result->s[0] == 7.77 + 1);
|
108
|
+
CHECK(ts12_result->s[1] == 8.88 + 1);
|
109
|
+
CHECK(i == 5 + 1);
|
110
|
+
CHECK(ts12_type.size == sizeof(test_structure_12));
|
111
|
+
|
112
|
+
free (ts12_result);
|
113
|
+
exit(0);
|
114
|
+
}
|