[前][次][番号順一覧][スレッド一覧]

ruby-changes:61968

From: Nobuyoshi <ko1@a...>
Date: Sun, 28 Jun 2020 11:02:42 +0900 (JST)
Subject: [ruby-changes:61968] 48fb6299c6 (master): [ruby/fiddle] support for very old libffi

https://git.ruby-lang.org/ruby.git/commit/?id=48fb6299c6

From 48fb6299c6ad4fe970c05c5e30a0f6284d771164 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 28 Jun 2020 10:34:01 +0900
Subject: [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.

diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c
index 9635631..8fb20e8 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -227,11 +227,13 @@ Init_fiddle(void) https://github.com/ruby/ruby/blob/trunk/ext/fiddle/fiddle.c#L227
      */
     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 cf71a4b..29a0a45 100644
--- a/test/fiddle/test_func.rb
+++ b/test/fiddle/test_func.rb
@@ -81,6 +81,9 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_func.rb#L81
     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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]