From 6973539005611084a95222bca9a0a5045f7514ad Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Mon, 2 Dec 2019 19:08:54 +0900 Subject: Silence Clang warning with `MRB_INT32` and `MRB_64BIT` in `time.c` Silence the following warning: ``` /mruby/mrbgems/mruby-time/src/time.c:258:60: warning: result of comparison of constant -9223372036854775808 with expression of type 'mrb_int' (aka 'int') is always false [-Wtautological-constant-out-of-range-compare] if ((mrb_time_int)i > MRB_TIME_MAX || MRB_TIME_MIN > i) { ~~~~~~~~~~~~ ^ ~ ``` --- mrbgems/mruby-time/src/time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index caa8a01b5..7024cc36a 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -254,7 +254,8 @@ mrb_to_time_t(mrb_state *mrb, mrb_value obj, time_t *usec) { mrb_int i = mrb_int(mrb, obj); - if ((mrb_time_int)i > MRB_TIME_MAX || MRB_TIME_MIN > i) { + if ((MRB_INT_MAX > MRB_TIME_MAX && (mrb_time_int)i > MRB_TIME_MAX) || + (MRB_TIME_MIN > MRB_INT_MIN && MRB_TIME_MIN > i)) { goto out_of_range; } -- cgit v1.2.3