[前][次][番号順一覧][スレッド一覧]

ruby-changes:63704

From: Nobuyoshi <ko1@a...>
Date: Mon, 23 Nov 2020 18:32:46 +0900 (JST)
Subject: [ruby-changes:63704] abb672e14f (master): Suppress a format-overflow warning

https://git.ruby-lang.org/ruby.git/commit/?id=abb672e14f

From abb672e14f643063de65f6b3dcaa1b23fcaf40e4 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 23 Nov 2020 18:31:51 +0900
Subject: Suppress a format-overflow warning


diff --git a/mjit_worker.c b/mjit_worker.c
index 2271bbe..a1b565d 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -937,8 +937,11 @@ compile_compact_jit_code(char* c_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L937
         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);
     }
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]