diff options
author | 2018-05-11 11:05:24 -0700 | |
---|---|---|
committer | 2018-05-11 11:05:24 -0700 | |
commit | 57ed906b4f702832950c0eff0818db8bf308274b (patch) | |
tree | ab5f1a01d35182cf651da22e62fa0a1c1442c00c /src/core/lib/iomgr/timer_generic.cc | |
parent | 6d5c2c250d4f96af7cc413ce245dc131a9cf4cf9 (diff) |
Fix static_cast errors
Diffstat (limited to 'src/core/lib/iomgr/timer_generic.cc')
-rw-r--r-- | src/core/lib/iomgr/timer_generic.cc | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc index 2bbc9d8874..e581e11358 100644 --- a/src/core/lib/iomgr/timer_generic.cc +++ b/src/core/lib/iomgr/timer_generic.cc @@ -429,8 +429,12 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline, note_deadline_change(shard); if (shard->shard_queue_index == 0 && deadline < old_min_deadline) { #if GPR_ARCH_64 - gpr_atm_no_barrier_store( - static_cast<gpr_atm*>(&g_shared_mutables.min_timer), deadline); + // TODO: sreek - Using c-style cast here. static_cast<> gives an error + // (on mac platforms complaining that gpr_atm* is (long *) while + // (&g_shared_mutables.min_timer) is a (long long *). The cast should be + // safe since we know that both are pointer types and 64-bit wide. + gpr_atm_no_barrier_store((gpr_atm*)(&g_shared_mutables.min_timer), + deadline); #else // On 32-bit systems, gpr_atm_no_barrier_store does not work on 64-bit // types (like grpc_millis). So all reads and writes to @@ -578,8 +582,12 @@ static grpc_timer_check_result run_some_expired_timers(grpc_millis now, grpc_timer_check_result result = GRPC_TIMERS_NOT_CHECKED; #if GPR_ARCH_64 - grpc_millis min_timer = static_cast<grpc_millis>(gpr_atm_no_barrier_load( - static_cast<gpr_atm*>(&g_shared_mutables.min_timer))); + // TODO: sreek - Using c-style cast here. static_cast<> gives an error (on + // mac platforms complaining that gpr_atm* is (long *) while + // (&g_shared_mutables.min_timer) is a (long long *). The cast should be + // safe since we know that both are pointer types and 64-bit wide + grpc_millis min_timer = static_cast<grpc_millis>( + gpr_atm_no_barrier_load((gpr_atm*)(&g_shared_mutables.min_timer))); gpr_tls_set(&g_last_seen_min_timer, min_timer); #else // On 32-bit systems, gpr_atm_no_barrier_load does not work on 64-bit types @@ -639,9 +647,12 @@ static grpc_timer_check_result run_some_expired_timers(grpc_millis now, } #if GPR_ARCH_64 - gpr_atm_no_barrier_store( - static_cast<gpr_atm*>(&g_shared_mutables.min_timer), - g_shard_queue[0]->min_deadline); + // TODO: sreek - Using c-style cast here. static_cast<> gives an error (on + // mac platforms complaining that gpr_atm* is (long *) while + // (&g_shared_mutables.min_timer) is a (long long *). The cast should be + // safe since we know that both are pointer types and 64-bit wide + gpr_atm_no_barrier_store((gpr_atm*)(&g_shared_mutables.min_timer), + g_shard_queue[0]->min_deadline); #else // On 32-bit systems, gpr_atm_no_barrier_store does not work on 64-bit // types (like grpc_millis). So all reads and writes to @@ -705,8 +716,7 @@ static grpc_timer_check_result timer_check(grpc_millis* next) { "TIMER CHECK BEGIN: now=%" PRId64 " next=%s tls_min=%" PRId64 " glob_min=%" PRId64, now, next_str, min_timer, - gpr_atm_no_barrier_load( - static_cast<gpr_atm*>(&g_shared_mutables.min_timer))); + gpr_atm_no_barrier_load((gpr_atm*)(&g_shared_mutables.min_timer))); #else gpr_log(GPR_INFO, "TIMER CHECK BEGIN: now=%" PRId64 " next=%s min=%" PRId64, now, next_str, min_timer); |