summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-12-16 08:15:13 -0800
committerJeremy Evans <code@jeremyevans.net>2020-12-18 09:54:11 -0800
commit52fb696ee7d01b1d55a1d5c42c60c6a5ebfc4502 (patch)
tree86045676ae96f24768fdc841ca613ee314731c82 /include
parent7b06085c7bf8cc0db157e46fb11d16a6447d4d63 (diff)
Switch rb_category_warn{,ing} to accept an rb_warning_category_t
Since we decided to only allowing specific warning categories, there is no reason to have an API that accepts a general string, as it is more error-prone. Switch to only allowing the specific warning categories. As rb_category_warn{,ing} are public API, this requires making rb_warning_category_t public API as well.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3917
Diffstat (limited to 'include')
-rw-r--r--include/ruby/internal/error.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/ruby/internal/error.h b/include/ruby/internal/error.h
index dc842cc6f6..72ee622770 100644
--- a/include/ruby/internal/error.h
+++ b/include/ruby/internal/error.h
@@ -29,6 +29,13 @@ RBIMPL_SYMBOL_EXPORT_BEGIN()
VALUE rb_errinfo(void);
void rb_set_errinfo(VALUE);
+typedef enum {
+ RB_WARN_CATEGORY_NONE,
+ RB_WARN_CATEGORY_DEPRECATED,
+ RB_WARN_CATEGORY_EXPERIMENTAL,
+ RB_WARN_CATEGORY_ALL_BITS = 0x6 /* no RB_WARN_CATEGORY_NONE bit */
+} rb_warning_category_t;
+
/* for rb_readwrite_sys_fail first argument */
enum rb_io_wait_readwrite {RB_IO_WAIT_READABLE, RB_IO_WAIT_WRITABLE};
#define RB_IO_WAIT_READABLE RB_IO_WAIT_READABLE
@@ -63,12 +70,12 @@ VALUE *rb_ruby_debug_ptr(void);
/* reports if `-W' specified */
PRINTF_ARGS(void rb_warning(const char*, ...), 1, 2);
-PRINTF_ARGS(void rb_category_warning(const char*, const char*, ...), 2, 3);
+PRINTF_ARGS(void rb_category_warning(rb_warning_category_t category, const char*, ...), 2, 3);
PRINTF_ARGS(void rb_compile_warning(const char *, int, const char*, ...), 3, 4);
PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
/* reports always */
COLDFUNC PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
-COLDFUNC PRINTF_ARGS(void rb_category_warn(const char *, const char*, ...), 2, 3);
+COLDFUNC PRINTF_ARGS(void rb_category_warn(rb_warning_category_t category, const char*, ...), 2, 3);
PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
RBIMPL_SYMBOL_EXPORT_END()