summaryrefslogtreecommitdiff
path: root/include/ruby/backward/cxxanyargs.hpp
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-18 22:52:41 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-20 01:29:48 +0900
commit17a13663998a98ff75fcc838d1cea95c879fbb88 (patch)
treebf0e79f06f1e4aef02e3defa3cb4bdd4ec994eac /include/ruby/backward/cxxanyargs.hpp
parent9c0d5e51cb3726455560c34ad595ab82f651da48 (diff)
Overload variable definition functions
Define overloading functions of rb_define_virtual_variable and rb_define_hooked_variable, for combinations with and without ANYARGS casts.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2461
Diffstat (limited to 'include/ruby/backward/cxxanyargs.hpp')
-rw-r--r--include/ruby/backward/cxxanyargs.hpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/ruby/backward/cxxanyargs.hpp b/include/ruby/backward/cxxanyargs.hpp
index 604d50bd4d..55b841b24e 100644
--- a/include/ruby/backward/cxxanyargs.hpp
+++ b/include/ruby/backward/cxxanyargs.hpp
@@ -66,6 +66,36 @@ rb_define_virtual_variable(const char *q, type *w, void_type *e)
RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
+/// @param[in] w Getter function.
+/// @param[in] e Setter function.
+/// @note Both functions can be nullptr.
+/// @see rb_define_hooked_variable()
+/// @deprecated Use glanular typed overload instead.
+inline void
+rb_define_virtual_variable(const char *q, rb_gvar_getter_t *w, void_type *e)
+{
+ rb_gvar_setter_t *t = reinterpret_cast<rb_gvar_setter_t*>(e);
+ ::rb_define_virtual_variable(q, w, t);
+}
+
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
+/// @brief Define a function-backended global variable.
+/// @param[in] q Name of the variable.
+/// @param[in] w Getter function.
+/// @param[in] e Setter function.
+/// @note Both functions can be nullptr.
+/// @see rb_define_hooked_variable()
+/// @deprecated Use glanular typed overload instead.
+inline void
+rb_define_virtual_variable(const char *q, type *w, rb_gvar_setter_t *e)
+{
+ rb_gvar_getter_t *r = reinterpret_cast<rb_gvar_getter_t*>(w);
+ ::rb_define_virtual_variable(q, r, e);
+}
+
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
+/// @brief Define a function-backended global variable.
+/// @param[in] q Name of the variable.
/// @param[in] w Variable storage.
/// @param[in] e Getter function.
/// @param[in] r Setter function.
@@ -80,6 +110,38 @@ rb_define_hooked_variable(const char *q, VALUE *w, type *e, void_type *r)
::rb_define_hooked_variable(q, w, t, y);
}
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
+/// @brief Define a function-backended global variable.
+/// @param[in] q Name of the variable.
+/// @param[in] w Variable storage.
+/// @param[in] e Getter function.
+/// @param[in] r Setter function.
+/// @note Both functions can be nullptr.
+/// @see rb_define_virtual_variable()
+/// @deprecated Use glanular typed overload instead.
+inline void
+rb_define_hooked_variable(const char *q, VALUE *w, rb_gvar_getter_t *e, void_type *r)
+{
+ rb_gvar_setter_t *y = reinterpret_cast<rb_gvar_setter_t*>(r);
+ ::rb_define_hooked_variable(q, w, e, y);
+}
+
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
+/// @brief Define a function-backended global variable.
+/// @param[in] q Name of the variable.
+/// @param[in] w Variable storage.
+/// @param[in] e Getter function.
+/// @param[in] r Setter function.
+/// @note Both functions can be nullptr.
+/// @see rb_define_virtual_variable()
+/// @deprecated Use glanular typed overload instead.
+inline void
+rb_define_hooked_variable(const char *q, VALUE *w, type *e, rb_gvar_setter_t *r)
+{
+ rb_gvar_getter_t *t = reinterpret_cast<rb_gvar_getter_t*>(e);
+ ::rb_define_hooked_variable(q, w, t, r);
+}
+
/// @}
/// @name Exceptions and tag jumps
/// @{