1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/fiddle] support for very old libffi

Define `Fiddle::TYPE_VARIADIC` only when `ffi_prep_cif_var` is
available, otherwise skip the test for it.
This commit is contained in:
Nobuyoshi Nakada 2020-06-28 10:34:01 +09:00
parent 0703e01471
commit 48fb6299c6
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 5 additions and 0 deletions
ext/fiddle
test/fiddle

View file

@ -227,11 +227,13 @@ Init_fiddle(void)
*/
rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE));
#ifdef HAVE_FFI_PREP_CIF_VAR
/* Document-const: TYPE_VARIADIC
*
* C type - ...
*/
rb_define_const(mFiddle, "TYPE_VARIADIC", INT2NUM(TYPE_VARIADIC));
#endif
/* Document-const: TYPE_SIZE_T
*

View file

@ -81,6 +81,9 @@ module Fiddle
end
def test_snprintf
unless Fiddle.const_defined?("TYPE_VARIADIC")
skip "libffi doesn't support variadic arguments"
end
if Fiddle::WINDOWS
snprintf_name = "_snprintf"
else