diff options
author | 卜部昌平 <[email protected]> | 2021-01-26 09:48:49 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2021-01-27 09:30:15 +0900 |
commit | f8a117f858cdb748c400396aa5a4d46e4832f4e2 (patch) | |
tree | b068c843d9c887da30532fd3e38d45e1a6e7ecb5 /include/ruby | |
parent | 73e948afd5d465548868189d1bd0a8d35e238fb2 (diff) |
kill CLONESETUP and DUPSETUP
They are no longer how Object#clone/Object#dup are defined. In fact
DUPSETUP is not used from anywhere. CLONESETUP has only one usage.
Let's not expose them to extension libraries.
cf https://github.com/ruby/ruby/pull/4100#discussion_r563481718
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/internal/fl_type.h | 14 | ||||
-rw-r--r-- | include/ruby/internal/newobj.h | 18 |
2 files changed, 18 insertions, 14 deletions
diff --git a/include/ruby/internal/fl_type.h b/include/ruby/internal/fl_type.h index 29cc6baf6c..4bfae26817 100644 --- a/include/ruby/internal/fl_type.h +++ b/include/ruby/internal/fl_type.h @@ -227,7 +227,19 @@ ruby_fl_type { RUBY_FL_SINGLETON = RUBY_FL_USER0, }; -enum { RUBY_FL_DUPPED = RUBY_T_MASK | RUBY_FL_EXIVAR | RUBY_FL_SHAREABLE }; +enum { + RUBY_FL_DUPPED + +#if RBIMPL_HAS_EXTENSION(enumerator_attributes) + RBIMPL_ATTR_DEPRECATED(("It seems there is no actual usage of this enum.")) +#elif RBIMPL_COMPILER_SINCE(GCC, 6, 0, 0) + RBIMPL_ATTR_DEPRECATED(("It seems there is no actual usage of this enum.")) +#elif defined(_MSC_VER) +# pragma deprecated(RUBY_FL_UNTRUSTED) +#endif + + = RUBY_T_MASK | RUBY_FL_EXIVAR +}; RBIMPL_SYMBOL_EXPORT_BEGIN() void rb_obj_infect(VALUE victim, VALUE carrier); diff --git a/include/ruby/internal/newobj.h b/include/ruby/internal/newobj.h index 684226e54b..1bb4f0efa3 100644 --- a/include/ruby/internal/newobj.h +++ b/include/ruby/internal/newobj.h @@ -20,6 +20,7 @@ * extension libraries. They could be written in C++98. * @brief Defines #NEWOBJ. */ +#include "ruby/internal/attr/deprecated.h" #include "ruby/internal/cast.h" #include "ruby/internal/core/rbasic.h" #include "ruby/internal/dllexport.h" @@ -47,27 +48,18 @@ void rb_singleton_class_attached(VALUE,VALUE); void rb_copy_generic_ivar(VALUE,VALUE); RBIMPL_SYMBOL_EXPORT_END() +RBIMPL_ATTR_DEPRECATED(("This is no longer how Object#clone works.")) static inline void rb_clone_setup(VALUE clone, VALUE obj) { - RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(obj)); - RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(clone)); - - const VALUE flags = RUBY_FL_PROMOTED0 | RUBY_FL_PROMOTED1 | RUBY_FL_FINALIZE; - rb_obj_setup(clone, rb_singleton_class_clone(obj), - RB_FL_TEST_RAW(obj, ~flags)); - rb_singleton_class_attached(RBASIC_CLASS(clone), clone); - if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(clone, obj); + return; } +RBIMPL_ATTR_DEPRECATED(("This is no longer how Object#dup works.")) static inline void rb_dup_setup(VALUE dup, VALUE obj) { - RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(obj)); - RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(dup)); - - rb_obj_setup(dup, rb_obj_class(obj), RB_FL_TEST_RAW(obj, RUBY_FL_DUPPED)); - if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(dup, obj); + return; } #endif /* RBIMPL_NEWOBJ_H */ |