Basic enabling of Ruby 3

This commit is contained in:
Matthias Koefferlein 2021-06-29 23:32:36 +02:00
parent 4982d63597
commit cd70bea9a0
3 changed files with 16 additions and 9 deletions

View File

@ -154,6 +154,9 @@ msvc {
# because we use unordered_map/unordered_set:
QMAKE_CXXFLAGS += -std=c++0x
# needed for Ruby 3.0
QMAKE_CXXFLAGS += -fdeclspec
win32 {
QMAKE_LFLAGS += -Wl,--exclude-all-symbols
} else {

View File

@ -224,7 +224,7 @@ object_to_ruby (void *obj, Proxy *self, const gsi::ClassBase *cls, bool pass_obj
// a Ruby object. If it already has, we simply return a reference to this.
ret = rba_data->self ();
#if HAVE_RUBY_VERSION_CODE >= 20200
#if HAVE_RUBY_VERSION_CODE >= 20200 && HAVE_RUBY_VERSION_CODE < 30000
// Mark the returned object - the original one may have been already
// scheduled for sweeping. This happens at least for Ruby 2.3 which
// has a two-phase GC (mark and sweep in separate steps). If by chance

View File

@ -894,8 +894,10 @@ class Basic_TestClass < TestBase
end
# TODO: this class is going to be deprecated
class X < Data
if RUBY_VERSION < "3.0.0"
# TODO: this class is going to be deprecated
class X < Data
end
end
class Y < Object
end
@ -907,12 +909,14 @@ class Basic_TestClass < TestBase
end
# Test, if this throws an error (object of class X passed to A argument):
begin
b = RBA::B.new
assert_equal( b.b4( X.new ), "b4_result: -6" )
assert_equal( false, true ) # this must never hit
rescue
assert_equal( $!.to_s(), "allocator undefined for Basic_TestClass::X" );
if RUBY_VERSION < "3.0.0"
begin
b = RBA::B.new
assert_equal( b.b4( X.new ), "b4_result: -6" )
assert_equal( false, true ) # this must never hit
rescue
assert_equal( $!.to_s(), "allocator undefined for Basic_TestClass::X" );
end
end
# Test, if this throws an error (object of class X passed to A argument):