From: Arnaud Giersch Date: Tue, 12 Sep 2017 20:01:16 +0000 (+0200) Subject: ContextBoost: use C++ style casts. X-Git-Tag: v3_17~136 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c78e638c00d9561c90fec054fdd5007d8fa587cb ContextBoost: use C++ style casts. --- diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index 3028445dd9..2b0bc634bb 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -129,7 +129,7 @@ void BoostContextFactory::run_all() static void smx_ctx_boost_wrapper(std::intptr_t arg) { - BoostContext* context = (BoostContext*)(arg); + BoostContext* context = reinterpret_cast(arg); (*context)(); context->stop(); } @@ -179,9 +179,9 @@ void BoostContext::resume() { SIMIX_context_set_current(this); #if HAVE_BOOST_CONTEXTS == 1 - boost::context::jump_fcontext(maestro_context_->fc_, this->fc_, (intptr_t) this); + boost::context::jump_fcontext(maestro_context_->fc_, this->fc_, reinterpret_cast(this)); #else - boost::context::jump_fcontext(&maestro_context_->fc_, this->fc_, (intptr_t) this); + boost::context::jump_fcontext(&maestro_context_->fc_, this->fc_, reinterpret_cast(this)); #endif } @@ -201,11 +201,11 @@ void BoostSerialContext::suspend() XBT_DEBUG("No more process to run"); next_context = static_cast(maestro_context_); } - SIMIX_context_set_current((smx_context_t) next_context); + SIMIX_context_set_current(static_cast(next_context)); #if HAVE_BOOST_CONTEXTS == 1 - boost::context::jump_fcontext(this->fc_, next_context->fc_, (intptr_t) next_context); + boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast(next_context)); #else - boost::context::jump_fcontext(&this->fc_, next_context->fc_, (intptr_t) next_context); + boost::context::jump_fcontext(&this->fc_, next_context->fc_, reinterpret_cast(next_context)); #endif } @@ -228,15 +228,15 @@ void BoostParallelContext::suspend() next_context = static_cast(next_work.get()->context); } else { XBT_DEBUG("No more processes to run"); - uintptr_t worker_id = (uintptr_t)xbt_os_thread_get_specific(worker_id_key_); + uintptr_t worker_id = reinterpret_cast(xbt_os_thread_get_specific(worker_id_key_)); next_context = static_cast(workers_context_[worker_id]); } - SIMIX_context_set_current(static_cast (next_context)); + SIMIX_context_set_current(static_cast(next_context)); #if HAVE_BOOST_CONTEXTS == 1 - boost::context::jump_fcontext(this->fc_, next_context->fc_, (intptr_t)(next_context)); + boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast(next_context)); #else - boost::context::jump_fcontext(&this->fc_, next_context->fc_, (intptr_t)(next_context)); + boost::context::jump_fcontext(&this->fc_, next_context->fc_, reinterpret_cast(next_context)); #endif } @@ -249,16 +249,16 @@ void BoostParallelContext::stop() void BoostParallelContext::resume() { uintptr_t worker_id = __sync_fetch_and_add(&threads_working_, 1); - xbt_os_thread_set_specific(worker_id_key_, (void*) worker_id); + xbt_os_thread_set_specific(worker_id_key_, reinterpret_cast(worker_id)); BoostParallelContext* worker_context = static_cast(SIMIX_context_self()); workers_context_[worker_id] = worker_context; SIMIX_context_set_current(this); #if HAVE_BOOST_CONTEXTS == 1 - boost::context::jump_fcontext(worker_context->fc_, this->fc_, (intptr_t) this); + boost::context::jump_fcontext(worker_context->fc_, this->fc_, reinterpret_cast(this)); #else - boost::context::jump_fcontext(&worker_context->fc_, this->fc_, (intptr_t) this); + boost::context::jump_fcontext(&worker_context->fc_, this->fc_, reinterpret_cast(this)); #endif }