Add support for Ruby 2.7
This commit fixes the signatures of various callback methods
and cleans up the macro definitions used for casting callbacks.
Note that the transparent version of the macro RUBY_METHOD_FUNC
is currently masked behind RUBY_DEVEL, see commit
1d91feaf13
In order to still support strict signature checking and prevent
nasty deprecation warnings, the use of RUBY_METHOD_FUNC had to
be replaced with VALUEFUNC.
This commit is contained in:
parent
9d1244c712
commit
00e291b319
5 changed files with 38 additions and 49 deletions
|
|
@ -110,26 +110,18 @@
|
|||
* can be passed as an argument to API functions like Data_Wrap_Struct()
|
||||
* and Data_Make_Struct().
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
|
||||
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
||||
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
||||
# define VOIDFUNC(f) ((void (*)()) f)
|
||||
# else
|
||||
# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
|
||||
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
||||
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
||||
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
||||
# else /* These definitions should work for Ruby 1.7+ */
|
||||
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
|
||||
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
|
||||
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
||||
# endif
|
||||
# endif
|
||||
#if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL)
|
||||
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
|
||||
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
|
||||
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
||||
# define VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f))
|
||||
# define INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f))
|
||||
#else
|
||||
# define PROTECTFUNC(f) (f)
|
||||
# define VALUEFUNC(f) (f)
|
||||
# define VOIDFUNC(f) (f)
|
||||
# define VOID_ANYARGS_FUNC(f) (f)
|
||||
# define INT_ANYARGS_FUNC(f) (f)
|
||||
#endif
|
||||
|
||||
/* Don't use for expressions have side effect */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue