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

ruby-changes:62178

From: Nobuyoshi <ko1@a...>
Date: Fri, 10 Jul 2020 13:42:09 +0900 (JST)
Subject: [ruby-changes:62178] 4989987419 (master): Explicit conversion to boolean to suppress shorten-64-to-32 warnings

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

From 4989987419c42b04fbf3b0634ddaeace49108689 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 10 Jul 2020 13:02:31 +0900
Subject: Explicit conversion to boolean to suppress shorten-64-to-32 warnings


diff --git a/debug_counter.h b/debug_counter.h
index f6223fb..5935087 100644
--- a/debug_counter.h
+++ b/debug_counter.h
@@ -398,14 +398,14 @@ VALUE rb_debug_counter_show(VALUE klass); https://github.com/ruby/ruby/blob/trunk/debug_counter.h#L398
 
 #define RB_DEBUG_COUNTER_INC(type)                rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, 1)
 #define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (!rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, !(cond)))
-#define RB_DEBUG_COUNTER_INC_IF(type, cond)       rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, (cond))
+#define RB_DEBUG_COUNTER_INC_IF(type, cond)       rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, !!(cond))
 #define RB_DEBUG_COUNTER_ADD(type, num)           rb_debug_counter_add(RB_DEBUG_COUNTER_##type, (num), 1)
 #define RB_DEBUG_COUNTER_SETMAX(type, num)        rb_debug_counter_max(RB_DEBUG_COUNTER_##type, (unsigned int)(num))
 
 #else
 #define RB_DEBUG_COUNTER_INC(type)              ((void)0)
-#define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (cond)
-#define RB_DEBUG_COUNTER_INC_IF(type, cond)     (cond)
+#define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (!!(cond))
+#define RB_DEBUG_COUNTER_INC_IF(type, cond)     (!!(cond))
 #define RB_DEBUG_COUNTER_ADD(type, num)         ((void)0)
 #define RB_DEBUG_COUNTER_SETMAX(type, num)      0
 #endif
-- 
cgit v0.10.2


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

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