Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Convert integer literals to bool literals.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 2 Jul 2020 20:16:06 +0000 (22:16 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 2 Jul 2020 20:53:13 +0000 (22:53 +0200)
25 files changed:
examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp
examples/s4u/platform-failures/s4u-platform-failures.cpp
src/include/xbt/parmap.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/FloydZone.cpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/inspect/LocationList.cpp
src/mc/remote/AppSide.cpp
src/mc/remote/RemoteSimulation.cpp
src/mc/sosp/Snapshot.cpp
src/plugins/host_dvfs.cpp
src/simdag/sd_task.cpp
src/simix/libsmx.cpp
src/simix/popping_bodies.cpp
src/simix/popping_private.hpp
src/simix/simcalls.py
src/smpi/internals/smpi_deployment.cpp
src/smpi/mpi/smpi_comm.cpp
src/surf/ptask_L07.cpp
src/surf/surf_c_bindings.cpp
src/xbt/log.cpp
src/xbt/xbt_log_layout_format.cpp
teshsuite/s4u/host-on-off/host-on-off.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp

index ef3b979..286b06e 100644 (file)
@@ -52,7 +52,7 @@ static void coordinator()
 
   simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name("coordinator");
 
-  while (1) {
+  while (true) {
     m = static_cast<Message*>(mbox->get());
     if (m->kind == Message::Kind::REQUEST) {
       if (CS_used) {
@@ -91,7 +91,7 @@ static void client(int id)
 
   simgrid::s4u::Mailbox* my_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id));
 
-  while (1) {
+  while (true) {
     XBT_INFO("Ask the request");
     simgrid::s4u::Mailbox::by_name("coordinator")->put(new Message(Message::Kind::REQUEST, my_mailbox), 1000);
 
index a8104a5..b265c58 100644 (file)
@@ -74,7 +74,7 @@ static void worker(int argc, char* argv[])
   xbt_assert(argc == 2, "Expecting one parameter");
   long id                          = xbt_str_parse_int(argv[1], "Invalid argument %s");
   simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id));
-  while (1) {
+  while (true) {
     try {
       XBT_INFO("Waiting a message on %s", mailbox->get_cname());
       const double* payload = static_cast<double*>(mailbox->get());
index 58b59cd..295ad66 100644 (file)
@@ -294,7 +294,7 @@ template <typename T> void Parmap<T>::worker_main(ThreadData* data)
   XBT_CDEBUG(xbt_parmap, "New worker thread created");
 
   /* Worker's main loop */
-  while (1) {
+  while (true) {
     round++; // New scheduling round
     parmap.synchro->worker_wait(round);
     if (parmap.destroying)
index d5c1ff3..63cb6a5 100644 (file)
@@ -25,7 +25,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sr
                                            void* data, double timeout)
 {
   simgrid::kernel::activity::ActivityImplPtr comm = simcall_HANDLER_comm_isend(
-      simcall, src, mbox, task_size, rate, src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0);
+      simcall, src, mbox, task_size, rate, src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, false);
   SIMCALL_SET_MC_VALUE(*simcall, 0);
   simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
 }
index d5c854f..bb78082 100644 (file)
@@ -227,10 +227,12 @@ void DijkstraZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, Net
 {
   add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
-  new_edge(src->id(), dst->id(), new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1));
+  new_edge(src->id(), dst->id(),
+           new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, true));
 
   if (symmetrical == true)
-    new_edge(dst->id(), src->id(), new_extended_route(hierarchy_, dst, src, gw_dst, gw_src, link_list, symmetrical, 0));
+    new_edge(dst->id(), src->id(),
+             new_extended_route(hierarchy_, dst, src, gw_dst, gw_src, link_list, symmetrical, false));
 }
 
 void DijkstraZone::new_edge(int src_id, int dst_id, RouteCreationArgs* route)
index bdae1de..7bfd8ba 100644 (file)
@@ -118,7 +118,7 @@ void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoi
                dst->get_cname());
 
   TO_FLOYD_LINK(src->id(), dst->id()) =
-      new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
+      new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, true);
   TO_FLOYD_PRED(src->id(), dst->id()) = src->id();
   TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list.size();
 
@@ -146,7 +146,7 @@ void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoi
                 src->get_cname(), gw_dst->get_cname());
 
     TO_FLOYD_LINK(dst->id(), src->id()) =
-        new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0);
+        new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, false);
     TO_FLOYD_PRED(dst->id(), src->id()) = dst->id();
     TO_FLOYD_COST(dst->id(), src->id()) =
         (TO_FLOYD_LINK(dst->id(), src->id()))->link_list.size(); /* count of links, old model assume 1 */
index 37acf2e..89f2249 100644 (file)
@@ -127,12 +127,12 @@ void CommunicationDeterminismChecker::deterministic_comm_pattern(int process, co
 
     if (diff != NONE_DIFF) {
       if (comm->type == PatternCommunicationType::send) {
-        this->send_deterministic = 0;
+        this->send_deterministic = false;
         if (this->send_diff != nullptr)
           xbt_free(this->send_diff);
         this->send_diff = print_determinism_result(diff, process, comm, list.index_comm + 1);
       } else {
-        this->recv_deterministic = 0;
+        this->recv_deterministic = false;
         if (this->recv_diff != nullptr)
           xbt_free(this->recv_diff);
         this->recv_diff = print_determinism_result(diff, process, comm, list.index_comm + 1);
index 276ce89..07c7c3d 100644 (file)
@@ -65,7 +65,7 @@ LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Att
 {
   LocationList locations;
   std::ptrdiff_t offset = 0;
-  while (1) {
+  while (true) {
     Dwarf_Addr base;
     Dwarf_Addr start;
     Dwarf_Addr end;
index 0c7ff0d..486a9c7 100644 (file)
@@ -108,7 +108,7 @@ void AppSide::handle_actor_enabled(const s_mc_message_actor_enabled_t* msg) cons
 
 void AppSide::handle_messages()
 {
-  while (1) {
+  while (true) {
     XBT_DEBUG("Waiting messages from model-checker");
 
     char message_buffer[MC_MESSAGE_LENGTH];
@@ -147,7 +147,7 @@ void AppSide::handle_messages()
 
 void AppSide::main_loop()
 {
-  while (1) {
+  while (true) {
     simgrid::mc::wait_for_requests();
     xbt_assert(channel_.send(MC_MESSAGE_WAITING) == 0, "Could not send WAITING message to model-checker");
     this->handle_messages();
index 34d1f27..a293fb5 100644 (file)
@@ -424,7 +424,7 @@ std::string RemoteSimulation::read_string(RemotePtr<char> address) const
   std::vector<char> res(128);
   off_t off = 0;
 
-  while (1) {
+  while (true) {
     ssize_t c = pread(this->memory_file, res.data() + off, res.size() - off, (off_t)address.address() + off);
     if (c == -1 && errno == EINTR)
       continue;
index 7e79989..ccc1ac9 100644 (file)
@@ -104,7 +104,7 @@ static std::vector<s_mc_stack_frame_t> unwind_stack_frames(UnwindContext* stack_
 
   // TODO, check condition check (unw_init_local==0 means end of frame)
 
-  while (1) {
+  while (true) {
     s_mc_stack_frame_t stack_frame;
 
     stack_frame.unw_cursor = c;
index b46ed2d..8082018 100644 (file)
@@ -414,7 +414,7 @@ static void on_host_added(simgrid::s4u::Host& host)
       }
     }();
 
-    while (1) {
+    while (true) {
       // Sleep *before* updating; important for startup (i.e., t = 0).
       // In the beginning, we want to go with the pstates specified in the platform file
       // (so we sleep first)
index 4bde0b8..ec33841 100644 (file)
@@ -40,7 +40,7 @@ SD_task_t SD_task_create(const char *name, void *data, double amount)
   task->state= SD_NOT_SCHEDULED;
   sd_global->initial_tasks.insert(task);
 
-  task->marked = 0;
+  task->marked       = false;
   task->start_time = -1.0;
   task->finish_time = -1.0;
   task->surf_action = nullptr;
index 5830d32..86e74da 100644 (file)
@@ -97,8 +97,8 @@ void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size,
     /* the model-checker wants two separate simcalls */
     simgrid::kernel::activity::ActivityImplPtr comm =
         nullptr; /* MC needs the comm to be set to nullptr during the simcall */
-    comm = simcall_comm_isend(sender, mbox, task_size, rate,
-        src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0);
+    comm = simcall_comm_isend(sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, nullptr, copy_data_fun,
+                              data, false);
     simcall_comm_wait(comm.get(), timeout);
     comm = nullptr;
   }
index d284a16..c659920 100644 (file)
@@ -41,133 +41,133 @@ inline static R simcall(e_smx_simcall_t call, T const&... t)
 
 inline static int simcall_BODY_execution_waitany_for(simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_execution_waitany_for(&SIMIX_process_self()->simcall_, execs, count, timeout);
   return simcall<int, simgrid::kernel::activity::ExecImpl**, size_t, double>(SIMCALL_EXECUTION_WAITANY_FOR, execs, count, timeout);
 }
 
 inline static void simcall_BODY_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_send(&SIMIX_process_self()->simcall_, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
   return simcall<void, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_SEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
 }
 
 inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_isend(&SIMIX_process_self()->simcall_, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
   return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, bool>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
 }
 
 inline static void simcall_BODY_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_recv(&SIMIX_process_self()->simcall_, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
   return simcall<void, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double, double>(SIMCALL_COMM_RECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
 }
 
 inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_irecv(&SIMIX_process_self()->simcall_, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
   return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_IRECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
 }
 
 inline static int simcall_BODY_comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_waitany(&SIMIX_process_self()->simcall_, comms, count, timeout);
   return simcall<int, simgrid::kernel::activity::CommImpl**, size_t, double>(SIMCALL_COMM_WAITANY, comms, count, timeout);
 }
 
 inline static void simcall_BODY_comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_wait(&SIMIX_process_self()->simcall_, comm, timeout);
   return simcall<void, simgrid::kernel::activity::CommImpl*, double>(SIMCALL_COMM_WAIT, comm, timeout);
 }
 
 inline static bool simcall_BODY_comm_test(simgrid::kernel::activity::CommImpl* comm)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_test(&SIMIX_process_self()->simcall_, comm);
   return simcall<bool, simgrid::kernel::activity::CommImpl*>(SIMCALL_COMM_TEST, comm);
 }
 
 inline static int simcall_BODY_comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_comm_testany(&SIMIX_process_self()->simcall_, comms, count);
   return simcall<int, simgrid::kernel::activity::CommImpl**, size_t>(SIMCALL_COMM_TESTANY, comms, count);
 }
 
 inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_mutex_lock(&SIMIX_process_self()->simcall_, mutex);
   return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_LOCK, mutex);
 }
 
 inline static int simcall_BODY_mutex_trylock(smx_mutex_t mutex)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_mutex_trylock(&SIMIX_process_self()->simcall_, mutex);
   return simcall<int, smx_mutex_t>(SIMCALL_MUTEX_TRYLOCK, mutex);
 }
 
 inline static void simcall_BODY_mutex_unlock(smx_mutex_t mutex)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_mutex_unlock(&SIMIX_process_self()->simcall_, mutex);
   return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_UNLOCK, mutex);
 }
 
 inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_cond_wait(&SIMIX_process_self()->simcall_, cond, mutex);
   return simcall<void, smx_cond_t, smx_mutex_t>(SIMCALL_COND_WAIT, cond, mutex);
 }
 
 inline static int simcall_BODY_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_cond_wait_timeout(&SIMIX_process_self()->simcall_, cond, mutex, timeout);
   return simcall<int, smx_cond_t, smx_mutex_t, double>(SIMCALL_COND_WAIT_TIMEOUT, cond, mutex, timeout);
 }
 
 inline static void simcall_BODY_sem_acquire(smx_sem_t sem)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_sem_acquire(&SIMIX_process_self()->simcall_, sem);
   return simcall<void, smx_sem_t>(SIMCALL_SEM_ACQUIRE, sem);
 }
 
 inline static int simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeout)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_sem_acquire_timeout(&SIMIX_process_self()->simcall_, sem, timeout);
   return simcall<int, smx_sem_t, double>(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem, timeout);
 }
 
 inline static int simcall_BODY_mc_random(int min, int max)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     simcall_HANDLER_mc_random(&SIMIX_process_self()->simcall_, min, max);
   return simcall<int, int, int>(SIMCALL_MC_RANDOM, min, max);
 }
 
 inline static void simcall_BODY_run_kernel(std::function<void()> const* code)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     SIMIX_run_kernel(code);
   return simcall<void, std::function<void()> const*>(SIMCALL_RUN_KERNEL, code);
 }
 
 inline static void simcall_BODY_run_blocking(std::function<void()> const* code)
 {
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
+  if (false) /* Go to that function to follow the code flow through the simcall barrier */
     SIMIX_run_blocking(code);
   return simcall<void, std::function<void()> const*>(SIMCALL_RUN_BLOCKING, code);
 }
index 70e6d28..83e7c00 100644 (file)
@@ -48,8 +48,8 @@ struct s_smx_simcall {
   smx_timer_t timeout_cb_                   = nullptr; // Callback to timeouts
   simgrid::mc::SimcallInspector* inspector_ = nullptr; // makes that simcall observable by the MC
   int mc_value_                             = 0;
-  u_smx_scalar args_[11]                    = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
-  u_smx_scalar result_                      = {0};
+  u_smx_scalar args_[11]                    = {};
+  u_smx_scalar result_                      = {};
 };
 
 #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall).mc_value_ = (value))
index 80845da..5b0f872 100755 (executable)
@@ -156,7 +156,7 @@ class Simcall(object):
                                                       self.name,
                                                       ', '.join('%s %s' % (arg.rettype(), arg.name) for arg in self.args)))
         res.append('{')
