diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2025-08-12 19:01:59 -0400 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2025-08-14 15:38:52 -0400 |
| commit | b080fcd3cd14aa79e8f116962e5fa6826e9b5026 (patch) | |
| tree | ea7ce25cf33ec8b97a97ccf7c938e4ef97bd4a51 /version.c | |
| parent | fdb831fdfcbf1b6653a20f6e8ea7d8caa58ec4b8 (diff) | |
ZJIT: Fix assert failure on JIT combo build
Previously, when `./configure --enable-yjit=dev --enable-zjit` JIT_DESCRIPTION was
defined to be "ZJIT", but when running with `--yjit`, ruby_set_yjit_description()
calls `define_ruby_description("+YJIT dev")`, which is longer than the
following assertion expects:
RUBY_ASSERT(n <= ruby_description_opt_point + (int)rb_strlen_lit(JIT_DESCRIPTION));
Use the concatenation of the two strings -- the contents of the string
is never used. Minimize the scope of the macro, too.
Diffstat (limited to 'version.c')
| -rw-r--r-- | version.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -72,11 +72,6 @@ const int ruby_api_version[] = { #else #define ZJIT_DESCRIPTION " +ZJIT" #endif -#if USE_ZJIT -#define JIT_DESCRIPTION ZJIT_DESCRIPTION -#else -#define JIT_DESCRIPTION YJIT_DESCRIPTION -#endif #if USE_MODULAR_GC #define GC_DESCRIPTION " +GC" #else @@ -207,6 +202,8 @@ rb_ruby_default_parser_set(ruby_default_parser_enum parser) static void define_ruby_description(const char *const jit_opt) { +#define JIT_DESCRIPTION YJIT_DESCRIPTION ZJIT_DESCRIPTION + static char desc[ sizeof(ruby_description) + rb_strlen_lit(JIT_DESCRIPTION) @@ -248,6 +245,7 @@ define_ruby_description(const char *const jit_opt) * The full ruby version string, like <tt>ruby -v</tt> prints */ rb_define_const(mRuby, "DESCRIPTION", /* MKSTR(description) */ description); +#undef JIT_DESCRIPTION } void |
