summaryrefslogtreecommitdiff
path: root/version.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2023-10-17 09:51:53 +0900
committerKoichi Sasada <ko1@atdot.net>2023-10-17 17:43:52 +0900
commitc9990c8d0fdec0f79791ac3096ee6925fab0be7c (patch)
treef79a6bc857be964eaa3407146b776f4b545efd6a /version.c
parentaee1bfd88eca8fb9022138347b7c0390c0e6f545 (diff)
"+MN" in description
If `RUBY_MN_THREADS=1` is given, this patch shows `+MN` in `RUBY_DESCRIPTION` like: ``` $ RUBY_MN_THREADS=1 ./miniruby --yjit -v ruby 3.3.0dev (2023-10-17T04:10:14Z master 908f8fffa2) +YJIT +MN [x86_64-linux] ``` Before this patch, a warning is displayed if `$VERBOSE` is given. However it can make troubles with tests (with `$VERBOSE`), do not show any warning with a MN threads configuration.
Diffstat (limited to 'version.c')
-rw-r--r--version.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/version.c b/version.c
index e5d5bfa561..5f4db2a622 100644
--- a/version.c
+++ b/version.c
@@ -139,12 +139,15 @@ Init_version(void)
#define YJIT_OPTS_ON 0
#endif
+int ruby_mn_threads_enabled;
+
void
Init_ruby_description(ruby_cmdline_options_t *opt)
{
static char desc[
sizeof(ruby_description)
+ rb_strlen_lit(YJIT_DESCRIPTION)
+ + rb_strlen_lit(" +MN")
];
const char *const jit_opt =
@@ -152,9 +155,16 @@ Init_ruby_description(ruby_cmdline_options_t *opt)
YJIT_OPTS_ON ? YJIT_DESCRIPTION :
"";
- int n = snprintf(desc, sizeof(desc), "%.*s" /* jit_opt */"%s" "%s",
+ const char *const threads_opt = ruby_mn_threads_enabled ? " +MN" : "";
+
+ int n = snprintf(desc, sizeof(desc),
+ "%.*s"
+ "%s" // jit_opt
+ "%s" // threads_opts
+ "%s",
ruby_description_opt_point, ruby_description,
jit_opt,
+ threads_opt,
ruby_description + ruby_description_opt_point);
VALUE description = rb_obj_freeze(rb_usascii_str_new_static(desc, n));