[前][次][番号順一覧][スレッド一覧]

ruby-changes:67194

From: Nobuyoshi <ko1@a...>
Date: Thu, 19 Aug 2021 17:50:16 +0900 (JST)
Subject: [ruby-changes:67194] 6963f8f743 (master): Remove old warning aged nearly 8 years

https://git.ruby-lang.org/ruby.git/commit/?id=6963f8f743

From 6963f8f743b42f9004a0879cd66c550f18987352 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 19 Aug 2021 17:37:06 +0900
Subject: Remove old warning aged nearly 8 years

---
 class.c                |  6 ------
 hash.c                 | 23 -----------------------
 internal/class.h       |  1 -
 test/ruby/test_hash.rb |  9 ---------
 4 files changed, 39 deletions(-)

diff --git a/class.c b/class.c
index ef3db6d..41dbcf5 100644
--- a/class.c
+++ b/class.c
@@ -2363,12 +2363,6 @@ rb_scan_args_kw(int kw_flag, int argc, const VALUE *argv, const char *fmt, ...) https://github.com/ruby/ruby/blob/trunk/class.c#L2363
     return rb_scan_args_result(&arg, argc);
 }
 
-int
-rb_class_has_methods(VALUE c)
-{
-    return rb_id_table_size(RCLASS_M_TBL(c)) == 0 ? FALSE : TRUE;
-}
-
 /*!
  * \}
  */
diff --git a/hash.c b/hash.c
index 6208ab9..6fa85e8 100644
--- a/hash.c
+++ b/hash.c
@@ -52,11 +52,6 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L52
 #include "gc.h"
 #endif
 
-#define HAS_EXTRA_STATES(hash, klass) ( \
-    ((klass = has_extra_methods(rb_obj_class(hash))) != 0) || \
-    FL_TEST((hash), FL_EXIVAR|RHASH_PROC_DEFAULT) || \
-    !NIL_P(RHASH_IFNONE(hash)))
-
 #define SET_DEFAULT(hash, ifnone) ( \
     FL_UNSET_RAW(hash, RHASH_PROC_DEFAULT), \
     RHASH_SET_IFNONE(hash, ifnone))
@@ -73,18 +68,6 @@ copy_default(struct RHash *hash, const struct RHash *hash2) https://github.com/ruby/ruby/blob/trunk/hash.c#L68
     RHASH_SET_IFNONE(hash, RHASH_IFNONE((VALUE)hash2));
 }
 
-static VALUE
-has_extra_methods(VALUE klass)
-{
-    const VALUE base = rb_cHash;
-    VALUE c = klass;
-    while (c != base) {
-	if (rb_class_has_methods(c)) return klass;
-	c = RCLASS_SUPER(c);
-    }
-    return 0;
-}
-
 static VALUE rb_hash_s_try_convert(VALUE, VALUE);
 
 /*
@@ -2608,12 +2591,6 @@ rb_hash_reject(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L2591
     VALUE result;
 
     RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
-    if (RTEST(ruby_verbose)) {
-	VALUE klass;
-	if (HAS_EXTRA_STATES(hash, klass)) {
-	    rb_warn("extra states are no longer copied: %+"PRIsVALUE, hash);
-	}
-    }
     result = hash_dup_with_compare_by_id(hash);
     if (!RHASH_EMPTY_P(hash)) {
 	rb_hash_foreach(result, delete_if_i, result);
diff --git a/internal/class.h b/internal/class.h
index 1d25d9e..cabd5db 100644
--- a/internal/class.h
+++ b/internal/class.h
@@ -127,7 +127,6 @@ VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj); https://github.com/ruby/ruby/blob/trunk/internal/class.h#L127
 VALUE rb_special_singleton_class(VALUE);
 VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
 VALUE rb_singleton_class_get(VALUE obj);
-int rb_class_has_methods(VALUE c);
 void rb_undef_methods_from(VALUE klass, VALUE super);
 
 static inline void RCLASS_SET_ORIGIN(VALUE klass, VALUE origin);
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 028610e..ac0d1df 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -2048,21 +2048,12 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L2048
 
   class TestSubHash < TestHash
     class SubHash < Hash
-      def reject(*)
-        super
-      end
     end
 
     def setup
       @cls = SubHash
       super
     end
-
-    def test_reject
-      assert_warning(/extra states are no longer copied/) do
-        super
-      end
-    end
   end
 
   ruby2_keywords def get_flagged_hash(*args)
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]