diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-06-28 10:34:01 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-06-28 10:40:31 +0900 |
commit | 48fb6299c6ad4fe970c05c5e30a0f6284d771164 (patch) | |
tree | fb733e82b49a27c61b2110eccb434b06446dc2d1 | |
parent | 0703e014713ae92f4c8a2b31e385718dc2452eac (diff) | |
download | ruby-48fb6299c6ad4fe970c05c5e30a0f6284d771164.tar.gz |
[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.
-rw-r--r-- | ext/fiddle/fiddle.c | 2 | ||||
-rw-r--r-- | test/fiddle/test_func.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c index 96356311c7..8fb20e8ce2 100644 --- a/ext/fiddle/fiddle.c +++ b/ext/fiddle/fiddle.c @@ -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 * diff --git a/test/fiddle/test_func.rb b/test/fiddle/test_func.rb index cf71a4b123..29a0a455f1 100644 --- a/test/fiddle/test_func.rb +++ b/test/fiddle/test_func.rb @@ -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 |