-        res.append('  if (0) /* Go to that function to follow the code flow through the simcall barrier */')
+        res.append('  if (false) /* Go to that function to follow the code flow through the simcall barrier */')
         if self.need_handler:
             res.append('    simcall_HANDLER_%s(%s);' % (self.name,
                                                         ', '.join(["&SIMIX_process_self()->simcall_"] + [arg.name for arg in self.args])))
index 7d3d387..6eb504a 100644 (file)
@@ -23,7 +23,7 @@ public:
   Instance(int max_no_processes, MPI_Comm comm) : size_(max_no_processes), comm_world_(comm)
   {
     MPI_Group group = new simgrid::smpi::Group(size_);
-    comm_world_     = new simgrid::smpi::Comm(group, nullptr, 0, -1);
+    comm_world_     = new simgrid::smpi::Comm(group, nullptr, false, -1);
     //  FIXME : using MPI_Attr_put with MPI_UNIVERSE_SIZE is forbidden and we make it a no-op (which triggers a warning
     //  as MPI_ERR_ARG is returned). Directly calling Comm::attr_put breaks for now, as MPI_UNIVERSE_SIZE,is <0
     //  instance.comm_world->attr_put<simgrid::smpi::Comm>(MPI_UNIVERSE_SIZE, reinterpret_cast<void*>(instance.size));
index 4d3dc3f..b72ab97 100644 (file)
@@ -364,7 +364,7 @@ MPI_Comm Comm::find_intra_comm(int * leader){
     }
   }
   *leader=min_index;
