Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another batch of small improvements advised by clang-tidy
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 1 Sep 2019 00:33:24 +0000 (02:33 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 1 Sep 2019 00:35:14 +0000 (02:35 +0200)
src/surf/HostImpl.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp

index d38f868..e598461 100644 (file)
@@ -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<s4u::Host*>& 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<const char*> HostImpl::get_attached_storages()
   return storages;
 }
 
-}
-}
+} // namespace surf
+} // namespace simgrid
index d11dd87..e947415 100644 (file)
@@ -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<CpuCas01Action*>(var->get_id());
+    auto* action = static_cast<CpuCas01Action*>(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<Action*>(var->get_id());
+        auto* action = static_cast<Action*>(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);
index 7682995..606961a 100644 (file)
@@ -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<CpuAction*>(get_action_heap().pop());
+    auto* action = static_cast<CpuAction*>(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<CpuAction&>(*it);
+    auto& action = static_cast<CpuAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
 
     action.update_remains(action.get_variable()->get_value() * delta);
index 73f35fd..765354b 100644 (file)
@@ -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<CpuTiAction*>(get_action_heap().pop());
+    auto* action = static_cast<CpuTiAction*>(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);