From 7dfe940d9a54d458e73c3485b53b8612cad6bb27 Mon Sep 17 00:00:00 2001 From: chen-jan Date: Thu, 13 Jul 2023 17:07:22 +0800 Subject: [PATCH] Ruby-Fix-deprecation-warnings-with-Ruby-3.x reference: https://github.com/swig/swig/commit/7dfe940d9a54d458e73c3485b53b8612cad6bb27 --- Lib/ruby/rubyhead.swg | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg index bf4e362..42871ce 100644 --- a/Lib/ruby/rubyhead.swg +++ b/Lib/ruby/rubyhead.swg @@ -1,4 +1,5 @@ #include +#include /* For RUBY_API_VERSION_CODE */ /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which * breaks using rb_intern as an lvalue, as SWIG does. We work around this @@ -100,9 +101,9 @@ /* * The following macros are used for providing the correct type of a * function pointer to the Ruby C API. - * Starting with Ruby 2.7 (corresponding to RB_METHOD_DEFINITION_DECL being - * defined) these macros act transparently due to Ruby's moving away from - * ANYARGS and instead employing strict function signatures. + * + * Starting with Ruby 2.7 these macros act transparently due to Ruby's moving + * moving away from ANYARGS and instead employing strict function signatures. * * Note: In case of C (not C++) the macros are transparent even before * Ruby 2.7 due to the fact that the Ruby C API used function declarators @@ -126,7 +127,7 @@ * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer * argument(s) of Ruby C API functions like st_foreach(). */ -#if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL) +#if defined(__cplusplus) && RUBY_API_VERSION_CODE < 20700 # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -- 2.39.1