mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Added rb_warn_deprecated_to_remove
Warn the deprecation and future removal, with obeying the warning flag.
This commit is contained in:
parent
0ea759eac9
commit
aefb13eb63
6 changed files with 29 additions and 14 deletions
18
error.c
18
error.c
|
@ -389,6 +389,20 @@ rb_warn_deprecated(const char *fmt, const char *suggest, ...)
|
||||||
rb_write_warning_str(mesg);
|
rb_write_warning_str(mesg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rb_warn_deprecated_to_remove(const char *fmt, const char *removal, ...)
|
||||||
|
{
|
||||||
|
if (NIL_P(ruby_verbose)) return;
|
||||||
|
if (!rb_warning_category_enabled_p(RB_WARN_CATEGORY_DEPRECATED)) return;
|
||||||
|
va_list args;
|
||||||
|
va_start(args, removal);
|
||||||
|
VALUE mesg = warning_string(0, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
rb_str_set_len(mesg, RSTRING_LEN(mesg) - 1);
|
||||||
|
rb_str_catf(mesg, " is deprecated and will be removed in Ruby %s\n", removal);
|
||||||
|
rb_write_warning_str(mesg);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
end_with_asciichar(VALUE str, int c)
|
end_with_asciichar(VALUE str, int c)
|
||||||
{
|
{
|
||||||
|
@ -3035,14 +3049,14 @@ rb_check_frozen(VALUE obj)
|
||||||
void
|
void
|
||||||
rb_error_untrusted(VALUE obj)
|
rb_error_untrusted(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("rb_error_untrusted is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("rb_error_untrusted", "3.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef rb_check_trusted
|
#undef rb_check_trusted
|
||||||
void
|
void
|
||||||
rb_check_trusted(VALUE obj)
|
rb_check_trusted(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("rb_check_trusted is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("rb_check_trusted", "3.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -138,7 +138,7 @@ path_freeze(VALUE self)
|
||||||
static VALUE
|
static VALUE
|
||||||
path_taint(VALUE self)
|
path_taint(VALUE self)
|
||||||
{
|
{
|
||||||
rb_warn("Pathname#taint is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Pathname#taint", "3.2");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ path_taint(VALUE self)
|
||||||
static VALUE
|
static VALUE
|
||||||
path_untaint(VALUE self)
|
path_untaint(VALUE self)
|
||||||
{
|
{
|
||||||
rb_warn("Pathname#untaint is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Pathname#untaint", "3.2");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
hash.c
2
hash.c
|
@ -4968,7 +4968,7 @@ env_fetch(int argc, VALUE *argv, VALUE _)
|
||||||
int
|
int
|
||||||
rb_env_path_tainted(void)
|
rb_env_path_tainted(void)
|
||||||
{
|
{
|
||||||
rb_warn("rb_env_path_tainted is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("rb_env_path_tainted", "3.2");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ NORETURN(void rb_async_bug_errno(const char *,int));
|
||||||
const char *rb_builtin_type_name(int t);
|
const char *rb_builtin_type_name(int t);
|
||||||
const char *rb_builtin_class_name(VALUE x);
|
const char *rb_builtin_class_name(VALUE x);
|
||||||
PRINTF_ARGS(void rb_warn_deprecated(const char *fmt, const char *suggest, ...), 1, 3);
|
PRINTF_ARGS(void rb_warn_deprecated(const char *fmt, const char *suggest, ...), 1, 3);
|
||||||
|
PRINTF_ARGS(void rb_warn_deprecated_to_remove(const char *fmt, const char *removal, ...), 1, 3);
|
||||||
VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
|
VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
|
||||||
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||||
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||||
|
|
14
object.c
14
object.c
|
@ -1216,7 +1216,7 @@ rb_obj_dummy1(VALUE _x, VALUE _y)
|
||||||
VALUE
|
VALUE
|
||||||
rb_obj_tainted(VALUE obj)
|
rb_obj_tainted(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("Object#tainted? is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Object#tainted?", "3.2");
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1230,7 +1230,7 @@ rb_obj_tainted(VALUE obj)
|
||||||
VALUE
|
VALUE
|
||||||
rb_obj_taint(VALUE obj)
|
rb_obj_taint(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("Object#taint is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Object#taint", "3.2");
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,7 +1245,7 @@ rb_obj_taint(VALUE obj)
|
||||||
VALUE
|
VALUE
|
||||||
rb_obj_untaint(VALUE obj)
|
rb_obj_untaint(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("Object#untaint is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Object#untaint", "3.2");
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1259,7 +1259,7 @@ rb_obj_untaint(VALUE obj)
|
||||||
VALUE
|
VALUE
|
||||||
rb_obj_untrusted(VALUE obj)
|
rb_obj_untrusted(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("Object#untrusted? is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Object#untrusted?", "3.2");
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,7 +1273,7 @@ rb_obj_untrusted(VALUE obj)
|
||||||
VALUE
|
VALUE
|
||||||
rb_obj_untrust(VALUE obj)
|
rb_obj_untrust(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("Object#untrust is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Object#untrust", "3.2");
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1288,7 +1288,7 @@ rb_obj_untrust(VALUE obj)
|
||||||
VALUE
|
VALUE
|
||||||
rb_obj_trust(VALUE obj)
|
rb_obj_trust(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_warn("Object#trust is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("Object#trust", "3.2");
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1299,7 +1299,7 @@ rb_obj_trust(VALUE obj)
|
||||||
void
|
void
|
||||||
rb_obj_infect(VALUE victim, VALUE carrier)
|
rb_obj_infect(VALUE victim, VALUE carrier)
|
||||||
{
|
{
|
||||||
rb_warn("rb_obj_infect is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("rb_obj_infect", "3.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
4
string.c
4
string.c
|
@ -910,14 +910,14 @@ rb_enc_str_new_static(const char *ptr, long len, rb_encoding *enc)
|
||||||
VALUE
|
VALUE
|
||||||
rb_tainted_str_new(const char *ptr, long len)
|
rb_tainted_str_new(const char *ptr, long len)
|
||||||
{
|
{
|
||||||
rb_warn("rb_tainted_str_new is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("rb_tainted_str_new", "3.2");
|
||||||
return rb_str_new(ptr, len);
|
return rb_str_new(ptr, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_tainted_str_new_cstr(const char *ptr)
|
rb_tainted_str_new_cstr(const char *ptr)
|
||||||
{
|
{
|
||||||
rb_warn("rb_tainted_str_new_cstr is deprecated and will be removed in Ruby 3.2.");
|
rb_warn_deprecated_to_remove("rb_tainted_str_new_cstr", "3.2");
|
||||||
return rb_str_new_cstr(ptr);
|
return rb_str_new_cstr(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue