aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_worker.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-23 18:31:51 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-23 18:31:51 +0900
commitabb672e14f643063de65f6b3dcaa1b23fcaf40e4 (patch)
tree1ea22d15e45f96f77761162e724d65145048250e /mjit_worker.c
parent2939c57ca7aa80df126332e04de8a33a56978b42 (diff)
downloadruby-abb672e14f643063de65f6b3dcaa1b23fcaf40e4.tar.gz
Suppress a format-overflow warning
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index 2271bbe46d..a1b565da73 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -937,8 +937,11 @@ compile_compact_jit_code(char* c_file)
if (FIXNUM_P(child_unit->iseq->body->location.first_lineno))
// FIX2INT may fallback to rb_num2long(), which is a method call and dangerous in MJIT worker. So using only FIX2LONG.
iseq_lineno = FIX2LONG(child_unit->iseq->body->location.first_lineno);
- fprintf(f, "\n/* %s@%s:%ld */\n", RSTRING_PTR(child_unit->iseq->body->location.label),
- RSTRING_PTR(rb_iseq_path(child_unit->iseq)), iseq_lineno);
+ const char *sep = "@";
+ const char *iseq_label = RSTRING_PTR(child_unit->iseq->body->location.label);
+ const char *iseq_path = RSTRING_PTR(rb_iseq_path(child_unit->iseq));
+ if (!iseq_label) iseq_label = sep = "";
+ fprintf(f, "\n/* %s%s%s:%ld */\n", iseq_label, sep, iseq_path, iseq_lineno);
success &= mjit_compile(f, child_unit->iseq, funcname, child_unit->id);
}