ruby-changes:67087
From: Nobuyoshi <ko1@a...>
Date: Mon, 9 Aug 2021 11:22:11 +0900 (JST)
Subject: [ruby-changes:67087] 733ffa74cd (master): Suppress deprecated rb_iterate declaration warnings in C++
https://git.ruby-lang.org/ruby.git/commit/?id=733ffa74cd From 733ffa74cd32a5c11ff744a5490782daa00ff1ae Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 8 Aug 2021 17:27:56 +0900 Subject: Suppress deprecated rb_iterate declaration warnings in C++ --- include/ruby/backward/cxxanyargs.hpp | 4 ++-- include/ruby/internal/iterator.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/ruby/backward/cxxanyargs.hpp b/include/ruby/backward/cxxanyargs.hpp index 0af5597..b74992d 100644 --- a/include/ruby/backward/cxxanyargs.hpp +++ b/include/ruby/backward/cxxanyargs.hpp @@ -204,14 +204,14 @@ inline VALUE https://github.com/ruby/ruby/blob/trunk/include/ruby/backward/cxxanyargs.hpp#L204 rb_iterate(onearg_type *q, VALUE w, type *e, VALUE r) { rb_block_call_func_t t = reinterpret_cast<rb_block_call_func_t>(e); - return ::rb_iterate(q, w, t, r); + return backward::rb_iterate(q, w, t, r); } #ifdef HAVE_NULLPTR inline VALUE rb_iterate(onearg_type *q, VALUE w, std::nullptr_t e, VALUE r) { - return ::rb_iterate(q, w, e, r); + return backward::rb_iterate(q, w, e, r); } #endif diff --git a/include/ruby/internal/iterator.h b/include/ruby/internal/iterator.h index a2aee15..e5d0d9b 100644 --- a/include/ruby/internal/iterator.h +++ b/include/ruby/internal/iterator.h @@ -45,6 +45,14 @@ int rb_keyword_given_p(void); https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/iterator.h#L45 int rb_block_given_p(void); void rb_need_block(void); VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE); +#ifdef __cplusplus +namespace ruby {namespace backward { +static inline VALUE +rb_iterate(VALUE (*iter)(VALUE), VALUE data1, rb_block_call_func_t bl, VALUE data2) +{ + return ::rb_iterate(iter, data1, bl, data2); +}}} +#endif DEPRECATED_BY(rb_block_call since 1.9, VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE)); VALUE rb_block_call(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE); VALUE rb_block_call_kw(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE,int); -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/