From: Martin Quinson Date: Sun, 1 Sep 2019 00:33:24 +0000 (+0200) Subject: another batch of small improvements advised by clang-tidy X-Git-Tag: v3.24~118 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3880093b08b4663a22f6ea9c35e7dfa7248a5491 another batch of small improvements advised by clang-tidy --- diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index d38f868815..e598461f5f 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -27,8 +27,7 @@ static inline double has_cost(const double* array, size_t pos) { if (array) return array[pos]; - else - return -1.0; + return -1.0; } kernel::resource::Action* HostModel::execute_parallel(const std::vector& host_list, @@ -104,7 +103,7 @@ void HostImpl::turn_on() for (auto const& arg : actors_at_boot_) { XBT_DEBUG("Booting Actor %s(%s) right now", arg->name.c_str(), arg->host->get_cname()); simgrid::kernel::actor::ActorImplPtr actor = simgrid::kernel::actor::ActorImpl::create( - arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties.get(), nullptr); + arg->name, arg->code, nullptr, arg->host, arg->properties.get(), nullptr); if (arg->on_exit) *actor->on_exit = *arg->on_exit; if (arg->kill_time >= 0) @@ -157,5 +156,5 @@ std::vector HostImpl::get_attached_storages() return storages; } -} -} +} // namespace surf +} // namespace simgrid diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index d11dd874c0..e9474159c1 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -108,7 +108,7 @@ void CpuCas01::on_speed_change() get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), get_core_count() * speed_.scale * speed_.peak); while ((var = get_constraint()->get_variable(&elem))) { - CpuCas01Action* action = static_cast(var->get_id()); + auto* action = static_cast(var->get_id()); get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), action->requested_core() * speed_.scale * speed_.peak); @@ -145,7 +145,7 @@ void CpuCas01::apply_event(profile::Event* event, double value) get_host()->turn_off(); while ((var = cnst->get_variable(&elem))) { - Action* action = static_cast(var->get_id()); + auto* action = static_cast(var->get_id()); if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED || action->get_state() == Action::State::IGNORED) { @@ -179,8 +179,7 @@ CpuAction* CpuCas01::sleep(double duration) duration = std::max(duration, sg_surf_precision); XBT_IN("(%s,%g)", get_cname(), duration); - CpuCas01Action* action = - new CpuCas01Action(get_model(), 1.0, not is_on(), speed_.scale * speed_.peak, get_constraint()); + auto* action = new CpuCas01Action(get_model(), 1.0, not is_on(), speed_.scale * speed_.peak, get_constraint()); // FIXME: sleep variables should not consume 1.0 in System::expand() action->set_max_duration(duration); diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 768299562f..606961a9e4 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -26,7 +26,7 @@ void CpuModel::update_actions_state_lazy(double now, double /*delta*/) { while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) { - CpuAction* action = static_cast(get_action_heap().pop()); + auto* action = static_cast(get_action_heap().pop()); XBT_CDEBUG(surf_kernel, "Something happened to action %p", action); action->finish(kernel::resource::Action::State::FINISHED); @@ -37,7 +37,7 @@ void CpuModel::update_actions_state_lazy(double now, double /*delta*/) void CpuModel::update_actions_state_full(double /*now*/, double delta) { for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) { - CpuAction& action = static_cast(*it); + auto& action = static_cast(*it); ++it; // increment iterator here since the following calls to action.finish() may invalidate it action.update_remains(action.get_variable()->get_value() * delta); diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 73f35fdbf1..765354bbf2 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -314,7 +314,7 @@ double CpuTiModel::next_occuring_event(double now) void CpuTiModel::update_actions_state(double now, double /*delta*/) { while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) { - CpuTiAction* action = static_cast(get_action_heap().pop()); + auto* action = static_cast(get_action_heap().pop()); XBT_DEBUG("Action %p: finish", action); action->finish(kernel::resource::Action::State::FINISHED); /* update remaining amount of all actions */ @@ -350,8 +350,8 @@ void CpuTi::set_speed_profile(kernel::profile::Profile* profile) if (profile && profile->event_list.size() > 1) { kernel::profile::DatedValue val = profile->event_list.back(); if (val.date_ < 1e-12) { - simgrid::kernel::profile::Profile* prof = new simgrid::kernel::profile::Profile(); - speed_.event = prof->schedule(&profile::future_evt_set, this); + auto* prof = new simgrid::kernel::profile::Profile(); + speed_.event = prof->schedule(&profile::future_evt_set, this); } } } @@ -512,7 +512,7 @@ void CpuTi::update_remaining_amount(double now) kernel::resource::CpuAction* CpuTi::execution_start(double size) { XBT_IN("(%s,%g)", get_cname(), size); - CpuTiAction* action = new CpuTiAction(this, size); + auto* action = new CpuTiAction(this, size); action_set_.push_back(*action); // Actually start the action @@ -526,7 +526,7 @@ kernel::resource::CpuAction* CpuTi::sleep(double duration) duration = std::max(duration, sg_surf_precision); XBT_IN("(%s,%g)", get_cname(), duration); - CpuTiAction* action = new CpuTiAction(this, 1.0); + auto* action = new CpuTiAction(this, 1.0); action->set_max_duration(duration); action->set_suspend_state(kernel::resource::Action::SuspendStates::SLEEPING);