ruby-changes:59510
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 27 Dec 2019 06:13:35 +0900 (JST)
Subject: [ruby-changes:59510] 33e9601938 (master): TIMESPEC_SEC_MAX might be bigger than 53 bits.
https://git.ruby-lang.org/ruby.git/commit/?id=33e9601938 From 33e9601938a79dae149caa88ff1bc06d376dd376 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, 3 Dec 2019 11:02:10 +0900 Subject: TIMESPEC_SEC_MAX might be bigger than 53 bits. The same as 41bc766763dba63ae2529f2f9070b8e26399745c. Read that commit for what is happening. diff --git a/thread.c b/thread.c index 39114db..da36b62 100644 --- a/thread.c +++ b/thread.c @@ -1192,11 +1192,21 @@ thread_value(VALUE self) https://github.com/ruby/ruby/blob/trunk/thread.c#L1192 #define TIMESPEC_SEC_MAX TIMET_MAX #define TIMESPEC_SEC_MIN TIMET_MIN +COMPILER_WARNING_PUSH +#if __has_warning("-Wimplicit-int-float-conversion") +COMPILER_WARNING_IGNORED(-Wimplicit-int-float-conversion) +#elif defined(_MSC_VER) +/* C4305: 'initializing': truncation from '__int64' to 'const double' */ +COMPILER_WARNING_IGNORED(4305) +#endif +static const double TIMESPEC_SEC_MAX_as_doube = TIMESPEC_SEC_MAX; +COMPILER_WARNING_POP + static rb_hrtime_t * double2hrtime(rb_hrtime_t *hrt, double d) { /* assume timespec.tv_sec has same signedness as time_t */ - const double TIMESPEC_SEC_MAX_PLUS_ONE = 2.0 * (TIMESPEC_SEC_MAX / 2 + 1.0); + const double TIMESPEC_SEC_MAX_PLUS_ONE = 2.0 * (TIMESPEC_SEC_MAX_as_doube / 2.0 + 1.0); if (TIMESPEC_SEC_MAX_PLUS_ONE <= d) { return NULL; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/