From 9f93070686c654c95c3bd029a902081bc3ef9916 Mon Sep 17 00:00:00 2001 From: Paul Mucur Date: Mon, 18 Sep 2023 16:24:07 +0100 Subject: [PATCH] Avoid ANYARGS deprecation warning on modern Rubies Rather than using rb_define_global_function, use rb_define_module_function to define the RE2 method on Kernel, avoiding a deprecation warning from https://github.com/ruby/ruby/blob/ec37636ab36af36155faa4dbcfebaa161dcf394d/include/ruby/backward/cxxanyargs.hpp. --- ext/re2/re2.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/re2/re2.cc b/ext/re2/re2.cc index 6254623..8c30efa 100644 --- a/ext/re2/re2.cc +++ b/ext/re2/re2.cc @@ -1853,7 +1853,7 @@ void Init_re2(void) { rb_define_singleton_method(re2_cRegexp, "compile", RUBY_METHOD_FUNC(rb_class_new_instance), -1); - rb_define_global_function("RE2", RUBY_METHOD_FUNC(re2_re2), -1); + rb_define_module_function(rb_mKernel, "RE2", RUBY_METHOD_FUNC(re2_re2), -1); /* Create the symbols used in options. */ id_utf8 = rb_intern("utf8");