Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Useless parentheses.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 27 Mar 2021 13:17:20 +0000 (14:17 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 27 Mar 2021 21:10:46 +0000 (22:10 +0100)
23 files changed:
examples/c/dht-kademlia/node.c
examples/cpp/dht-kademlia/node.cpp
examples/smpi/mc/bugged1_liveness.c
examples/smpi/mc/mutual_exclusion.c
examples/smpi/mc/non_termination1.c
examples/smpi/mc/non_termination2.c
examples/smpi/mc/non_termination3.c
examples/smpi/mc/non_termination4.c
src/kernel/activity/CommImpl.cpp
src/kernel/context/ContextRaw.cpp
src/msg/msg_global.cpp
src/msg/msg_task.cpp
src/simdag/sd_dotloader.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_datatype.cpp
src/smpi/mpi/smpi_win.cpp
src/surf/cpu_ti.cpp
src/surf/network_wifi.cpp
src/xbt/mmalloc/mm_module.c
src/xbt/mmalloc/mmalloc.c
src/xbt/mmalloc/mmorecore.c
src/xbt/mmalloc/mrealloc.c
teshsuite/simdag/availability/availability.c

index 2ad13b2..b9d8e37 100644 (file)
@@ -337,7 +337,7 @@ unsigned int get_node_prefix(unsigned int id, unsigned int nb_bits)
   unsigned int size = sizeof(unsigned int) * 8;
   for (unsigned int j = 0; j < size; j++) {
     if (((id >> (size - 1 - j)) & 0x1) != 0) {
-      return nb_bits - (j);
+      return nb_bits - j;
     }
   }
   return 0;
index 8ab81e7..d620017 100644 (file)
@@ -307,7 +307,7 @@ unsigned int get_node_prefix(unsigned int id, unsigned int nb_bits)
   unsigned int size = sizeof(unsigned int) * 8;
   for (unsigned int j = 0; j < size; j++) {
     if (((id >> (size - 1 - j)) & 0x1) != 0) {
-      return nb_bits - (j);
+      return nb_bits - j;
     }
   }
   return 0;
index baec20c..72011c4 100644 (file)
@@ -47,7 +47,7 @@ int main(int argc, char **argv){
   MC_automaton_new_propositional_symbol_pointer("r", &r);
   MC_automaton_new_propositional_symbol_pointer("cs", &cs);
 
-  MC_ignore(&(status.count), sizeof(status.count));
+  MC_ignore(&status.count, sizeof status.count);
 
   /* Get number of processes */
   MPI_Comm_size(MPI_COMM_WORLD, &size);
index 628bb79..8014fa5 100644 (file)
@@ -27,7 +27,7 @@ int main(int argc, char **argv){
     exit(1);
   }
 
-  MC_ignore(&(status.count), sizeof(status.count));
+  MC_ignore(&status.count, sizeof status.count);
 
   /* Get number of processes */
   MPI_Comm_size(MPI_COMM_WORLD, &size);
index 3ec31a2..919824f 100644 (file)
@@ -16,7 +16,7 @@ int main(int argc, char **argv) {
   MPI_Comm_size(MPI_COMM_WORLD, &size);   /* Get nr of tasks */
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
 
-  MC_ignore(&(status.count), sizeof(status.count));
+  MC_ignore(&status.count, sizeof status.count);
 
   if (rank == 0) {
     while (1) {
index 60aa0a8..031ab50 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char **argv) {
   MPI_Comm_size(MPI_COMM_WORLD, &size);   /* Get nr of tasks */
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
 
-  MC_ignore(&(status.count), sizeof(status.count));
+  MC_ignore(&status.count, sizeof status.count);
 
   if (rank == 0) {
     while (1) {
index 0e0f56f..ebbbb9c 100644 (file)
@@ -17,7 +17,7 @@ int main(int argc, char **argv) {
   MPI_Comm_size(MPI_COMM_WORLD, &size);   /* Get nr of tasks */
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
 
-  MC_ignore(&(status.count), sizeof(status.count));
+  MC_ignore(&status.count, sizeof status.count);
 
   if (rank == 0) {
     while (x<5) {
index a0792ed..cd8b1a2 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char **argv) {
   MPI_Comm_size(MPI_COMM_WORLD, &size);   /* Get nr of tasks */
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);   /* Get id of this process */
 
-  MC_ignore(&(status.count), sizeof(status.count));
+  MC_ignore(&status.count, sizeof status.count);
 
   if(rank==0){
     while (recv_x>=0) {
index d512914..f51af06 100644 (file)
@@ -483,7 +483,7 @@ void CommImpl::copy_data()
 
   /* Copy at most dst_buff_size bytes of the message to receiver's buffer */
   if (dst_buff_size_) {
-    buff_size = std::min(buff_size, *(dst_buff_size_));
+    buff_size = std::min(buff_size, *dst_buff_size_);
 
     /* Update the receiver's buffer size to the copied amount */
     *dst_buff_size_ = buff_size;
index 3b1cc8d..cdae042 100644 (file)
@@ -202,7 +202,7 @@ RawContext::RawContext(std::function<void()>&& code, actor::ActorImpl* actor, Sw
     this->stack_top_ = raw_makecontext(get_stack(), actor->get_stacksize(), smx_ctx_wrapper, this);
   } else {
     if (MC_is_active())
-      MC_ignore_heap(&stack_top_, sizeof(stack_top_));
+      MC_ignore_heap(&stack_top_, sizeof stack_top_);
   }
 }
 
index e44c094..d927e44 100644 (file)
@@ -51,7 +51,7 @@ void MSG_init_nocheck(int* argc, char** argv)
 
   if(MC_is_active()){
     /* Ignore total amount of messages sent during the simulation for heap comparison */
-    MC_ignore_heap(&(msg_global->sent_msg), sizeof(msg_global->sent_msg));
+    MC_ignore_heap(&msg_global->sent_msg, sizeof msg_global->sent_msg);
   }
 
   if (simgrid::config::get_value<bool>("debug/clean-atexit"))
index c22cdc8..03e9004 100644 (file)
@@ -28,7 +28,7 @@ Task::Task(const std::string& name, double flops_amount, double bytes_amount, vo
   id_ = counter++;
   set_data(data);
   if (MC_is_active())
-    MC_ignore_heap(&(id_), sizeof(id_));
+    MC_ignore_heap(&id_, sizeof id_);
 }
 
 Task::Task(const std::string& name, std::vector<s4u::Host*>&& hosts, std::vector<double>&& flops_amount,
index 324363d..99f1bf1 100644 (file)
@@ -83,8 +83,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
       if (strcmp(name,"root") && strcmp(name,"end"))
         xbt_dynar_push(result, &task);
 
-      if ((sequential) &&
-          ((schedule && schedule_success) || XBT_LOG_ISENABLED(sd_dotparse, xbt_log_priority_verbose))) {
+      if (sequential && ((schedule && schedule_success) || XBT_LOG_ISENABLED(sd_dotparse, xbt_log_priority_verbose))) {
         /* try to take the information to schedule the task only if all is right*/
         char *char_performer = agget(node, (char *) "performer");
         char *char_order = agget(node, (char *) "order");
index 1722cec..8f53972 100644 (file)
@@ -479,7 +479,7 @@ void Comm::init_smp(){
     }
     is_uniform_=is_uniform;
   }
-  bcast__scatter_LR_allgather(&(is_uniform_),1, MPI_INT, 0, comm_intra );
+  bcast__scatter_LR_allgather(&is_uniform_, 1, MPI_INT, 0, comm_intra);
 
   if (smpi_cfg_privatization() == SmpiPrivStrategies::MMAP) {
     // we need to switch as the called function may silently touch global variables
@@ -498,7 +498,7 @@ void Comm::init_smp(){
   }
 
   int global_blocked;
-  allreduce__default(&is_blocked, &(global_blocked), 1, MPI_INT, MPI_LAND, this);
+  allreduce__default(&is_blocked, &global_blocked, 1, MPI_INT, MPI_LAND, this);
 
   if(MPI_COMM_WORLD==MPI_COMM_UNINITIALIZED || this==MPI_COMM_WORLD){
     if(this->rank()==0){
index 860257b..3f6b298 100644 (file)
@@ -120,7 +120,7 @@ Datatype::Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags) : size_(size),
   this->add_f();
 #if SIMGRID_HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(refcount_), sizeof(refcount_));
+    MC_ignore(&refcount_, sizeof refcount_);
 #endif
 }
 
@@ -131,7 +131,7 @@ Datatype::Datatype(const char* name, int ident, int size, MPI_Aint lb, MPI_Aint
   id2type_lookup.insert({id, this});
 #if SIMGRID_HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(refcount_), sizeof(refcount_));
+    MC_ignore(&refcount_, sizeof refcount_);
 #endif
 }
 
@@ -207,7 +207,7 @@ void Datatype::ref()
 
 #if SIMGRID_HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(refcount_), sizeof(refcount_));
+    MC_ignore(&refcount_, sizeof refcount_);
 #endif
 }
 
@@ -218,7 +218,7 @@ void Datatype::unref(MPI_Datatype datatype)
 
 #if SIMGRID_HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(datatype->refcount_), sizeof(datatype->refcount_));
+    MC_ignore(&datatype->refcount_, sizeof datatype->refcount_);
 #endif
 
   if (datatype->refcount_ == 0 && not(datatype->flags_ & DT_FLAG_PREDEFINED))
@@ -419,8 +419,8 @@ int Datatype::create_vector(int count, int block_length, int stride, MPI_Datatyp
     ub=((count-1)*stride+block_length-1)*old_type->get_extent()+old_type->ub();
   }
   if(old_type->flags() & DT_FLAG_DERIVED || stride != block_length){
-    *new_type = new Type_Vector(count * (block_length) * old_type->size(), lb, ub,
-                                   DT_FLAG_DERIVED, count, block_length, stride, old_type);
+    *new_type = new Type_Vector(count * block_length * old_type->size(), lb, ub, DT_FLAG_DERIVED, count, block_length,
+                                stride, old_type);
     retval=MPI_SUCCESS;
   }else{
     /* in this situation the data are contiguous thus it's not required to serialize and unserialize it*/
@@ -446,8 +446,8 @@ int Datatype::create_hvector(int count, int block_length, MPI_Aint stride, MPI_D
     ub=((count-1)*stride)+(block_length-1)*old_type->get_extent()+old_type->ub();
   }
   if(old_type->flags() & DT_FLAG_DERIVED || stride != block_length*old_type->get_extent()){
-    *new_type = new Type_Hvector(count * (block_length) * old_type->size(), lb, ub,
-                                   DT_FLAG_DERIVED, count, block_length, stride, old_type);
+    *new_type = new Type_Hvector(count * block_length * old_type->size(), lb, ub, DT_FLAG_DERIVED, count, block_length,
+                                 stride, old_type);
     retval=MPI_SUCCESS;
   }else{
     /* in this situation the data are contiguous thus it's not required to serialize and unserialize it*/
index ca86d3f..bc35012 100644 (file)
@@ -49,7 +49,7 @@ Win::Win(void* base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm,
   colls::allgather(&connected_wins_[rank_], sizeof(MPI_Win), MPI_BYTE, connected_wins_.data(), sizeof(MPI_Win),
                    MPI_BYTE, comm);
 
-  colls::bcast(&(bar_), sizeof(s4u::Barrier*), MPI_BYTE, 0, comm);
+  colls::bcast(&bar_, sizeof(s4u::Barrier*), MPI_BYTE, 0, comm);
 
   colls::barrier(comm);
   this->add_f();
index df5dd66..bce17e5 100644 (file)
@@ -158,8 +158,8 @@ double CpuTiTmgr::solve(double a, double amount) const
   XBT_DEBUG("amount %f total %f", amount, total_);
   /* Reduce the problem to one where amount <= trace_total */
   double quotient       = floor(amount / total_);
-  double reduced_amount = (total_) * ((amount / total_) - floor(amount / total_));
-  double reduced_a      = a - (last_time_) * static_cast<int>(floor(a / last_time_));
+  double reduced_amount = total_ * ((amount / total_) - floor(amount / total_));
+  double reduced_a      = a - last_time_ * static_cast<int>(floor(a / last_time_));
 
   XBT_DEBUG("Quotient: %g reduced_amount: %f reduced_a: %f", quotient, reduced_amount, reduced_a);
 
index 9b0d62f..e9eb61d 100644 (file)
@@ -88,7 +88,7 @@ void NetworkWifiLink::refresh_decay_bandwidths(){
 
 bool NetworkWifiLink::toggle_decay_model(){
   use_decay_model_=!use_decay_model_;
-  return(use_decay_model_);
+  return use_decay_model_;
 }
 
 LinkImpl* NetworkWifiLink::set_latency(double value)
index ebf8494..1a28bd4 100644 (file)
@@ -265,7 +265,7 @@ void *xbt_mheap_destroy(xbt_mheap_t mdp)
     }
   }
 
-  return (mdp);
+  return mdp;
 }
 
 /* Safety gap from the heap's break address.
index 8aee79c..7f50751 100644 (file)
@@ -44,7 +44,7 @@ static void *align(struct mdesc *mdp, size_t size)
     mmorecore(mdp, adj);
     result = (char *) result + adj;
   }
-  return (result);
+  return result;
 }
 
 /** Initialize heapinfo about the heapinfo pages :)
@@ -149,7 +149,7 @@ static void *register_morecore(struct mdesc *mdp, size_t size)
   }
 
   mdp->heaplimit = BLOCK((char *) result + size);
-  return (result);
+  return result;
 }
 
 /* Allocate memory from the heap.  */
@@ -341,5 +341,5 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
 
   }
 
-  return (result);
+  return result;
 }
index 96630f7..d7cd4e1 100644 (file)
@@ -142,7 +142,7 @@ void *mmorecore(struct mdesc *mdp, ssize_t size)
       mdp->breakval = (char*)mdp->breakval + size;
     }
   }
-  return (result);
+  return result;
 }
 
 void* __mmalloc_remap_core(const s_xbt_mheap_t* mdp)
index cd6ea5d..f543cc1 100644 (file)
@@ -73,7 +73,7 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
       result = mmalloc(mdp, size);
       memcpy(result, ptr, requested_size);
       mfree(mdp, ptr);
-      return (result);
+      return result;
     }
 
     /* Full blocks -> Full blocks; see if we can hold it in place. */
@@ -148,5 +148,5 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
     }
     break;
   }
-  return (result);
+  return result;
 }
index 24f3f23..13ec72f 100644 (file)
@@ -31,7 +31,7 @@ static void scheduleDAX(const_xbt_dynar_t dax)
         SD_task_schedulel(task, 1, hosts[0]);
       } else {
         XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(hosts[(cursor) % totalHosts]));
-        SD_task_schedulel(task, 1, hosts[(cursor) % totalHosts]);
+        SD_task_schedulel(task, 1, hosts[cursor % totalHosts]);
       }
     }
   }