ruby-changes:60124
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Thu, 20 Feb 2020 11:49:24 +0900 (JST)
Subject: [ruby-changes:60124] 6788c375b1 (master): suppress clang warnings
https://git.ruby-lang.org/ruby.git/commit/?id=6788c375b1 From 6788c375b15232e684dbd4b993b508413f2c74a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 18 Feb 2020 12:39:30 +0900 Subject: suppress clang warnings Starting clang 11, casts between pointer and (narrower-than-pointer) int are now warned. However all such thing in our repository are guaranteed safe. Let's suppress the warnings. diff --git a/mjit.h b/mjit.h index 44cb657..bdc186f 100644 --- a/mjit.h +++ b/mjit.h @@ -125,13 +125,15 @@ mjit_exec(rb_execution_context_t *ec) https://github.com/ruby/ruby/blob/trunk/mjit.h#L125 total_calls = ++body->total_calls; func = body->jit_func; - if (UNLIKELY((uintptr_t)func <= (uintptr_t)LAST_JIT_ISEQ_FUNC)) { + uintptr_t func_i = (uintptr_t)func; + if (UNLIKELY(func_i <= LAST_JIT_ISEQ_FUNC)) { # ifdef MJIT_HEADER RB_DEBUG_COUNTER_INC(mjit_frame_JT2VM); # else RB_DEBUG_COUNTER_INC(mjit_frame_VM2VM); # endif - switch ((enum rb_mjit_iseq_func)func) { + ASSUME(func_i <= LAST_JIT_ISEQ_FUNC); + switch ((enum rb_mjit_iseq_func)func_i) { case NOT_ADDED_JIT_ISEQ_FUNC: RB_DEBUG_COUNTER_INC(mjit_exec_not_added); if (total_calls == mjit_opts.min_calls && mjit_target_iseq_p(body)) { diff --git a/vm_method.c b/vm_method.c index 9000966..7b29b2c 100644 --- a/vm_method.c +++ b/vm_method.c @@ -288,7 +288,7 @@ rb_method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *de https://github.com/ruby/ruby/blob/trunk/vm_method.c#L288 setup_method_cfunc_struct(UNALIGNED_MEMBER_PTR(def, body.cfunc), rb_f_notimplement, -1); return; case VM_METHOD_TYPE_OPTIMIZED: - def->body.optimize_type = (enum method_optimized_type)opts; + def->body.optimize_type = (enum method_optimized_type)(intptr_t)opts; return; case VM_METHOD_TYPE_REFINED: { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/