From 05313c914b29f7027b27a91021ae2662f0149e54 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Mon, 28 Sep 2020 10:10:31 -0700 Subject: Use category: :deprecated in warnings that are related to deprecation Also document that both :deprecated and :experimental are supported :category option values. The locations where warnings were marked as deprecation warnings was previously reviewed by shyouhei. Comment a couple locations where deprecation warnings should probably be used but are not currently used because deprecation warning enablement has not occurred at the time they are called (RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K). Add assert_deprecated_warn to test assertions. Use this to simplify some tests, and fix failing tests after marking some warnings with deprecated category. --- io.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 15032d72c2..e42c2dcc0a 100644 --- a/io.c +++ b/io.c @@ -1956,7 +1956,7 @@ rb_io_writev(VALUE io, int argc, const VALUE *argv) if (io != rb_ractor_stderr() && RTEST(ruby_verbose)) { VALUE klass = CLASS_OF(io); char sep = FL_TEST(klass, FL_SINGLETON) ? (klass = io, '.') : '#'; - rb_warning("%+"PRIsVALUE"%c""write is outdated interface" + rb_category_warning(RB_WARN_CATEGORY_DEPRECATED, "%+"PRIsVALUE"%c""write is outdated interface" " which accepts just one argument", klass, sep); } @@ -7717,7 +7717,7 @@ rb_io_print(int argc, const VALUE *argv, VALUE out) argv = &line; } if (argc > 1 && !NIL_P(rb_output_fs)) { - rb_warn("$, is set to non-nil value"); + rb_category_warn(RB_WARN_CATEGORY_DEPRECATED, "$, is set to non-nil value"); } for (i=0; i0) { @@ -10238,7 +10238,8 @@ rb_f_syscall(int argc, VALUE *argv, VALUE _) int i; if (RTEST(ruby_verbose)) { - rb_warning("We plan to remove a syscall function at future release. DL(Fiddle) provides safer alternative."); + rb_category_warning(RB_WARN_CATEGORY_DEPRECATED, + "We plan to remove a syscall function at future release. DL(Fiddle) provides safer alternative."); } if (argc == 0) -- cgit v1.2.3