Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Useless std::move.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 18 Nov 2020 22:51:02 +0000 (23:51 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 18 Nov 2020 22:51:02 +0000 (23:51 +0100)
13 files changed:
include/simgrid/s4u/Engine.hpp
src/instr/jedule/jedule_sd_binding.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/routing/DragonflyZone.cpp
src/mc/remote/RemoteSimulation.cpp
src/mc/sosp/Snapshot.cpp
src/mc/sosp/Snapshot_test.cpp
src/s4u/s4u_Actor.cpp
src/s4u/s4u_Engine.cpp
src/surf/HostImpl.cpp
src/surf/sg_platf.cpp
src/surf/xml/surfxml_sax_cb.cpp
teshsuite/s4u/cloud-sharing/cloud-sharing.cpp

index 141cd5d..6a19ccd 100644 (file)
@@ -68,14 +68,14 @@ public:
         code();
       });
     };
-    register_function(name, std::move(code_factory));
+    register_function(name, code_factory);
   }
   template <class F> void register_actor(const std::string& name, F code)
   {
     kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
       return kernel::actor::ActorCode([code, args] { code(std::move(args)); });
     };
-    register_function(name, std::move(code_factory));
+    register_function(name, code_factory);
   }
 
   void load_deployment(const std::string& deploy) const;
index 4ca1e45..3d8e887 100644 (file)
@@ -22,7 +22,7 @@ void jedule_log_sd_event(const_SD_task_t task)
   simgrid::jedule::Event event(std::string(SD_task_get_name(task)), SD_task_get_start_time(task),
                                SD_task_get_finish_time(task), "SD");
   event.add_resources(*task->allocation);
-  my_jedule->add_event(std::move(event));
+  my_jedule->add_event(event);
 }
 
 void jedule_sd_init()
index e631755..fa893bd 100644 (file)
@@ -350,8 +350,7 @@ s4u::Actor* ActorImpl::restart()
   context::Context::self()->get_actor()->kill(this);
 
   // start the new actor
-  ActorImplPtr actor =
-      ActorImpl::create(arg.name, std::move(arg.code), arg.data, arg.host, arg.properties.get(), nullptr);
+  ActorImplPtr actor = ActorImpl::create(arg.name, arg.code, arg.data, arg.host, arg.properties.get(), nullptr);
   *actor->on_exit = std::move(*arg.on_exit);
   actor->set_kill_time(arg.kill_time);
   actor->set_auto_restart(arg.auto_restart);
index b6f9584..e310310 100644 (file)
@@ -152,7 +152,7 @@ void DragonflyZone::generate_link(const std::string& id, int numlinks, resource:
   linkTemplate.bandwidths.push_back(this->bw_ * numlinks);
   linkTemplate.latency   = this->lat_;
   linkTemplate.policy    = this->sharing_policy_;
-  linkTemplate.id        = std::move(id);
+  linkTemplate.id        = id;
   sg_platf_new_link(&linkTemplate);
   XBT_DEBUG("Generating link %s", linkTemplate.id.c_str());
   resource::LinkImpl* link;
index 294d641..ceb818d 100644 (file)
@@ -535,7 +535,7 @@ void RemoteSimulation::ignore_region(std::uint64_t addr, std::size_t size)
 void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region)
 {
   if (ignored_heap_.empty()) {
-    ignored_heap_.push_back(std::move(region));
+    ignored_heap_.push_back(region);
     return;
   }
 
index 5393c8f..86c806c 100644 (file)
@@ -229,7 +229,7 @@ void Snapshot::add_region(RegionType type, ObjectInformation* object_info, void*
 
   auto* region = new Region(type, start_addr, size);
   region->object_info(object_info);
-  snapshot_regions_.push_back(std::unique_ptr<Region>(std::move(region)));
+  snapshot_regions_.push_back(std::unique_ptr<Region>(region));
 }
 
 void* Snapshot::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, ReadOptions options) const
index 633c89a..f253bff 100644 (file)
@@ -82,11 +82,7 @@ snap_test_helper::prologue_return snap_test_helper::prologue(int n)
   INFO("Could not allocate destination memory");
   REQUIRE(source != MAP_FAILED);
 
-  return {.size    = byte_size,
-          .src     = source,
-          .dstn    = destination,
-          .region0 = std::move(region0),
-          .region  = std::move(region)};
+  return {.size = byte_size, .src = source, .dstn = destination, .region0 = region0, .region = region};
 }
 
 void snap_test_helper::read_whole_region()
