From 7e2dbbda357b8c509358a3aa10ff6d588ed819e2 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Wed, 16 Dec 2020 09:02:23 -0800 Subject: Use category: :experimental in warnings that are related to experimental features This adds rb_category_compile_warn in order to emit compiler warnings with categories. Note that Ripper currently ignores the category for these warnings, but by default it ignores the warnings completely, so this shouldn't matter. --- error.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index 7a7d5622e5..ce3dc1132c 100644 --- a/error.c +++ b/error.c @@ -375,6 +375,20 @@ rb_compile_warning(const char *file, int line, const char *fmt, ...) rb_write_warning_str(str); } +void +rb_category_compile_warn(rb_warning_category_t category, const char *file, int line, const char *fmt, ...) +{ + VALUE str; + va_list args; + + if (NIL_P(ruby_verbose)) return; + + va_start(args, fmt); + str = warn_vsprintf(NULL, file, line, fmt, args); + va_end(args); + rb_warn_category(str, rb_hash_fetch(warning_category_t_map, INT2NUM(category))); +} + static VALUE warning_string(rb_encoding *enc, const char *fmt, va_list args) { -- cgit v1.2.3