From 3be0110e845da7f861799703eb222e8a2964d95f Mon Sep 17 00:00:00 2001 From: Maple Ong Date: Wed, 12 Apr 2023 12:22:22 -0400 Subject: Fix "undefining the allocator of T_DATA" error seen in Ruby 3.2 Ruby 3.2 issue: https://bugs.ruby-lang.org/issues/18007 Similar to https://github.com/robinst/swig/commit/9b5d37fd174331fa2b7113fe968fcf0570de43bf --- Lib/ruby/rubyrun.swg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib') diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index 6cac4626a..322470891 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -157,7 +157,8 @@ SWIG_Ruby_define_class(swig_type_info *type) _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } - rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + VALUE cl = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + rb_undef_alloc_func(cl); free((void *) klass_name); } -- cgit v1.2.1 From dce218e79fdd928866c4afbde15d8195ea62f18a Mon Sep 17 00:00:00 2001 From: Maple Ong Date: Wed, 12 Apr 2023 23:25:32 -0400 Subject: Fix "ISO C90 forbids mixed declarations and code" warning --- Lib/ruby/rubyrun.swg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib') diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index 322470891..40f62c238 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -157,7 +157,8 @@ SWIG_Ruby_define_class(swig_type_info *type) _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } - VALUE cl = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + VALUE cl; + cl = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); rb_undef_alloc_func(cl); free((void *) klass_name); } -- cgit v1.2.1 From aa2101404bf21879d0955f5edf3df2403c7c693a Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 19 Apr 2023 12:53:45 +1200 Subject: Really fix "mixed declarations and code" warning --- Lib/ruby/rubyrun.swg | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Lib') diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index 40f62c238..885292481 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -157,9 +157,7 @@ SWIG_Ruby_define_class(swig_type_info *type) _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } - VALUE cl; - cl = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); - rb_undef_alloc_func(cl); + rb_undef_alloc_func(rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer)); free((void *) klass_name); } -- cgit v1.2.1