Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Please sonar
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 5 Jan 2019 02:29:33 +0000 (03:29 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 5 Jan 2019 05:01:13 +0000 (06:01 +0100)
- Add 'explicit' where needed
- Don't specify the return type of lambdas
- Verify that this != that before everything in the operator=
- Remove ';' in the comments to not fool the commented code detection mechanism

examples/msg/maestro-set/maestro-set.cpp
examples/s4u/actor-create/s4u-actor-create.cpp
include/simgrid/simdag.h
include/simgrid/simix/blocking_simcall.hpp
include/xbt/string.hpp
src/mc/sosp/ChunkedData.hpp
src/xbt/OsSemaphore.hpp

index 3dd472d..a9c7fd7 100644 (file)
 
 #include "simgrid/msg.h"
 
 
 #include "simgrid/msg.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-
 #include <thread>
 
 #include <thread>
 
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+
 std::thread::id root_id;
 
 static void ensure_root_tid() {
 std::thread::id root_id;
 
 static void ensure_root_tid() {
index ff7cf6d..123464f 100644 (file)
@@ -8,7 +8,7 @@
  * The first step is to declare the code of your actors (what they do exactly does not matter to this example) and then
  * you ask SimGrid to start your actors. There is three ways of doing so:
  *  - Directly, by instantiating your actor as parameter to Actor::create()
  * The first step is to declare the code of your actors (what they do exactly does not matter to this example) and then
  * you ask SimGrid to start your actors. There is three ways of doing so:
  *  - Directly, by instantiating your actor as parameter to Actor::create()
- *  - By first registering your actors before instantiating it;
+ *  - By first registering your actors before instantiating it
  *  - Through the deployment file.
  *
  * This example shows all these solutions, even if you obviously should use only one of these solutions to start your
  *  - Through the deployment file.
  *
  * This example shows all these solutions, even if you obviously should use only one of these solutions to start your
index ebf6810..f689d0d 100644 (file)
@@ -115,7 +115,7 @@ XBT_PUBLIC void SD_task_schedulel(SD_task_t task, int count, ...);
  *
  *  For example, create a pure computation task (i.e., with no communication) like this:
  *
  *
  *  For example, create a pure computation task (i.e., with no communication) like this:
  *
- *  SD_task_schedule(task, my_host_count, my_host_list, my_flops_amount, SD_SCHED_NO_COST, my_rate);
+ *  SD_task_schedule(task, my_host_count, my_host_list, my_flops_amount, SD_SCHED_NO_COST, my_rate)
  */
 #define SD_SCHED_NO_COST NULL
 
  */
 #define SD_SCHED_NO_COST NULL
 
index d2c87da..d99984a 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2016-2018. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2016-2018. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -33,7 +32,7 @@ XBT_PUBLIC void unblock(smx_actor_t process);
  * returns a `simgrid::kernel::Future<T>`. The kernel blocks the actor
  * until the Future is ready and:
  *
  * returns a `simgrid::kernel::Future<T>`. The kernel blocks the actor
  * until the Future is ready and:
  *
- *  - either returns the value wrapped in the future to the actor;
+ *  - either returns the value wrapped in the future to the actor
  *
  *  - or raises the exception stored in the future in the actor.
  *
  *
  *  - or raises the exception stored in the future in the actor.
  *
index cd51303..5a393ec 100644 (file)
@@ -121,7 +121,8 @@ public:
   }
   string& operator=(string const& s)
   {
   }
   string& operator=(string const& s)
   {
-    assign(s.c_str(), s.size());
+    if (this != &s)
+      assign(s.c_str(), s.size());
     return *this;
   }
   string& operator=(std::string const& s)
     return *this;
   }
   string& operator=(std::string const& s)
index c904a29..2cad04e 100644 (file)
@@ -56,11 +56,13 @@ public:
   }
   ChunkedData& operator=(ChunkedData const& that)
   {
   }
   ChunkedData& operator=(ChunkedData const& that)
   {
-    this->clear();
-    store_   = that.store_;
-    pagenos_ = that.pagenos_;
-    for (std::size_t const& pageno : pagenos_)
-      store_->ref_page(pageno);
+    if (this != &that) {
+      this->clear();
+      store_   = that.store_;
+      pagenos_ = that.pagenos_;
+      for (std::size_t const& pageno : pagenos_)
+        store_->ref_page(pageno);
+    }
     return *this;
   }
   ChunkedData& operator=(ChunkedData&& that)
     return *this;
   }
   ChunkedData& operator=(ChunkedData&& that)
index 6459850..f6e7083 100644 (file)
@@ -10,12 +10,12 @@ namespace simgrid {
 namespace xbt {
 class XBT_PUBLIC OsSemaphore {
 public:
 namespace xbt {
 class XBT_PUBLIC OsSemaphore {
 public:
-  inline OsSemaphore(unsigned int uiCount) : capa_(uiCount) {}
+  explicit inline OsSemaphore(unsigned int capa) : capa_(capa) {}
 
   inline void acquire()
   {
     std::unique_lock<std::mutex> lock(mutex_);
 
   inline void acquire()
   {
     std::unique_lock<std::mutex> lock(mutex_);
-    condition_.wait(lock, [&]() -> bool { return capa_ > 0; });
+    condition_.wait(lock, [this]() { return capa_ > 0; });
     --capa_;
   }
 
     --capa_;
   }