-  return new  Comm(group_intra, nullptr, 1);
+  return new Comm(group_intra, nullptr, true);
 }
 
 void Comm::init_smp(){
@@ -431,7 +431,7 @@ void Comm::init_smp(){
     //create leader_communicator
     for (i=0; i< leader_group_size;i++)
       leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]).get(), i);
-    leader_comm = new  Comm(leaders_group, nullptr,1);
+    leader_comm = new Comm(leaders_group, nullptr, true);
     this->set_leaders_comm(leader_comm);
     this->set_intra_comm(comm_intra);
 
@@ -441,7 +441,7 @@ void Comm::init_smp(){
       leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]).get(), i);
 
     if(this->get_leaders_comm()==MPI_COMM_NULL){
-      leader_comm = new  Comm(leaders_group, nullptr,1);
+      leader_comm = new Comm(leaders_group, nullptr, true);
       this->set_leaders_comm(leader_comm);
     }else{
       leader_comm=this->get_leaders_comm();
index f6087ff..d1f2593 100644 (file)
@@ -144,7 +144,7 @@ kernel::resource::CpuAction* HostL07Model::execute_parallel(const std::vector<s4
 
 L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host*>& host_list,
                      const double* flops_amount, const double* bytes_amount, double rate)
-    : CpuAction(model, 1, 0), computationAmount_(flops_amount), communicationAmount_(bytes_amount), rate_(rate)
+    : CpuAction(model, 1.0, false), computationAmount_(flops_amount), communicationAmount_(bytes_amount), rate_(rate)
 {
   size_t link_nb      = 0;
   size_t used_host_nb = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
index 44e7788..10d2874 100644 (file)
@@ -82,7 +82,7 @@ double surf_solve(double max_date)
 
   XBT_DEBUG("Looking for next trace event");
 
-  while (1) { // Handle next occurring events until none remains
+  while (true) { // Handle next occurring events until none remains
     double next_event_date = simgrid::kernel::profile::future_evt_set.next_date();
     XBT_DEBUG("Next TRACE event: %f", next_event_date);
 
index b536e7f..7f4da38 100644 (file)
@@ -161,7 +161,7 @@ void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...)
   xbt_assert(static_cast<size_t>(ev->priority) < sizeof(xbt_log_priority_names)/sizeof(xbt_log_priority_names[0]),
              "Priority %d is greater than the biggest allowed value", ev->priority);
 
-  while (1) {
+  while (true) {
     const s_xbt_log_appender_t* appender = cat->appender;
 
     if (appender != nullptr) {
@@ -182,7 +182,7 @@ void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...)
         /* The static buffer was too small, use a dynamically expanded one */
         ev->buffer_size = XBT_LOG_DYNAMIC_BUFFER_SIZE;
         ev->buffer      = static_cast<char*>(xbt_malloc(ev->buffer_size));
-        while (1) {
+        while (true) {
           va_start(ev->ap, fmt);
           done = cat->layout->do_layout(cat->layout, ev, fmt);
           va_end(ev->ap);
index e07eca4..9a0e7fe 100644 (file)
@@ -30,18 +30,19 @@ static constexpr const char* ERRMSG =
   } else                                                                \
     return 0
 
-#define set_sz_from_precision()                                         \
-  if (1) {                                                              \
-    sz = rem_size;                                                      \
-    if (precision != -1) {                                              \
-      if (precision < sz)                                               \
-        sz = precision + 1;     /* +1 for the final '\0' */             \
-      precision = -1;                                                   \
-    }                                                                   \
-  } else (void)0
+#define set_sz_from_precision()                                                                                        \
+  if (true) {                                                                                                          \
+    sz = rem_size;                                                                                                     \
+    if (precision != -1) {                                                                                             \
+      if (precision < sz)                                                                                              \
+        sz = precision + 1; /* +1 for the final '\0' */                                                                \
+      precision = -1;                                                                                                  \
+    }                                                                                                                  \
+  } else                                                                                                               \
+    (void)0
 
 #define show_it(data, letter)                                                                                          \
-  if (1) {                                                                                                             \
+  if (true) {                                                                                                          \
     int len;                                                                                                           \
     int wd;                                                                                                            \
     if (length == -1) {                                                                                                \
@@ -58,13 +59,14 @@ static constexpr const char* ERRMSG =
     }                                                                                                                  \
     check_overflow(len);                                                                                               \
   } else                                                                                                               \
-  (void)0
+    (void)0
 
-#define show_string(data)                                               \
-  if (1) {                                                              \
-    const char *show_string_data = (data);                              \
-    show_it(show_string_data ? show_string_data : "(null)", "s");       \
-  } else (void)0
+#define show_string(data)                                                                                              \
+  if (true) {                                                                                                          \
+    const char* show_string_data = (data);                                                                             \
+    show_it(show_string_data ? show_string_data : "(null)", "s");                                                      \
+  } else                                                                                                               \
+    (void)0
 #define show_int(data) show_it((data), "d")
 #define show_double(data) show_it((data), "f")
 
@@ -165,7 +167,7 @@ static int xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_event
             xbt_abort();
         }
         break; /* done, continue normally */
-      } while (1);
+      } while (true);
     } else {
       *p = *q;
       check_overflow(1);
index 906c536..ff634b9 100644 (file)
@@ -13,7 +13,7 @@ static void worker()
   const std::string* payload;
   simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name("jupi");
 
-  while (1) {
+  while (true) {
     try {
       payload = static_cast<std::string*>(mailbox->get());
     } catch (const simgrid::HostFailureException&) {
index 2cc23e4..f633892 100644 (file)
@@ -126,7 +126,7 @@ static void server()
   simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_cname());
 
   XBT_INFO("Server waiting for transfers ...");
-  while (1) {
+  while (true) {
     const std::string* msg = static_cast<std::string*>(mailbox->get());
     if (*msg == "finalize") { // Shutdown ...
       delete msg;