Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] fix a few recently introduced smells
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Thu, 30 Sep 2021 09:05:59 +0000 (11:05 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Thu, 30 Sep 2021 09:05:59 +0000 (11:05 +0200)
src/kernel/routing/VivaldiZone.cpp
src/plugins/dirty_page_tracking.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/VirtualMachineImpl.hpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_Engine.cpp

index 0c3ea7c..27a9be2 100644 (file)
@@ -73,7 +73,7 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out)
 void VivaldiZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* lat)
 {
   XBT_DEBUG("vivaldi getLocalRoute from '%s'[%lu] '%s'[%lu]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
-  auto* engine = s4u::Engine::get_instance();
+  const auto* engine = s4u::Engine::get_instance();
   if (src->is_netzone()) {
     std::string srcName = "router_" + src->get_name();
     std::string dstName = "router_" + dst->get_name();
index 6b643cf..9b469dc 100644 (file)
@@ -67,7 +67,7 @@ double DirtyPageTrackingExt::computed_flops_lookup()
 } // namespace vm
 } // namespace simgrid
 
-static void on_virtual_machine_creation(simgrid::s4u::VirtualMachine& vm)
+static void on_virtual_machine_creation(const simgrid::s4u::VirtualMachine& vm)
 {
   vm.get_vm_impl()->extension_set<simgrid::vm::DirtyPageTrackingExt>(new simgrid::vm::DirtyPageTrackingExt());
 }
index 6fe26b7..3799bc5 100644 (file)
@@ -189,7 +189,7 @@ VirtualMachineImpl::VirtualMachineImpl(const std::string& name, s4u::VirtualMach
 }
 
 /** @brief A physical host does not disappear in the current SimGrid code, but a VM may disappear during a simulation */
-void VirtualMachineImpl::destroy()
+void VirtualMachineImpl::vm_destroy()
 {
   s4u::VirtualMachine::on_destruction(*piface_);
   /* I was already removed from the allVms set if the VM was destroyed cleanly */
index c775761..7015fc6 100644 (file)
@@ -41,7 +41,7 @@ public:
   void suspend(kernel::actor::ActorImpl* issuer);
   void resume();
   void shutdown(kernel::actor::ActorImpl* issuer);
-  void destroy();
+  void vm_destroy();
 
   /** @brief Change the physical host on which the given VM is running */
   void set_physical_host(s4u::Host* dest);
index ce07172..d1e2a9a 100644 (file)
@@ -122,7 +122,7 @@ void VirtualMachine::destroy()
 
     /* Then, destroy the VM object */
     kernel::actor::simcall([this]() {
-      get_vm_impl()->destroy();
+      get_vm_impl()->vm_destroy();
       get_impl()->destroy();
 
       /* Don't free these things twice: they are the ones of my physical host */
@@ -133,7 +133,7 @@ void VirtualMachine::destroy()
 
   if (not this_actor::is_maestro() && this_actor::get_host() == this) {
     XBT_VERB("Launch another actor on physical host %s to destroy my own VM: %s", get_pm()->get_cname(), get_cname());
-    simgrid::s4u::Actor::create(get_cname() + std::string("-destroy"), get_pm(), destroy_code);
+    simgrid::s4u::Actor::create(get_cname() + std::string("-vm_destroy"), get_pm(), destroy_code);
     simgrid::s4u::this_actor::yield();
     XBT_CRITICAL("I should be dead now!");
     DIE_IMPOSSIBLE;
index 7f74eef..ecf8e96 100644 (file)
@@ -66,7 +66,7 @@ Engine::Engine(int* argc, char** argv) : pimpl(new kernel::EngineImpl())
 
 Engine::~Engine()
 {
-  pimpl->shutdown();
+  kernel::EngineImpl::shutdown();
   Engine::instance_ = nullptr;
 }