Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics to please codacy
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 23 May 2017 23:29:05 +0000 (01:29 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 23 May 2017 23:38:36 +0000 (01:38 +0200)
include/simgrid/kernel/future.hpp
src/instr/instr_paje_trace.cpp
src/simgrid/sg_config.cpp
src/simix/simcalls.py
src/smpi/smpi_group.cpp
src/smpi/smpi_group.hpp
tools/tesh/tesh.py

index 8f0c25d..581db40 100644 (file)
@@ -209,7 +209,7 @@ void bindPromise(Promise<T> promise, Future<T> future)
 {
   struct PromiseBinder {
   public:
-    PromiseBinder(Promise<T> promise) : promise_(std::move(promise)) {}
+    explicit PromiseBinder(Promise<T> promise) : promise_(std::move(promise)) {}
     void operator()(Future<T> future)
     {
       simgrid::xbt::setPromise(promise_, future);
@@ -282,7 +282,7 @@ template<class T>
 class Future {
 public:
   Future() = default;
-  Future(std::shared_ptr<FutureState<T>> state): state_(std::move(state)) {}
+  explicit Future(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
 
   // Move type:
   Future(Future&) = delete;
@@ -454,8 +454,8 @@ Future<T> unwrapFuture(Future<Future<T>> future)
 template<class T>
 class Promise {
 public:
-  Promise() : state_(std::make_shared<FutureState<T>>()) {}
-  Promise(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
+  explicit Promise() : state_(std::make_shared<FutureState<T>>()) {}
+  explicit Promise(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
 
   // Move type
   Promise(Promise const&) = delete;
index 463cadf..dce4b1e 100644 (file)
@@ -244,7 +244,6 @@ void DefineContainerEvent::print() {
 }
 
 
-
 DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type)
 {
   this->event_type                           = PAJE_DefineVariableType;
index 22ac710..8aa0849 100644 (file)
@@ -575,7 +575,7 @@ void sg_config_init(int *argc, char **argv)
 
 void sg_config_finalize()
 {
-  if (!_sg_cfg_init_status)
+  if (not _sg_cfg_init_status)
     return;                     /* Not initialized yet. Nothing to do */
 
   xbt_cfg_free(&simgrid_config);
index d0f33d4..7474d22 100755 (executable)
@@ -233,13 +233,13 @@ def header(name):
 
 
 def handle(fd, func, simcalls, guarded_simcalls):
-    def nonempty(e): 
+    def nonempty(e):
         return e != ''
     fd.write('\n'.join(filter(nonempty, (func(simcall) for simcall in simcalls))))
 
-    for guard, list in guarded_simcalls.items():
+    for guard, ll in guarded_simcalls.items():
         fd.write('\n#if %s\n' % (guard))
-        fd.write('\n'.join(func(simcall) for simcall in list))
+        fd.write('\n'.join(func(simcall) for simcall in ll))
         fd.write('\n#endif\n')
 
 if __name__ == '__main__':
index 590ba5e..f12c5cf 100644 (file)
@@ -24,22 +24,16 @@ Group::Group()
 
 Group::Group(int n) : size_(n)
 {
-  int i;
   rank_to_index_map_ = xbt_new(int, size_);
   index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f);
   refcount_ = 1;
-  for (i = 0; i < size_; i++) {
+  for (int i = 0; i < size_; i++) {
     rank_to_index_map_[i] = MPI_UNDEFINED;
   }
 }
 
 Group::Group(MPI_Group origin)
 {
-  char *key;
-  char *ptr_rank;
-  xbt_dict_cursor_t cursor = nullptr;
-  
-  int i;
   if(origin != MPI_GROUP_NULL
             && origin != MPI_GROUP_EMPTY)
     {
@@ -47,10 +41,13 @@ Group::Group(MPI_Group origin)
       rank_to_index_map_ = xbt_new(int, size_);
       index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f);
       refcount_ = 1;
-      for (i = 0; i < size_; i++) {
+      for (int i = 0; i < size_; i++) {
         rank_to_index_map_[i] = origin->rank_to_index_map_[i];
       }
 
+      char* key;
+      char* ptr_rank;
+      xbt_dict_cursor_t cursor = nullptr;
       xbt_dict_foreach(origin->index_to_rank_map_, cursor, key, ptr_rank) {
         int * cp = static_cast<int*>(xbt_malloc(sizeof(int)));
         *cp=*reinterpret_cast<int*>(ptr_rank);
@@ -130,13 +127,12 @@ int Group::compare(MPI_Group group2)
   int i;
   int index;
   int rank;
-  int sz;
 
   result = MPI_IDENT;
   if (size_ != group2->size()) {
     result = MPI_UNEQUAL;
   } else {
-    sz = group2->size();
+    int sz = group2->size();
     for (i = 0; i < sz; i++) {
       index = this->index(i);
       rank = group2->rank(index);
index aa01f3c..9c40f5e 100644 (file)
@@ -19,9 +19,9 @@ class Group : public F2C{
     xbt_dict_t index_to_rank_map_;
     int refcount_;
   public:
-    Group();
-    Group(int size);
-    Group(Group* origin);
+    explicit Group();
+    explicit Group(int size);
+    explicit Group(Group* origin);
     ~Group();
 
     void set_mapping(int index, int rank);
index 7febe40..be40773 100755 (executable)
@@ -28,7 +28,7 @@ under the terms of the license (GNU LGPL) which comes with this package.
 # print "WARNING: Output were only sorted using the $sort_prefix first chars.\n"
 #    if ( $sort_prefix > 0 );
 # print "WARNING: Use <! output sort 19> to sort by simulated date and process ID only.\n";
-#    
+#
 # print "----8<---------------  Begin of unprocessed observed output (as it should appear in file):\n";
 # map {print "> $_\n"} @{$cmd{'unsorted got'}};
 # print "--------------->8----  End of the unprocessed observed output.\n";
@@ -292,7 +292,7 @@ class Cmd(object):
             self.timeout *= 20
             self.args = TeshState().wrapper + self.args
         elif re.match(".*smpirun.*", self.args) is not None:
-            self.args = "sh " + self.args 
+            self.args = "sh " + self.args
         if TeshState().jenkins and self.timeout != None:
             self.timeout *= 10