diff --git a/.github/workflows/check_misc.yml b/.github/workflows/check_misc.yml index e4d2b2c68961e5..2a2bd1df53288e 100644 --- a/.github/workflows/check_misc.yml +++ b/.github/workflows/check_misc.yml @@ -53,6 +53,22 @@ jobs: exit $fail working-directory: include + - id: now + run: | + date +"mon=%-m"%n"day=%-d" >> $GITHUB_OUTPUT + env: + TZ: Tokyo/Asia + + - id: deprecation + run: | + eval $(sed -n 's/^#define RUBY_API_VERSION_\(MAJOR\|MINOR\) /\1=/p' include/ruby/version.h) + if git --no-pager grep --color -o 'rb_warn_deprecated_to_remove_at('$MAJOR'\.'$MINOR',.*' -- '*.c' >&2; then + false + else + true + fi + continue-on-error: ${{ steps.now.outputs.mon < 12 }} + - name: Check if to generate documents id: rdoc run: | diff --git a/complex.c b/complex.c index bb54d4f61f31ca..a764557990e8dc 100644 --- a/complex.c +++ b/complex.c @@ -1778,12 +1778,6 @@ rb_complex_new_polar(VALUE x, VALUE y) return f_complex_polar(rb_cComplex, x, y); } -VALUE -rb_complex_polar(VALUE x, VALUE y) -{ - return rb_complex_new_polar(x, y); -} - VALUE rb_Complex(VALUE x, VALUE y) { diff --git a/depend b/depend index 11397bf647adf1..bf001f45ca8169 100644 --- a/depend +++ b/depend @@ -13378,6 +13378,7 @@ re.$(OBJEXT): $(top_srcdir)/internal/box.h re.$(OBJEXT): $(top_srcdir)/internal/class.h re.$(OBJEXT): $(top_srcdir)/internal/compilers.h re.$(OBJEXT): $(top_srcdir)/internal/encoding.h +re.$(OBJEXT): $(top_srcdir)/internal/error.h re.$(OBJEXT): $(top_srcdir)/internal/gc.h re.$(OBJEXT): $(top_srcdir)/internal/hash.h re.$(OBJEXT): $(top_srcdir)/internal/imemo.h diff --git a/doc/security/command_injection.rdoc b/doc/security/command_injection.rdoc index ee33d4a04e6629..d46e42f7be73fb 100644 --- a/doc/security/command_injection.rdoc +++ b/doc/security/command_injection.rdoc @@ -13,25 +13,3 @@ These methods include: - {\`command` (backtick method)}[rdoc-ref:Kernel#`] (also called by the expression %x[command]). - IO.popen (when called with other than "-"). - -Some methods execute a system command only if the given path name starts -with a |: - -- Kernel.open(command). -- IO.read(command). -- IO.write(command). -- IO.binread(command). -- IO.binwrite(command). -- IO.readlines(command). -- IO.foreach(command). -- URI.open(command). - -Note that some of these methods do not execute commands when called -from subclass +File+: - -- File.read(path). -- File.write(path). -- File.binread(path). -- File.binwrite(path). -- File.readlines(path). -- File.foreach(path). diff --git a/ext/-test-/cxxanyargs/cxxanyargs.cpp b/ext/-test-/cxxanyargs/cxxanyargs.cpp index eded13e2eec00a..c7df7f9038272b 100644 --- a/ext/-test-/cxxanyargs/cxxanyargs.cpp +++ b/ext/-test-/cxxanyargs/cxxanyargs.cpp @@ -97,31 +97,6 @@ struct test_rb_define_hooked_variable { }; VALUE test_rb_define_hooked_variable::v = Qundef; -namespace test_rb_iterate { - VALUE - iter(VALUE self) - { - return rb_funcall(self, rb_intern("yield"), 0); - } - - VALUE - block(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) - { - return rb_funcall(arg, rb_intern("=="), 1, param); - } - - VALUE - test(VALUE self) - { -#ifdef HAVE_NULLPTR - rb_iterate(iter, self, nullptr, self); -#endif - - rb_iterate(iter, self, RUBY_METHOD_FUNC(block), self); // old - return rb_iterate(iter, self, block, self); // new - } -} - namespace test_rb_block_call { VALUE block(RB_BLOCK_CALL_FUNC_ARGLIST(arg, param)) @@ -936,7 +911,6 @@ Init_cxxanyargs(void) test(rb_define_virtual_variable); test(rb_define_hooked_variable); - test(rb_iterate); test(rb_block_call); test(rb_rescue); test(rb_rescue2); diff --git a/gc.c b/gc.c index 87db89d04956e6..60860d1e5fe398 100644 --- a/gc.c +++ b/gc.c @@ -11,9 +11,6 @@ **********************************************************************/ -#define rb_data_object_alloc rb_data_object_alloc -#define rb_data_typed_object_alloc rb_data_typed_object_alloc - #include "ruby/internal/config.h" #ifdef _WIN32 # include "ruby/ruby.h" diff --git a/include/ruby/atomic.h b/include/ruby/atomic.h index c7043b047692a6..fcc48f532c89ba 100644 --- a/include/ruby/atomic.h +++ b/include/ruby/atomic.h @@ -34,7 +34,7 @@ # include /* ssize_t */ #endif -#if RBIMPL_COMPILER_SINCE(MSVC, 13, 0, 0) +#if RBIMPL_COMPILER_IS(MSVC) # pragma intrinsic(_InterlockedOr) #elif defined(__sun) && defined(HAVE_ATOMIC_H) # include @@ -790,22 +790,9 @@ rbimpl_atomic_or(volatile rb_atomic_t *ptr, rb_atomic_t val, int memory_order) #elif defined(HAVE_GCC_SYNC_BUILTINS) __sync_or_and_fetch(ptr, val); -#elif RBIMPL_COMPILER_SINCE(MSVC, 13, 0, 0) +#elif RBIMPL_COMPILER_IS(MSVC) _InterlockedOr(ptr, val); -#elif defined(_WIN32) && defined(__GNUC__) - /* This was for old MinGW. Maybe not needed any longer? */ - __asm__( - "lock\n\t" - "orl\t%1, %0" - : "=m"(ptr) - : "Ir"(val)); - -#elif defined(_WIN32) && defined(_M_IX86) - __asm mov eax, ptr; - __asm mov ecx, val; - __asm lock or [eax], ecx; - #elif defined(__sun) && defined(HAVE_ATOMIC_H) atomic_or_uint(ptr, val); @@ -817,15 +804,6 @@ rbimpl_atomic_or(volatile rb_atomic_t *ptr, rb_atomic_t val, int memory_order) #endif } -/* Nobody uses this but for theoretical backwards compatibility... */ -#if RBIMPL_COMPILER_BEFORE(MSVC, 13, 0, 0) -static inline rb_atomic_t -rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val) -{ - return rbimpl_atomic_or(var, val); -} -#endif - RBIMPL_ATTR_ARTIFICIAL() RBIMPL_ATTR_NOALIAS() RBIMPL_ATTR_NONNULL((1)) @@ -1031,16 +1009,9 @@ rbimpl_atomic_cas(volatile rb_atomic_t *ptr, rb_atomic_t oldval, rb_atomic_t new #elif defined(HAVE_GCC_SYNC_BUILTINS) return __sync_val_compare_and_swap(ptr, oldval, newval); -#elif RBIMPL_COMPILER_SINCE(MSVC, 13, 0, 0) +#elif RBIMPL_COMPILER_IS(MSVC) return InterlockedCompareExchange(ptr, newval, oldval); -#elif defined(_WIN32) - PVOID *pptr = RBIMPL_CAST((PVOID *)ptr); - PVOID pold = RBIMPL_CAST((PVOID)oldval); - PVOID pnew = RBIMPL_CAST((PVOID)newval); - PVOID pret = InterlockedCompareExchange(pptr, pnew, pold); - return RBIMPL_CAST((rb_atomic_t)pret); - #elif defined(__sun) && defined(HAVE_ATOMIC_H) return atomic_cas_uint(ptr, oldval, newval); @@ -1054,15 +1025,6 @@ rbimpl_atomic_cas(volatile rb_atomic_t *ptr, rb_atomic_t oldval, rb_atomic_t new #endif } -/* Nobody uses this but for theoretical backwards compatibility... */ -#if RBIMPL_COMPILER_BEFORE(MSVC, 13, 0, 0) -static inline rb_atomic_t -rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval) -{ - return rbimpl_atomic_cas(var, oldval, newval); -} -#endif - RBIMPL_ATTR_ARTIFICIAL() RBIMPL_ATTR_NOALIAS() RBIMPL_ATTR_NONNULL((1)) diff --git a/include/ruby/backward.h b/include/ruby/backward.h index 3a0fda9ec56dda..67261021584e66 100644 --- a/include/ruby/backward.h +++ b/include/ruby/backward.h @@ -11,8 +11,6 @@ #include "ruby/internal/interpreter.h" #include "ruby/backward/2/attributes.h" -RBIMPL_ATTR_DEPRECATED_INTERNAL_ONLY() void rb_clear_constant_cache(void); - /* from version.c */ #if defined(RUBY_SHOW_COPYRIGHT_TO_DIE) && !!(RUBY_SHOW_COPYRIGHT_TO_DIE+0) # error RUBY_SHOW_COPYRIGHT_TO_DIE is deprecated diff --git a/include/ruby/backward/cxxanyargs.hpp b/include/ruby/backward/cxxanyargs.hpp index 2414b7ae6d2461..d37495dd942790 100644 --- a/include/ruby/backward/cxxanyargs.hpp +++ b/include/ruby/backward/cxxanyargs.hpp @@ -190,33 +190,6 @@ rb_define_hooked_variable(const char *q, VALUE *w, std::nullptr_t e, void_type * /// @name Exceptions and tag jumps /// @{ -// RUBY_CXX_DEPRECATED("by rb_block_call since 1.9") -RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated") -/// @brief Old way to implement iterators. -/// @param[in] q A function that can yield. -/// @param[in] w Passed to `q`. -/// @param[in] e What is to be yielded. -/// @param[in] r Passed to `e`. -/// @return The return value of `q`. -/// @note `e` can be nullptr. -/// @deprecated This function is obsoleted since long before 2.x era. Do not -/// use it any longer. rb_block_call() is provided instead. -inline VALUE -rb_iterate(onearg_type *q, VALUE w, type *e, VALUE r) -{ - rb_block_call_func_t t = reinterpret_cast(e); - return backward::rb_iterate_deprecated(q, w, t, r); -} - -#ifdef HAVE_NULLPTR -RUBY_CXX_DEPRECATED("by rb_block_call since 1.9") -inline VALUE -rb_iterate(onearg_type *q, VALUE w, std::nullptr_t e, VALUE r) -{ - return backward::rb_iterate_deprecated(q, w, e, r); -} -#endif - RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprecated") /// @brief Call a method with a block. /// @param[in] q The self. diff --git a/include/ruby/internal/attr/deprecated.h b/include/ruby/internal/attr/deprecated.h index 9c9dea1df2794a..a374ace868adad 100644 --- a/include/ruby/internal/attr/deprecated.h +++ b/include/ruby/internal/attr/deprecated.h @@ -48,7 +48,7 @@ #elif RBIMPL_HAS_ATTRIBUTE(deprecated) /* but not with message. */ # define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__)) -#elif RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0) +#elif RBIMPL_COMPILER_IS(MSVC) # define RBIMPL_ATTR_DEPRECATED(msg) __declspec(deprecated msg) #elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(deprecated) diff --git a/include/ruby/internal/attr/forceinline.h b/include/ruby/internal/attr/forceinline.h index b7daafede7c42c..5b9ae794aff629 100644 --- a/include/ruby/internal/attr/forceinline.h +++ b/include/ruby/internal/attr/forceinline.h @@ -29,7 +29,7 @@ * `__forceinline` are mutually exclusive. We have to mimic that behaviour for * non-MSVC compilers. */ -#if RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0) +#if RBIMPL_COMPILER_IS(MSVC) # define RBIMPL_ATTR_FORCEINLINE() __forceinline #elif RBIMPL_HAS_ATTRIBUTE(always_inline) # define RBIMPL_ATTR_FORCEINLINE() __attribute__((__always_inline__)) inline diff --git a/include/ruby/internal/attr/noexcept.h b/include/ruby/internal/attr/noexcept.h index 7c3f92f1e79e91..dd4c66740765af 100644 --- a/include/ruby/internal/attr/noexcept.h +++ b/include/ruby/internal/attr/noexcept.h @@ -78,7 +78,7 @@ #elif defined(__INTEL_CXX11_MODE__) # define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) -#elif RBIMPL_COMPILER_SINCE(MSVC, 19, 0, 0) +#elif RBIMPL_COMPILER_IS(MSVC) # define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) #elif __cplusplus >= 201103L diff --git a/include/ruby/internal/attr/restrict.h b/include/ruby/internal/attr/restrict.h index e39104138c6fc2..b12fdc9dbc03dd 100644 --- a/include/ruby/internal/attr/restrict.h +++ b/include/ruby/internal/attr/restrict.h @@ -28,7 +28,7 @@ * `__has_declspec_attribute()` which involves macro substitution. */ /** Wraps (or simulates) `__declspec(restrict)` */ -#if RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0) +#if RBIMPL_COMPILER_IS(MSVC) # define RBIMPL_ATTR_RESTRICT() __declspec(re ## strict) #elif RBIMPL_HAS_ATTRIBUTE(malloc) diff --git a/include/ruby/internal/config.h b/include/ruby/internal/config.h index da070f0979c74f..34862ded6e55c2 100644 --- a/include/ruby/internal/config.h +++ b/include/ruby/internal/config.h @@ -50,7 +50,7 @@ # define HAVE_VA_ARGS_MACRO # elif defined(__INTEL_CXX11_MODE__) # define HAVE_VA_ARGS_MACRO -# elif RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0) +# elif RBIMPL_COMPILER_IS(MSVC) # define HAVE_VA_ARGS_MACRO # else # /* NG, not known. */ diff --git a/include/ruby/internal/core/rdata.h b/include/ruby/internal/core/rdata.h index f9ff3acc5febcb..6c58ddedf1be25 100644 --- a/include/ruby/internal/core/rdata.h +++ b/include/ruby/internal/core/rdata.h @@ -351,14 +351,6 @@ rb_data_object_make(VALUE klass, RUBY_DATA_FUNC mark_func, RUBY_DATA_FUNC free_f return result; } -RBIMPL_ATTR_DEPRECATED(("by: rb_data_object_wrap")) -/** @deprecated This function was renamed to rb_data_object_wrap(). */ -static inline VALUE -rb_data_object_alloc(VALUE klass, void *data, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree) -{ - return rb_data_object_wrap(klass, data, dmark, dfree); -} - /** @cond INTERNAL_MACRO */ #define rb_data_object_wrap_0 rb_data_object_wrap #define rb_data_object_wrap_1 rb_data_object_wrap_warning diff --git a/include/ruby/internal/core/rstruct.h b/include/ruby/internal/core/rstruct.h index 69be487b592c7f..0028a1bdcdbdc0 100644 --- a/include/ruby/internal/core/rstruct.h +++ b/include/ruby/internal/core/rstruct.h @@ -31,18 +31,6 @@ # include "ruby/backward.h" #endif -/** - * @private - * - * @deprecated This macro once was a thing in the old days, but makes no sense - * any longer today. Exists here for backwards compatibility - * only. You can safely forget about it. - * - * @internal - * - * Declaration of rb_struct_ptr() is at include/ruby/backward.h. - */ -#define RSTRUCT_PTR(st) rb_struct_ptr(st) /** @cond INTERNAL_MACRO */ #define RSTRUCT_LEN RSTRUCT_LEN #define RSTRUCT_SET RSTRUCT_SET diff --git a/include/ruby/internal/core/rtypeddata.h b/include/ruby/internal/core/rtypeddata.h index 72044562df8e3b..7d7df6c01a2d3b 100644 --- a/include/ruby/internal/core/rtypeddata.h +++ b/include/ruby/internal/core/rtypeddata.h @@ -670,12 +670,4 @@ rb_data_typed_object_make(VALUE klass, const rb_data_type_t *type, void **datap, return result; } -RBIMPL_ATTR_DEPRECATED(("by: rb_data_typed_object_wrap")) -/** @deprecated This function was renamed to rb_data_typed_object_wrap(). */ -static inline VALUE -rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type) -{ - return rb_data_typed_object_wrap(klass, datap, type); -} - #endif /* RBIMPL_RTYPEDDATA_H */ diff --git a/include/ruby/internal/fl_type.h b/include/ruby/internal/fl_type.h index 456ec77b87490a..2afb3f1fa348f2 100644 --- a/include/ruby/internal/fl_type.h +++ b/include/ruby/internal/fl_type.h @@ -59,7 +59,6 @@ #define FL_WB_PROTECTED RBIMPL_CAST((VALUE)RUBY_FL_WB_PROTECTED) /**< @old{RUBY_FL_WB_PROTECTED} */ #define FL_PROMOTED RBIMPL_CAST((VALUE)RUBY_FL_PROMOTED) /**< @old{RUBY_FL_PROMOTED} */ #define FL_FINALIZE RBIMPL_CAST((VALUE)RUBY_FL_FINALIZE) /**< @old{RUBY_FL_FINALIZE} */ -#define FL_TAINT RBIMPL_CAST((VALUE)RUBY_FL_TAINT) /**< @old{RUBY_FL_TAINT} */ #define FL_SHAREABLE RBIMPL_CAST((VALUE)RUBY_FL_SHAREABLE) /**< @old{RUBY_FL_SHAREABLE} */ #define FL_UNTRUSTED RBIMPL_CAST((VALUE)RUBY_FL_UNTRUSTED) /**< @old{RUBY_FL_UNTRUSTED} */ #define FL_EXIVAR RBIMPL_CAST((VALUE)RUBY_FL_EXIVAR) /**< @old{RUBY_FL_EXIVAR} */ @@ -237,21 +236,6 @@ ruby_fl_type { */ RUBY_FL_FINALIZE = (1<<7), - /** - * @deprecated This flag once was a thing back in the old days, but makes - * no sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - */ - RUBY_FL_TAINT - -#if defined(RBIMPL_HAVE_ENUM_ATTRIBUTE) - RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -#elif defined(_MSC_VER) -# pragma deprecated(RUBY_FL_TAINT) -#endif - - = 0, - /** * @deprecated This flag was an implementation detail that should never have * no been exposed. Exists here for backwards @@ -279,21 +263,6 @@ ruby_fl_type { */ RUBY_FL_SHAREABLE = (1<<8), - /** - * @deprecated This flag once was a thing back in the old days, but makes - * no sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - */ - RUBY_FL_UNTRUSTED - -#if defined(RBIMPL_HAVE_ENUM_ATTRIBUTE) - RBIMPL_ATTR_DEPRECATED(("trustedness turned out to be a wrong idea.")) -#elif defined(_MSC_VER) -# pragma deprecated(RUBY_FL_UNTRUSTED) -#endif - - = 0, - /** * This object weakly refers to other objects. * @@ -394,23 +363,6 @@ ruby_fl_type { RUBY_FL_SINGLETON = RUBY_FL_USER1, }; -enum { - /** - * @deprecated This flag once was a thing back in the old days, but makes - * no sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - */ - RUBY_FL_DUPPED - -#if defined(RBIMPL_HAVE_ENUM_ATTRIBUTE) - RBIMPL_ATTR_DEPRECATED(("It seems there is no actual usage of this enum.")) -#elif defined(_MSC_VER) -# pragma deprecated(RUBY_FL_DUPPED) -#endif - - = (int)RUBY_T_MASK -}; - #undef RBIMPL_HAVE_ENUM_ATTRIBUTE RBIMPL_SYMBOL_EXPORT_BEGIN() @@ -735,128 +687,6 @@ RB_FL_REVERSE(VALUE obj, VALUE flags) } } -RBIMPL_ATTR_PURE_UNLESS_DEBUG() -RBIMPL_ATTR_ARTIFICIAL() -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return false always. - */ -static inline bool -RB_OBJ_TAINTABLE(VALUE obj) -{ - (void)obj; - return false; -} - -RBIMPL_ATTR_PURE_UNLESS_DEBUG() -RBIMPL_ATTR_ARTIFICIAL() -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return false always. - */ -static inline VALUE -RB_OBJ_TAINTED_RAW(VALUE obj) -{ - (void)obj; - return false; -} - -RBIMPL_ATTR_PURE_UNLESS_DEBUG() -RBIMPL_ATTR_ARTIFICIAL() -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return false always. - */ -static inline bool -RB_OBJ_TAINTED(VALUE obj) -{ - (void)obj; - return false; -} - -RBIMPL_ATTR_ARTIFICIAL() -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - */ -static inline void -RB_OBJ_TAINT_RAW(VALUE obj) -{ - (void)obj; - return; -} - -RBIMPL_ATTR_ARTIFICIAL() -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - */ -static inline void -RB_OBJ_TAINT(VALUE obj) -{ - (void)obj; - return; -} - -RBIMPL_ATTR_ARTIFICIAL() -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] dst Victim object. - * @param[in] src Infectant object. - */ -static inline void -RB_OBJ_INFECT_RAW(VALUE dst, VALUE src) -{ - (void)dst; - (void)src; - return; -} - -RBIMPL_ATTR_ARTIFICIAL() -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] dst Victim object. - * @param[in] src Infectant object. - */ -static inline void -RB_OBJ_INFECT(VALUE dst, VALUE src) -{ - (void)dst; - (void)src; - return; -} - RBIMPL_ATTR_PURE_UNLESS_DEBUG() RBIMPL_ATTR_ARTIFICIAL() /** diff --git a/include/ruby/internal/gc.h b/include/ruby/internal/gc.h index 5ab3bb266e242f..21c2b670b3ed72 100644 --- a/include/ruby/internal/gc.h +++ b/include/ruby/internal/gc.h @@ -823,7 +823,4 @@ rb_obj_write( return a; } -RBIMPL_ATTR_DEPRECATED(("Will be removed soon")) -static inline void rb_gc_force_recycle(VALUE obj){} - #endif /* RBIMPL_GC_H */ diff --git a/include/ruby/internal/intern/complex.h b/include/ruby/internal/intern/complex.h index e111bd8ced7b6b..1efc093631f3a6 100644 --- a/include/ruby/internal/intern/complex.h +++ b/include/ruby/internal/intern/complex.h @@ -87,10 +87,6 @@ VALUE rb_complex_new(VALUE real, VALUE imag); */ VALUE rb_complex_new_polar(VALUE abs, VALUE arg); -RBIMPL_ATTR_DEPRECATED(("by: rb_complex_new_polar")) -/** @old{rb_complex_new_polar} */ -VALUE rb_complex_polar(VALUE abs, VALUE arg); - RBIMPL_ATTR_PURE() /** * Queries the real part of the passed Complex. diff --git a/include/ruby/internal/iterator.h b/include/ruby/internal/iterator.h index 60e3535fd97a24..891045363ef5ba 100644 --- a/include/ruby/internal/iterator.h +++ b/include/ruby/internal/iterator.h @@ -265,48 +265,6 @@ int rb_block_given_p(void); */ void rb_need_block(void); -#ifndef __cplusplus -RBIMPL_ATTR_DEPRECATED(("by: rb_block_call since 1.9")) -#endif -/** - * Old way to iterate a block. - * - * @deprecated This is an old API. Use rb_block_call() instead. - * @warning The passed function must at least once call a ruby method - * (to handle interrupts etc.) - * @param[in] func1 A function that could yield a value. - * @param[in,out] data1 Passed to `func1` - * @param[in] proc A function acts as a block. - * @param[in,out] data2 Passed to `proc` as the data2 parameter. - * @return What `func1` returns. - */ -VALUE rb_iterate(VALUE (*func1)(VALUE), VALUE data1, rb_block_call_func_t proc, VALUE data2); - -#ifdef __cplusplus -namespace ruby { -namespace backward { -/** - * Old way to iterate a block. - * - * @deprecated This is an old API. Use rb_block_call() instead. - * @warning The passed function must at least once call a ruby method - * (to handle interrupts etc.) - * @param[in] iter A function that could yield a value. - * @param[in,out] data1 Passed to `func1` - * @param[in] bl A function acts as a block. - * @param[in,out] data2 Passed to `proc` as the data2 parameter. - * @return What `func1` returns. - */ -static inline VALUE -rb_iterate_deprecated(VALUE (*iter)(VALUE), VALUE data1, rb_block_call_func_t bl, VALUE data2) -{ - return ::rb_iterate(iter, data1, bl, data2); -}}} - -RBIMPL_ATTR_DEPRECATED(("by: rb_block_call since 1.9")) -VALUE rb_iterate(VALUE (*func1)(VALUE), VALUE data1, rb_block_call_func_t proc, VALUE data2); -#endif - /** * Identical to rb_funcallv(), except it additionally passes a function as a * block. When the method yields, `proc` is called with the yielded value as diff --git a/include/ruby/internal/newobj.h b/include/ruby/internal/newobj.h index 6eee2fa5fa7643..13030ae279b3cf 100644 --- a/include/ruby/internal/newobj.h +++ b/include/ruby/internal/newobj.h @@ -109,42 +109,4 @@ void rb_singleton_class_attached(VALUE klass, VALUE obj); void rb_copy_generic_ivar(VALUE clone, VALUE obj); RBIMPL_SYMBOL_EXPORT_END() -RBIMPL_ATTR_DEPRECATED(("This is no longer how Object#clone works.")) -/** - * @deprecated Not sure exactly when but at some time, the implementation of - * `Object#clone` stopped using this function. It remained - * untouched for a while, and then @shyouhei realised that they - * are no longer doing the same thing. It seems nobody seriously - * uses this function any longer. Let's just abandon it. - * - * @param[out] clone The destination object. - * @param[in] obj The source object. - */ -static inline void -rb_clone_setup(VALUE clone, VALUE obj) -{ - (void)clone; - (void)obj; - return; -} - -RBIMPL_ATTR_DEPRECATED(("This is no longer how Object#dup works.")) -/** - * @deprecated Not sure exactly when but at some time, the implementation of - * `Object#dup` stopped using this function. It remained - * untouched for a while, and then @shyouhei realised that they - * are no longer the same thing. It seems nobody seriously uses - * this function any longer. Let's just abandon it. - * - * @param[out] dup The destination object. - * @param[in] obj The source object. - */ -static inline void -rb_dup_setup(VALUE dup, VALUE obj) -{ - (void)dup; - (void)obj; - return; -} - #endif /* RBIMPL_NEWOBJ_H */ diff --git a/include/ruby/internal/static_assert.h b/include/ruby/internal/static_assert.h index 7f00bc21ebec14..30bfd3bb793378 100644 --- a/include/ruby/internal/static_assert.h +++ b/include/ruby/internal/static_assert.h @@ -30,7 +30,7 @@ # /* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */ # define RBIMPL_STATIC_ASSERT0 static_assert -#elif defined(__cplusplus) && RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0) +#elif defined(__cplusplus) && RBIMPL_COMPILER_IS(MSVC) # define RBIMPL_STATIC_ASSERT0 static_assert #elif defined(__INTEL_CXX11_MODE__) diff --git a/include/ruby/internal/warning_push.h b/include/ruby/internal/warning_push.h index f5981633f837b7..91d62cb00d98f3 100644 --- a/include/ruby/internal/warning_push.h +++ b/include/ruby/internal/warning_push.h @@ -79,7 +79,7 @@ */ #define RBIMPL_WARNING_IGNORED(flag) __pragma(warning(disable: flag)) -#elif RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0) +#elif RBIMPL_COMPILER_IS(MSVC) # /* Not sure exactly when but it seems VC++ 6.0 is a version with it.*/ # define RBIMPL_WARNING_PUSH() __pragma(warning(push)) # define RBIMPL_WARNING_POP() __pragma(warning(pop)) diff --git a/internal/error.h b/internal/error.h index de189698b8f2e5..cecaa5c4a8d69e 100644 --- a/internal/error.h +++ b/internal/error.h @@ -79,7 +79,7 @@ PRINTF_ARGS(void rb_warn_reserved_name(const char *removal, const char *fmt, ... # define RUBY_VERSION_BEFORE(major, minor) (RUBY_API_VERSION_CODE < (major * 10000) + (minor) * 100) # if defined(RBIMPL_WARNING_PRAGMA0) # define RBIMPL_TODO0(x) RBIMPL_WARNING_PRAGMA0(message(x)) -# elif RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0) +# elif RBIMPL_COMPILER_IS(MSVC) # define RBIMPL_TODO0(x) __pragma(message(x)) # endif diff --git a/internal/vm.h b/internal/vm.h index 09dfaf182e9a92..029b19d55561c2 100644 --- a/internal/vm.h +++ b/internal/vm.h @@ -101,8 +101,6 @@ const struct rb_callcache *rb_vm_search_method_slowpath(const struct rb_callinfo /* vm_method.c */ int rb_ec_obj_respond_to(struct rb_execution_context_struct *ec, VALUE obj, ID id, int priv); -void rb_clear_constant_cache(void); - /* vm_dump.c */ void rb_print_backtrace(FILE *); diff --git a/io.c b/io.c index 42017b1c253035..7088f036c564cb 100644 --- a/io.c +++ b/io.c @@ -8256,9 +8256,6 @@ rb_io_s_sysopen(int argc, VALUE *argv, VALUE _) * * Creates an IO object connected to the given file. * - * This method has potential security vulnerabilities if called with untrusted input; - * see {Command Injection}[rdoc-ref:security/command_injection.rdoc]. - * * With no block given, file stream is returned: * * open('t.txt') # => # @@ -12054,10 +12051,6 @@ io_s_foreach(VALUE v) * * Calls the block with each successive line read from the stream. * - * When called from class \IO (but not subclasses of \IO), - * this method has potential security vulnerabilities if called with untrusted input; - * see {Command Injection}[rdoc-ref:security/command_injection.rdoc]. - * * The first argument must be a string that is the path to a file. * * With only argument +path+ given, parses lines from the file at the given +path+, @@ -12157,10 +12150,6 @@ io_s_readlines(VALUE v) * * Returns an array of all lines read from the stream. * - * When called from class \IO (but not subclasses of \IO), - * this method has potential security vulnerabilities if called with untrusted input; - * see {Command Injection}[rdoc-ref:security/command_injection.rdoc]. - * * The first argument must be a string that is the path to a file. * * With only argument +path+ given, parses lines from the file at the given +path+, @@ -12246,10 +12235,6 @@ seek_before_access(VALUE argp) * Opens the stream, reads and returns some or all of its content, * and closes the stream; returns +nil+ if no bytes were read. * - * When called from class \IO (but not subclasses of \IO), - * this method has potential security vulnerabilities if called with untrusted input; - * see {Command Injection}[rdoc-ref:security/command_injection.rdoc]. - * * The first argument must be a string that is the path to a file. * * With only argument +path+ given, reads in text mode and returns the entire content @@ -12317,10 +12302,6 @@ rb_io_s_read(int argc, VALUE *argv, VALUE io) * Behaves like IO.read, except that the stream is opened in binary mode * with ASCII-8BIT encoding. * - * When called from class \IO (but not subclasses of \IO), - * this method has potential security vulnerabilities if called with untrusted input; - * see {Command Injection}[rdoc-ref:security/command_injection.rdoc]. - * */ static VALUE @@ -12421,10 +12402,6 @@ io_s_write(int argc, VALUE *argv, VALUE klass, int binary) * Opens the stream, writes the given +data+ to it, * and closes the stream; returns the number of bytes written. * - * When called from class \IO (but not subclasses of \IO), - * this method has potential security vulnerabilities if called with untrusted input; - * see {Command Injection}[rdoc-ref:security/command_injection.rdoc]. - * * The first argument must be a string that is the path to a file. * * With only argument +path+ given, writes the given +data+ to the file at that path: @@ -12471,10 +12448,6 @@ rb_io_s_write(int argc, VALUE *argv, VALUE io) * Behaves like IO.write, except that the stream is opened in binary mode * with ASCII-8BIT encoding. * - * When called from class \IO (but not subclasses of \IO), - * this method has potential security vulnerabilities if called with untrusted input; - * see {Command Injection}[rdoc-ref:security/command_injection.rdoc]. - * */ static VALUE diff --git a/re.c b/re.c index e4d30d2939596e..19bf674c268665 100644 --- a/re.c +++ b/re.c @@ -17,6 +17,7 @@ #include "hrtime.h" #include "internal.h" #include "internal/encoding.h" +#include "internal/error.h" #include "internal/hash.h" #include "internal/imemo.h" #include "internal/re.h" @@ -3970,7 +3971,6 @@ struct reg_init_args { static VALUE reg_extract_args(int argc, VALUE *argv, struct reg_init_args *args); static VALUE reg_init_args(VALUE self, VALUE str, rb_encoding *enc, int flags); -void rb_warn_deprecated_to_remove(const char *removal, const char *fmt, const char *suggest, ...); /* * call-seq: diff --git a/ruby.c b/ruby.c index b00fc1502dec1c..28f43176d61d70 100644 --- a/ruby.c +++ b/ruby.c @@ -1811,13 +1811,6 @@ ruby_opt_init(ruby_cmdline_options_t *opt) } } - /* [Feature #19785] Warning for removed GC environment variable. - * Remove this in Ruby 3.4. */ - if (getenv("RUBY_GC_HEAP_INIT_SLOTS")) { - rb_warn_deprecated("The environment variable RUBY_GC_HEAP_INIT_SLOTS", - "environment variables RUBY_GC_HEAP_%d_INIT_SLOTS"); - } - Init_ext(); /* load statically linked extensions before rubygems */ Init_extra_exts(); diff --git a/spec/ruby/optional/capi/array_spec.rb b/spec/ruby/optional/capi/array_spec.rb index 9c35017e211ed6..7e878598566659 100644 --- a/spec/ruby/optional/capi/array_spec.rb +++ b/spec/ruby/optional/capi/array_spec.rb @@ -343,37 +343,39 @@ end end - describe "rb_iterate" do - it "calls an callback function as a block passed to an method" do - s = [1,2,3,4] - s2 = @s.rb_iterate(s) + ruby_version_is ""..."4.0" do + describe "rb_iterate" do + it "calls an callback function as a block passed to an method" do + s = [1,2,3,4] + s2 = @s.rb_iterate(s) - s2.should == s + s2.should == s - # Make sure they're different objects - s2.equal?(s).should be_false - end + # Make sure they're different objects + s2.equal?(s).should be_false + end - it "calls a function with the other function available as a block" do - h = {a: 1, b: 2} + it "calls a function with the other function available as a block" do + h = {a: 1, b: 2} - @s.rb_iterate_each_pair(h).sort.should == [1,2] - end + @s.rb_iterate_each_pair(h).sort.should == [1,2] + end - it "calls a function which can yield into the original block" do - s2 = [] + it "calls a function which can yield into the original block" do + s2 = [] - o = Object.new - def o.each - yield 1 - yield 2 - yield 3 - yield 4 - end + o = Object.new + def o.each + yield 1 + yield 2 + yield 3 + yield 4 + end - @s.rb_iterate_then_yield(o) { |x| s2 << x } + @s.rb_iterate_then_yield(o) { |x| s2 << x } - s2.should == [1,2,3,4] + s2.should == [1,2,3,4] + end end end diff --git a/spec/ruby/optional/capi/ext/array_spec.c b/spec/ruby/optional/capi/ext/array_spec.c index 2347798bb47c64..628c4df9d74a60 100644 --- a/spec/ruby/optional/capi/ext/array_spec.c +++ b/spec/ruby/optional/capi/ext/array_spec.c @@ -196,6 +196,7 @@ static VALUE copy_ary(RB_BLOCK_CALL_FUNC_ARGLIST(el, new_ary)) { return rb_ary_push(new_ary, el); } +#ifndef RUBY_VERSION_IS_4_0 static VALUE array_spec_rb_iterate(VALUE self, VALUE ary) { VALUE new_ary = rb_ary_new(); @@ -203,6 +204,7 @@ static VALUE array_spec_rb_iterate(VALUE self, VALUE ary) { return new_ary; } +#endif static VALUE array_spec_rb_block_call(VALUE self, VALUE ary) { VALUE new_ary = rb_ary_new(); @@ -216,6 +218,7 @@ static VALUE sub_pair(RB_BLOCK_CALL_FUNC_ARGLIST(el, holder)) { return rb_ary_push(holder, rb_ary_entry(el, 1)); } +#ifndef RUBY_VERSION_IS_4_0 static VALUE each_pair(VALUE obj) { return rb_funcall(obj, rb_intern("each_pair"), 0); } @@ -227,6 +230,7 @@ static VALUE array_spec_rb_iterate_each_pair(VALUE self, VALUE obj) { return new_ary; } +#endif static VALUE array_spec_rb_block_call_each_pair(VALUE self, VALUE obj) { VALUE new_ary = rb_ary_new(); @@ -241,10 +245,12 @@ static VALUE iter_yield(RB_BLOCK_CALL_FUNC_ARGLIST(el, ary)) { return Qnil; } +#ifndef RUBY_VERSION_IS_4_0 static VALUE array_spec_rb_iterate_then_yield(VALUE self, VALUE obj) { rb_iterate(rb_each, obj, iter_yield, obj); return Qnil; } +#endif static VALUE array_spec_rb_block_call_then_yield(VALUE self, VALUE obj) { rb_block_call(obj, rb_intern("each"), 0, 0, iter_yield, obj); @@ -308,9 +314,11 @@ void Init_array_spec(void) { rb_define_method(cls, "rb_ary_plus", array_spec_rb_ary_plus, 2); rb_define_method(cls, "rb_ary_unshift", array_spec_rb_ary_unshift, 2); rb_define_method(cls, "rb_assoc_new", array_spec_rb_assoc_new, 2); +#ifndef RUBY_VERSION_IS_4_0 rb_define_method(cls, "rb_iterate", array_spec_rb_iterate, 1); rb_define_method(cls, "rb_iterate_each_pair", array_spec_rb_iterate_each_pair, 1); rb_define_method(cls, "rb_iterate_then_yield", array_spec_rb_iterate_then_yield, 1); +#endif rb_define_method(cls, "rb_block_call", array_spec_rb_block_call, 1); rb_define_method(cls, "rb_block_call_each_pair", array_spec_rb_block_call_each_pair, 1); rb_define_method(cls, "rb_block_call_then_yield", array_spec_rb_block_call_then_yield, 1); diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 594e2b8aa8a4ca..09199c34b1c3cc 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -453,13 +453,6 @@ class << b; end end def test_gc_parameter - env = { - "RUBY_GC_HEAP_INIT_SLOTS" => "100" - } - assert_in_out_err([env, "-W0", "-e", "exit"], "", [], []) - assert_in_out_err([env, "-W:deprecated", "-e", "exit"], "", [], - /The environment variable RUBY_GC_HEAP_INIT_SLOTS is deprecated; use environment variables RUBY_GC_HEAP_%d_INIT_SLOTS instead/) - env = {} GC.stat_heap.keys.each do |heap| env["RUBY_GC_HEAP_#{heap}_INIT_SLOTS"] = "200000" diff --git a/vm_eval.c b/vm_eval.c index 34560d704a15a5..707344718bced0 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -1533,13 +1533,6 @@ rb_iterate_internal(VALUE (* it_proc)(VALUE), VALUE data1, GET_EC()); } -VALUE -rb_iterate(VALUE (* it_proc)(VALUE), VALUE data1, - rb_block_call_func_t bl_proc, VALUE data2) -{ - return rb_iterate_internal(it_proc, data1, bl_proc, data2); -} - struct iter_method_arg { VALUE obj; ID mid; diff --git a/vm_method.c b/vm_method.c index 2b3ac74d573434..26dbe4cae8b416 100644 --- a/vm_method.c +++ b/vm_method.c @@ -325,9 +325,6 @@ rb_clear_constant_cache_for_id_i(st_data_t ic, st_data_t arg) return ST_CONTINUE; } -// Here for backward compat. -void rb_clear_constant_cache(void) {} - void rb_clear_constant_cache_for_id(ID id) { diff --git a/win32/setup.mak b/win32/setup.mak index 6eeaa325aea45e..50090094552811 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -188,12 +188,16 @@ echo TEENY = RUBY_VERSION_TEENY echo ABI_VERSION = RUBY_ABI_VERSION #endif set /a MSC_VER = _MSC_VER -#if _MSC_VER >= 1920 +#ifndef _MSC_VER +# error _MSC_VER not defined +#elif _MSC_VER >= 1920 set /a MSC_VER_LOWER = MSC_VER/20*20+0 set /a MSC_VER_UPPER = MSC_VER/20*20+19 #elif _MSC_VER >= 1900 set /a MSC_VER_LOWER = MSC_VER/10*10+0 set /a MSC_VER_UPPER = MSC_VER/10*10+9 +#elif _MSC_VER < 1400 +# error Unsupported VC++ compiler #endif set MSC_VER del %0 & exit diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs index c081bc9e22abab..61dbf9b5c35929 100644 --- a/yjit/src/cruby_bindings.inc.rs +++ b/yjit/src/cruby_bindings.inc.rs @@ -225,10 +225,8 @@ pub const RUBY_FL_WB_PROTECTED: ruby_fl_type = 32; pub const RUBY_FL_PROMOTED: ruby_fl_type = 32; pub const RUBY_FL_USERPRIV0: ruby_fl_type = 64; pub const RUBY_FL_FINALIZE: ruby_fl_type = 128; -pub const RUBY_FL_TAINT: ruby_fl_type = 0; pub const RUBY_FL_EXIVAR: ruby_fl_type = 0; pub const RUBY_FL_SHAREABLE: ruby_fl_type = 256; -pub const RUBY_FL_UNTRUSTED: ruby_fl_type = 0; pub const RUBY_FL_WEAK_REFERENCE: ruby_fl_type = 512; pub const RUBY_FL_UNUSED10: ruby_fl_type = 1024; pub const RUBY_FL_FREEZE: ruby_fl_type = 2048; diff --git a/zjit/src/cruby_bindings.inc.rs b/zjit/src/cruby_bindings.inc.rs index 8f5ea5b8a837cd..5bb62e89fa8d3e 100644 --- a/zjit/src/cruby_bindings.inc.rs +++ b/zjit/src/cruby_bindings.inc.rs @@ -286,10 +286,8 @@ pub const RUBY_FL_WB_PROTECTED: ruby_fl_type = 32; pub const RUBY_FL_PROMOTED: ruby_fl_type = 32; pub const RUBY_FL_USERPRIV0: ruby_fl_type = 64; pub const RUBY_FL_FINALIZE: ruby_fl_type = 128; -pub const RUBY_FL_TAINT: ruby_fl_type = 0; pub const RUBY_FL_EXIVAR: ruby_fl_type = 0; pub const RUBY_FL_SHAREABLE: ruby_fl_type = 256; -pub const RUBY_FL_UNTRUSTED: ruby_fl_type = 0; pub const RUBY_FL_WEAK_REFERENCE: ruby_fl_type = 512; pub const RUBY_FL_UNUSED10: ruby_fl_type = 1024; pub const RUBY_FL_FREEZE: ruby_fl_type = 2048;