index 5588ce9..1fd96f9 100644 (file)
@@ -499,13 +499,13 @@ void sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, const char
   simgrid::kernel::actor::ActorCode function;
   if (code)
     function = simgrid::xbt::wrap_main(code, argc, argv);
-  actor->start(std::move(function));
+  actor->start(function);
 }
 
 sg_actor_t sg_actor_create(const char* name, sg_host_t host, xbt_main_func_t code, int argc, const char* const* argv)
 {
   simgrid::kernel::actor::ActorCode function = simgrid::xbt::wrap_main(code, argc, argv);
-  return simgrid::s4u::Actor::init(name, host)->start(std::move(function)).get();
+  return simgrid::s4u::Actor::init(name, host)->start(function).get();
 }
 
 void sg_actor_set_stacksize(sg_actor_t actor, unsigned size)
index 7737a2b..10502f9 100644 (file)
@@ -96,7 +96,7 @@ void Engine::register_function(const std::string& name, int (*code)(int, char**)
   kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
     return xbt::wrap_main(code, std::move(args));
   };
-  register_function(name, std::move(code_factory));
+  register_function(name, code_factory);
 }
 void Engine::register_default(int (*code)(int, char**)) // XBT_ATTRIB_DEPRECATED_v329
 {
@@ -109,7 +109,7 @@ void Engine::register_function(const std::string& name, const std::function<void
   kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
     return xbt::wrap_main(code, std::move(args));
   };
-  register_function(name, std::move(code_factory));
+  register_function(name, code_factory);
 }
 
 /** Registers the main function of an actor that will be launched from the deployment file */
@@ -118,7 +118,7 @@ void Engine::register_function(const std::string& name, const std::function<void
   kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
     return std::bind(std::move(code), std::move(args));
   };
-  register_function(name, std::move(code_factory));
+  register_function(name, code_factory);
 }
 /** Registers a function as the default main function of actors
  *
index 20a0394..2f23588 100644 (file)
@@ -113,7 +113,7 @@ std::vector<s4u::Disk*> HostImpl::get_disks() const
 
 void HostImpl::set_disks(const std::vector<kernel::resource::DiskImpl*>& disks, s4u::Host* host)
 {
-  disks_ = std::move(disks);
+  disks_ = disks;
   for (auto d : disks_)
     d->set_host(host);
 }
index 9095e59..fbded08 100644 (file)
@@ -467,7 +467,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
     XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->get_cname(), start_time);
     simgrid::simix::Timer::set(start_time, [arg, auto_restart]() {
       simgrid::kernel::actor::ActorImplPtr new_actor = simgrid::kernel::actor::ActorImpl::create(
-          arg->name.c_str(), std::move(arg->code), arg->data, arg->host, arg->properties.get(), nullptr);
+          arg->name.c_str(), arg->code, arg->data, arg->host, arg->properties.get(), nullptr);
       if (arg->kill_time >= 0)
         new_actor->set_kill_time(arg->kill_time);
       if (auto_restart)
index c486699..2fcff2f 100644 (file)
@@ -73,7 +73,7 @@ void surf_parse_assert_netpoint(const std::string& hostname, const std::string&
       break;
     }
   }
-  surf_parse_error(std::move(msg));
+  surf_parse_error(msg);
 }
 
 double surf_parse_get_double(const std::string& s)
@@ -786,7 +786,7 @@ void ETag_surfxml_config()
   for (std::string key : keys) {
     if (simgrid::config::is_default(key.c_str())) {
       std::string cfg = key + ":" + current_property_set->at(key);
-      simgrid::config::set_parse(std::move(cfg));
+      simgrid::config::set_parse(cfg);
     } else
       XBT_INFO("The custom configuration '%s' is already defined by user!", key.c_str());
   }
index 853b08d..5d86a64 100644 (file)
@@ -42,7 +42,7 @@ static int computation_fun(std::vector<std::string> argv)
 static void run_test_process(const std::string& name, simgrid::s4u::Host* location, int size)
 {
   std::vector<std::string> arg = {std::to_string(size)};
-  simgrid::s4u::Actor::create(std::move(name), location, computation_fun, arg);
+  simgrid::s4u::Actor::create(name, location, computation_fun, arg);
 }
 
 static void test_energy_consumption(const std::string& name, int nb_cores)