summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2023-04-13 12:11:14 +0200
committerJean Boussier <jean.boussier@gmail.com>2023-04-13 16:36:17 +0200
commitac123f167a364c3d7a43eca78d564e41f6dbb91e (patch)
tree76c34bd65a5942ce9ef38e1753943e83082f08ee /ruby.c
parent854baee2c936006d7f38ebb27ee577c00afc6249 (diff)
downloadruby-ac123f167a364c3d7a43eca78d564e41f6dbb91e.tar.gz
Emit a performance warning when a class reached max variations
[Feature #19538] This new `peformance` warning category is disabled by default. It needs to be specifically enabled via `-W:performance` or `Warning[:performance] = true`
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ruby.c b/ruby.c
index b3a1c23712..5ce5fb2662 100644
--- a/ruby.c
+++ b/ruby.c
@@ -331,6 +331,7 @@ usage(const char *name, int help, int highlight, int columns)
static const struct ruby_opt_message warn_categories[] = {
M("deprecated", "", "deprecated features"),
M("experimental", "", "experimental features"),
+ M("performance", "", "performance issues"),
};
#if USE_YJIT
static const struct ruby_opt_message yjit_options[] = {
@@ -1190,6 +1191,9 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt)
else if (NAME_MATCH_P("experimental", s, len)) {
bits = 1U << RB_WARN_CATEGORY_EXPERIMENTAL;
}
+ else if (NAME_MATCH_P("performance", s, len)) {
+ bits = 1U << RB_WARN_CATEGORY_PERFORMANCE;
+ }
else {
rb_warn("unknown warning category: `%s'", s);
}