Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] s/NULL/nullptr/
authorGabriel Corona <gabriel.corona@loria.fr>
Fri, 26 Feb 2016 13:23:19 +0000 (14:23 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 26 Feb 2016 14:19:22 +0000 (15:19 +0100)
26 files changed:
src/mc/ModelChecker.hpp
src/mc/ObjectInformation.cpp
src/mc/PageStore.cpp
src/mc/Process.cpp
src/mc/RegionSnapshot.cpp
src/mc/mc_base.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_client.cpp
src/mc/mc_comm_determinism.cpp
src/mc/mc_comm_pattern.cpp
src/mc/mc_compare.cpp
src/mc/mc_config.cpp
src/mc/mc_diff.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_global.cpp
src/mc/mc_liveness.cpp
src/mc/mc_member.cpp
src/mc/mc_pair.cpp
src/mc/mc_request.cpp
src/mc/mc_safety.cpp
src/mc/mc_smx.cpp
src/mc/mc_snapshot.cpp
src/mc/mc_state.cpp
src/mc/mc_unw.cpp
src/mc/mc_visited.cpp
src/mc/simgrid_mc.cpp

index cd5021b..47790fb 100644 (file)
@@ -31,7 +31,7 @@ class ModelChecker {
   struct pollfd fds_[2];
   /** String pool for host names */
   // TODO, use std::unordered_set with heterogeneous comparison lookup (C++14)
-  xbt_dict_t /* <hostname, NULL> */ hostnames_;
+  xbt_dict_t /* <hostname, nullptr> */ hostnames_;
   // This is the parent snapshot of the current state:
   PageStore page_store_;
   std::unique_ptr<Process> process_;
index 43b3a1f..b4c5851 100644 (file)
@@ -48,9 +48,9 @@ void *ObjectInformation::base_address() const
     return nullptr;
 
   void *result = this->start_exec;
-  if (this->start_rw != NULL && result > (void *) this->start_rw)
+  if (this->start_rw != nullptr && result > (void *) this->start_rw)
     result = this->start_rw;
-  if (this->start_ro != NULL && result > (void *) this->start_ro)
+  if (this->start_ro != nullptr && result > (void *) this->start_ro)
     result = this->start_ro;
   return result;
 }
@@ -153,7 +153,7 @@ void ObjectInformation::remove_global_variable(const char* name)
  *  name.
  *
  *  \param var_name        Name of the local variable (or parameter to ignore)
- *  \param subprogram_name Name of the subprogram fo ignore (NULL for any)
+ *  \param subprogram_name Name of the subprogram fo ignore (nullptr for any)
  *  \param subprogram      (possibly inlined) Subprogram of the scope
  *  \param scope           Current scope
  */
index f5d7697..7f7e166 100644 (file)
@@ -48,12 +48,12 @@ PageStore::hash_type mc_hash_page(const void* data)
 // ***** snapshot_page_manager
 
 PageStore::PageStore(size_t size) :
-  memory_(NULL), capacity_(0), top_index_(0)
+  memory_(nullptr), capacity_(0), top_index_(0)
 {
   // Using mmap in order to be able to expand the region
   // by relocating it somewhere else in the virtual memory
   // space:
-  void* memory = ::mmap(NULL, size << xbt_pagebits, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, -1, 0);
+  void* memory = ::mmap(nullptr, size << xbt_pagebits, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, -1, 0);
   if (memory == MAP_FAILED) {
     xbt_die("Could not mmap initial snapshot pages.");
   }
@@ -182,7 +182,7 @@ static void new_content(void* data, std::size_t size)
 
 static void* getpage()
 {
-  return mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+  return mmap(nullptr, getpagesize(), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
 }
 
 XBT_TEST_SUITE("mc_page_store", "Page store");
index cb39d09..9fa3ba4 100644 (file)
@@ -103,7 +103,7 @@ static char* MC_get_lib_name(const char* pathname, struct s_mc_memory_map_re* re
 
   regmatch_t match;
   if(regexec(&res->so_re, map_basename, 1, &match, 0))
-    return NULL;
+    return nullptr;
 
   char* libname = strndup(map_basename, match.rm_so);
 
@@ -165,7 +165,7 @@ static void MC_zero_buffer_init(void)
   int fd = open("/dev/zero", O_RDONLY);
   if (fd<0)
     xbt_die("Could not open /dev/zero");
-  zero_buffer = mmap(NULL, zero_buffer_size, PROT_READ, MAP_SHARED, fd, 0);
+  zero_buffer = mmap(nullptr, zero_buffer_size, PROT_READ, MAP_SHARED, fd, 0);
   if (zero_buffer == MAP_FAILED)
     xbt_die("Could not map the zero buffer");
   close(fd);
@@ -255,11 +255,11 @@ Process::~Process()
     unw_destroy_addr_space(this->unw_underlying_addr_space);
     _UPT_destroy(this->unw_underlying_context);
   }
-  this->unw_underlying_context = NULL;
-  this->unw_underlying_addr_space = NULL;
+  this->unw_underlying_context = nullptr;
+  this->unw_underlying_addr_space = nullptr;
 
   unw_destroy_addr_space(this->unw_addr_space);
-  this->unw_addr_space = NULL;
+  this->unw_addr_space = nullptr;
 
   this->cache_flags = MC_PROCESS_CACHE_FLAG_NONE;
 
@@ -311,8 +311,8 @@ void Process::init_memory_map_info()
   this->maestro_stack_start_ = nullptr;
   this->maestro_stack_end_ = nullptr;
   this->object_infos.resize(0);
-  this->binary_info = NULL;
-  this->libsimgrid_info = NULL;
+  this->binary_info = nullptr;
+  this->libsimgrid_info = nullptr;
 
   struct s_mc_memory_map_re res;
 
@@ -321,7 +321,7 @@ void Process::init_memory_map_info()
 
   std::vector<simgrid::xbt::VmMap> const& maps = this->memory_map_;
 
-  const char* current_name = NULL;
+  const char* current_name = nullptr;
 
   this->object_infos.resize(0);
 
@@ -331,7 +331,7 @@ void Process::init_memory_map_info()
 
     // Nothing to do
     if (maps[i].pathname.empty()) {
-      current_name = NULL;
+      current_name = nullptr;
       continue;
     }
 
@@ -341,7 +341,7 @@ void Process::init_memory_map_info()
         this->maestro_stack_start_ = remote(reg.start_addr);
         this->maestro_stack_end_ = remote(reg.end_addr);
       }
-      current_name = NULL;
+      current_name = nullptr;
       continue;
     }
 
@@ -353,7 +353,7 @@ void Process::init_memory_map_info()
       continue;
 
     const bool is_executable = !i;
-    char* libname = NULL;
+    char* libname = nullptr;
     if (!is_executable) {
       libname = MC_get_lib_name(pathname, &res);
       if(!libname)
@@ -395,7 +395,7 @@ std::shared_ptr<simgrid::mc::ObjectInformation> Process::find_object_info(remote
       return object_info;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 std::shared_ptr<ObjectInformation> Process::find_object_info_exec(remote_ptr<void> addr) const
@@ -447,7 +447,7 @@ simgrid::mc::Variable* Process::find_variable(const char* name) const
       return var;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 void Process::read_variable(const char* name, void* target, size_t size) const
@@ -466,7 +466,7 @@ void Process::read_variable(const char* name, void* target, size_t size) const
 char* Process::read_string(remote_ptr<void> address) const
 {
   if (!address)
-    return NULL;
+    return nullptr;
 
   off_t len = 128;
   char* res = (char*) malloc(len);
index 53a34f4..8a8c370 100644 (file)
@@ -104,7 +104,7 @@ RegionSnapshot sparse_region(RegionType region_type,
   RegionSnapshot const* ref_region)
 {
   simgrid::mc::Process* process = &mc_model_checker->process();
-  assert(process != NULL);
+  assert(process != nullptr);
 
   bool use_soft_dirty = _sg_mc_sparse_checkpoint && _sg_mc_soft_dirty
     && ref_region != nullptr
index c5ec355..5b61d7b 100644 (file)
@@ -93,9 +93,9 @@ int MC_request_is_enabled(smx_simcall_t req)
         return TRUE;
     } else {
       /* On the other hand if it hasn't a timeout, check if the comm is ready.*/
-      if (act->comm.detached && act->comm.src_proc == NULL
+      if (act->comm.detached && act->comm.src_proc == nullptr
           && act->comm.type == SIMIX_COMM_READY)
-        return (act->comm.dst_proc != NULL);
+        return (act->comm.dst_proc != nullptr);
     }
     return (act->comm.src_proc && act->comm.dst_proc);
 
@@ -153,7 +153,7 @@ int MC_request_is_enabled(smx_simcall_t req)
       mutex = &temp_mutex;
     }
 #endif
-    if(mutex->owner == NULL)
+    if(mutex->owner == nullptr)
       return TRUE;
     else
 #ifdef HAVE_MC
@@ -228,7 +228,7 @@ void MC_simcall_handle(smx_simcall_t req, int value)
   }
 
   unsigned i;
-  mc_smx_process_info_t pi = NULL;
+  mc_smx_process_info_t pi = nullptr;
 
   xbt_dynar_foreach_ptr(mc_model_checker->process().smx_process_infos, i, pi) {
     if (req == &pi->copy.simcall) {
index 990bf5a..baf90a2 100644 (file)
@@ -167,7 +167,7 @@ static void get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t snap
   void *start_heap = heap->base;
   void *end_heap = heap->breakval;
 
-  add_region(n, snapshot, simgrid::mc::RegionType::Heap, NULL,
+  add_region(n, snapshot, simgrid::mc::RegionType::Heap, nullptr,
                         start_heap, start_heap,
                         (char *) end_heap - (char *) start_heap);
   snapshot->heap_bytes_used = mmalloc_get_bytes_used_remote(
@@ -300,7 +300,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame,
     new_var.region = region_type;
     new_var.address = nullptr;
 
-    if (current_variable.address != NULL) {
+    if (current_variable.address != nullptr) {
       new_var.address = current_variable.address;
     } else if (!current_variable.location_list.empty()) {
       simgrid::dwarf::Location location =
@@ -476,7 +476,7 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
     xbt_die("Unexpected buffer is too small for fd_dir_path");
 
   DIR* fd_dir = opendir(fd_dir_path);
-  if (fd_dir == NULL)
+  if (fd_dir == nullptr)
     xbt_die("Cannot open directory '/proc/self/fd'\n");
 
   std::vector<s_fd_infos_t> fds;
@@ -524,7 +524,7 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
       continue;
 
     // If dot_output enabled, do not handle the corresponding file
-    if (dot_output !=  NULL && strcmp(xbt_basename(link), _sg_mc_dot_output_file) == 0)
+    if (dot_output !=  nullptr && strcmp(xbt_basename(link), _sg_mc_dot_output_file) == 0)
       continue;
 
     // This is probably a shared memory used by lttng-ust:
index 733ecba..cf57b91 100644 (file)
@@ -62,7 +62,7 @@ void MC_client_init(void)
   mc_client->active = 1;
 
   // Waiting for the model-checker:
-  if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) == -1 || raise(SIGSTOP) != 0)
+  if (ptrace(PTRACE_TRACEME, 0, nullptr, NULL) == -1 || raise(SIGSTOP) != 0)
     xbt_die("Could not wait for the model-checker");
   MC_client_handle_messages();
 }
index 22b442b..9b98b74 100644 (file)
@@ -41,9 +41,9 @@ static e_mc_comm_pattern_difference_t compare_comm_pattern(mc_comm_pattern_t com
     return TAG_DIFF;
   if (comm1->data_size != comm2->data_size)
     return DATA_SIZE_DIFF;
-  if(comm1->data == NULL && comm2->data == NULL)
+  if(comm1->data == nullptr && comm2->data == NULL)
     return NONE_DIFF;
-  if(comm1->data != NULL && comm2->data !=NULL) {
+  if(comm1->data != nullptr && comm2->data !=NULL) {
     if (!memcmp(comm1->data, comm2->data, comm1->data_size))
       return NONE_DIFF;
     return DATA_DIFF;
@@ -84,7 +84,7 @@ static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int p
     res = bprintf("%s\n Different data for communication #%d", type, cursor);
     break;
   default:
-    res = NULL;
+    res = nullptr;
     break;
   }
 
@@ -102,7 +102,7 @@ static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t co
   comm_pattern->dst_proc = dst_proc->pid;
   comm_pattern->src_host = MC_smx_process_get_host_name(src_proc);
   comm_pattern->dst_host = MC_smx_process_get_host_name(dst_proc);
-  if (comm_pattern->data_size == -1 && comm.comm.src_buff != NULL) {
+  if (comm_pattern->data_size == -1 && comm.comm.src_buff != nullptr) {
     size_t buff_size;
     mc_model_checker->process().read(
       &buff_size, remote(comm.comm.dst_buff_size));
@@ -128,12 +128,12 @@ static void deterministic_comm_pattern(int process, mc_comm_pattern_t comm, int
     if (diff != NONE_DIFF) {
       if (comm->type == SIMIX_COMM_SEND){
         initial_global_state->send_deterministic = 0;
-        if(initial_global_state->send_diff != NULL)
+        if(initial_global_state->send_diff != nullptr)
           xbt_free(initial_global_state->send_diff);
         initial_global_state->send_diff = print_determinism_result(diff, process, comm, list->index_comm + 1);
       }else{
         initial_global_state->recv_deterministic = 0;
-        if(initial_global_state->recv_diff != NULL)
+        if(initial_global_state->recv_diff != nullptr)
           xbt_free(initial_global_state->recv_diff);
         initial_global_state->recv_diff = print_determinism_result(diff, process, comm, list->index_comm + 1);
       }
@@ -143,7 +143,7 @@ static void deterministic_comm_pattern(int process, mc_comm_pattern_t comm, int
         XBT_INFO("*********************************************************");
         XBT_INFO("%s", initial_global_state->send_diff);
         xbt_free(initial_global_state->send_diff);
-        initial_global_state->send_diff = NULL;
+        initial_global_state->send_diff = nullptr;
         MC_print_statistics(mc_stats);
         mc_model_checker->exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
       }else if(_sg_mc_comms_determinism && (!initial_global_state->send_deterministic && !initial_global_state->recv_deterministic)) {
@@ -153,9 +153,9 @@ static void deterministic_comm_pattern(int process, mc_comm_pattern_t comm, int
         XBT_INFO("%s", initial_global_state->send_diff);
         XBT_INFO("%s", initial_global_state->recv_diff);
         xbt_free(initial_global_state->send_diff);
-        initial_global_state->send_diff = NULL;
+        initial_global_state->send_diff = nullptr;
         xbt_free(initial_global_state->recv_diff);
-        initial_global_state->recv_diff = NULL;
+        initial_global_state->recv_diff = nullptr;
         MC_print_statistics(mc_stats);
         mc_model_checker->exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
       } 
@@ -178,7 +178,7 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
 
   mc_comm_pattern_t pattern = xbt_new0(s_mc_comm_pattern_t, 1);
   pattern->data_size = -1;
-  pattern->data = NULL;
+  pattern->data = nullptr;
   pattern->index =
     initial_pattern->index_comm + xbt_dynar_length(incomplete_pattern);
 
@@ -201,7 +201,7 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
         (std::uint64_t) simcall_comm_isend__get__data(request));
     pattern->tag = mpi_request.tag;
 
-    if(synchro.comm.src_buff != NULL){
+    if(synchro.comm.src_buff != nullptr){
       pattern->data_size = synchro.comm.src_buff_size;
       pattern->data = xbt_malloc0(pattern->data_size);
       mc_model_checker->process().read_bytes(
@@ -294,7 +294,7 @@ static int MC_modelcheck_comm_determinism_main(void);
 
 static void MC_pre_modelcheck_comm_determinism(void)
 {
-  mc_state_t initial_state = NULL;
+  mc_state_t initial_state = nullptr;
   smx_process_t process;
   int i;
   const int maxpid = MC_smx_get_maxpid();
@@ -314,7 +314,7 @@ static void MC_pre_modelcheck_comm_determinism(void)
   // Create incomplete_communications_pattern elements:
   incomplete_communications_pattern = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
   for (i=0; i < maxpid; i++){
-    xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(mc_comm_pattern_t), NULL);
+    xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(mc_comm_pattern_t), nullptr);
     xbt_dynar_insert_at(incomplete_communications_pattern, i, &process_pattern);
   }
 
@@ -338,12 +338,12 @@ static void MC_pre_modelcheck_comm_determinism(void)
 static int MC_modelcheck_comm_determinism_main(void)
 {
 
-  char *req_str = NULL;
+  char *req_str = nullptr;
   int value;
-  mc_visited_state_t visited_state = NULL;
-  smx_simcall_t req = NULL;
-  smx_process_t process = NULL;
-  mc_state_t state = NULL, next_state = NULL;
+  mc_visited_state_t visited_state = nullptr;
+  smx_simcall_t req = nullptr;
+  smx_process_t process = nullptr;
+  mc_state_t state = nullptr, next_state = NULL;
 
   while (xbt_fifo_size(mc_stack) > 0) {
 
@@ -360,13 +360,13 @@ static int MC_modelcheck_comm_determinism_main(void)
 
     if ((xbt_fifo_size(mc_stack) <= _sg_mc_max_depth)
         && (req = MC_state_get_request(state, &value))
-        && (visited_state == NULL)) {
+        && (visited_state == nullptr)) {
 
       req_str = MC_request_to_string(req, value, MC_REQUEST_SIMIX);
       XBT_DEBUG("Execute: %s", req_str);
       xbt_free(req_str);
       
-      if (dot_output != NULL) {
+      if (dot_output != nullptr) {
         req_str = MC_request_get_dot_output(req, value);
       }
 
@@ -385,7 +385,7 @@ static int MC_modelcheck_comm_determinism_main(void)
       if(!initial_global_state->initial_communications_pattern_done)
         MC_handle_comm_pattern(call, req, value, initial_communications_pattern, 0);
       else
-        MC_handle_comm_pattern(call, req, value, NULL, 0);
+        MC_handle_comm_pattern(call, req, value, nullptr, 0);
 
       /* Wait for requests (schedules processes) */
       mc_model_checker->wait_for_requests();
@@ -393,7 +393,7 @@ static int MC_modelcheck_comm_determinism_main(void)
       /* Create the new expanded state */
       next_state = MC_state_new();
 
-      if ((visited_state = is_visited_state(next_state)) == NULL) {
+      if ((visited_state = is_visited_state(next_state)) == nullptr) {
 
         /* Get enabled processes and insert them in the interleave set of the next state */
         MC_EACH_SIMIX_PROCESS(process,
@@ -402,26 +402,26 @@ static int MC_modelcheck_comm_determinism_main(void)
           }
         );
 
-        if (dot_output != NULL)
+        if (dot_output != nullptr)
           fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num,  next_state->num, req_str);
 
       } else {
 
-        if (dot_output != NULL)
+        if (dot_output != nullptr)
           fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str);
 
       }
 
       xbt_fifo_unshift(mc_stack, next_state);
 
-      if (dot_output != NULL)
+      if (dot_output != nullptr)
         xbt_free(req_str);
 
     } else {
 
       if (xbt_fifo_size(mc_stack) > _sg_mc_max_depth) {
         XBT_WARN("/!\\ Max depth reached ! /!\\ ");
-      } else if (visited_state != NULL) {
+      } else if (visited_state != nullptr) {
         XBT_DEBUG("State already visited (equal to state %d), exploration stopped on this path.", visited_state->other_num == -1 ? visited_state->num : visited_state->other_num);
       } else {
         XBT_DEBUG("There are no more processes to interleave. (depth %d)", xbt_fifo_size(mc_stack));
@@ -435,15 +435,15 @@ static int MC_modelcheck_comm_determinism_main(void)
       MC_state_delete(state, !state->in_visited_states ? 1 : 0);
       XBT_DEBUG("Delete state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1);
 
-      visited_state = NULL;
+      visited_state = nullptr;
 
       /* Check for deadlocks */
       if (MC_deadlock_check()) {
-        MC_show_deadlock(NULL);
+        MC_show_deadlock(nullptr);
         return SIMGRID_MC_EXIT_DEADLOCK;
       }
 
-      while ((state = (mc_state_t) xbt_fifo_shift(mc_stack)) != NULL) {
+      while ((state = (mc_state_t) xbt_fifo_shift(mc_stack)) != nullptr) {
         if (MC_state_interleave_size(state) && xbt_fifo_size(mc_stack) < _sg_mc_max_depth) {
           /* We found a back-tracking point, let's loop */
           XBT_DEBUG("Back-tracking to state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1);
@@ -487,8 +487,8 @@ int MC_modelcheck_comm_determinism(void)
   initial_global_state->initial_communications_pattern_done = 0;
   initial_global_state->recv_deterministic = 1;
   initial_global_state->send_deterministic = 1;
-  initial_global_state->recv_diff = NULL;
-  initial_global_state->send_diff = NULL;
+  initial_global_state->recv_diff = nullptr;
+  initial_global_state->send_diff = nullptr;
 
   return MC_modelcheck_comm_determinism_main();
 }
index d29df34..857bee8 100644 (file)
@@ -28,11 +28,11 @@ mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm)
   res->comm_addr = comm->comm_addr;
   res->rdv = xbt_strdup(comm->rdv);
   res->data_size = -1;
-  res->data = NULL;
+  res->data = nullptr;
   if (comm->type == SIMIX_COMM_SEND) {
     res->src_proc = comm->src_proc;
     res->src_host = comm->src_host;
-    if (comm->data != NULL) {
+    if (comm->data != nullptr) {
       res->data_size = comm->data_size;
       res->data = xbt_malloc0(comm->data_size);
       memcpy(res->data, comm->data, comm->data_size);
@@ -100,7 +100,7 @@ void MC_state_copy_incomplete_communications_pattern(mc_state_t state)
 
 void MC_state_copy_index_communications_pattern(mc_state_t state)
 {
-  state->index_comm = xbt_dynar_new(sizeof(unsigned int), NULL);
+  state->index_comm = xbt_dynar_new(sizeof(unsigned int), nullptr);
   mc_list_comm_pattern_t list_process_comm;
   unsigned int cursor;
   xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm){
@@ -123,7 +123,7 @@ void MC_handle_comm_pattern(
   case MC_CALL_TYPE_WAIT:
   case MC_CALL_TYPE_WAITANY:
     {
-      smx_synchro_t comm_addr = NULL;
+      smx_synchro_t comm_addr = nullptr;
       if (call_type == MC_CALL_TYPE_WAIT)
         comm_addr = simcall_comm_wait__get__comm(req);
       else
@@ -145,14 +145,14 @@ void MC_comm_pattern_free(mc_comm_pattern_t p)
   xbt_free(p->rdv);
   xbt_free(p->data);
   xbt_free(p);
-  p = NULL;
+  p = nullptr;
 }
 
 static void MC_list_comm_pattern_free(mc_list_comm_pattern_t l)
 {
   xbt_dynar_free(&(l->list));
   xbt_free(l);
-  l = NULL;
+  l = nullptr;
 }
 
 void MC_comm_pattern_free_voidp(void *p)
index ca498ee..4c1e7df 100644 (file)
@@ -156,9 +156,9 @@ static int compare_areas_with_type(ComparisonState& state,
       return (addr_pointed1 != addr_pointed2);
     } else {
 
-      if (addr_pointed1 == NULL && addr_pointed2 == NULL)
+      if (addr_pointed1 == nullptr && addr_pointed2 == NULL)
         return 0;
-      if (addr_pointed1 == NULL || addr_pointed2 == NULL)
+      if (addr_pointed1 == nullptr || addr_pointed2 == NULL)
         return 1;
       if (!state.compared_pointers.insert(
           std::make_pair(addr_pointed1, addr_pointed2)).second)
@@ -179,7 +179,7 @@ static int compare_areas_with_type(ComparisonState& state,
           return 1;
         // The pointers are both in the heap:
         return compare_heap_area(process_index, addr_pointed1, addr_pointed2, snapshot1,
-                                 snapshot2, NULL, type->subtype, pointer_level);
+                                 snapshot2, nullptr, type->subtype, pointer_level);
       }
 
       // The pointers are both in the current object R/W segment:
index 09a1214..cae5320 100644 (file)
@@ -52,11 +52,11 @@ int _sg_mc_checkpoint = 0;
 int _sg_mc_sparse_checkpoint = 0;
 int _sg_mc_soft_dirty = 0;
 int _sg_mc_ksm = 0;
-char *_sg_mc_property_file = NULL;
+char *_sg_mc_property_file = nullptr;
 int _sg_mc_hash = 0;
 int _sg_mc_max_depth = 1000;
 int _sg_mc_visited = 0;
-char *_sg_mc_dot_output_file = NULL;
+char *_sg_mc_dot_output_file = nullptr;
 int _sg_mc_comms_determinism = 0;
 int _sg_mc_send_determinism = 0;
 int _sg_mc_safety = 0;
index 17f3569..1490675 100644 (file)
@@ -53,7 +53,7 @@ static __thread struct s_mc_diff *mc_diff_info = nullptr;
 static void heap_area_pair_free(heap_area_pair_t pair)
 {
   xbt_free(pair);
-  pair = NULL;
+  pair = nullptr;
 }
 
 static void heap_area_pair_free_voidp(void *d)
@@ -64,7 +64,7 @@ static void heap_area_pair_free_voidp(void *d)
 static void heap_area_free(heap_area_t area)
 {
   xbt_free(area);
-  area = NULL;
+  area = nullptr;
 }
 
 /************************************************************************************/
@@ -101,7 +101,7 @@ static int add_heap_area_pair(xbt_dynar_t list, int block1, int fragment1,
 {
 
   if (is_new_heap_area_pair(list, block1, fragment1, block2, fragment2)) {
-    heap_area_pair_t pair = NULL;
+    heap_area_pair_t pair = nullptr;
     pair = xbt_new0(s_heap_area_pair_t, 1);
     pair->block1 = block1;
     pair->fragment1 = fragment1;
@@ -226,12 +226,12 @@ int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2,
                           std::vector<simgrid::mc::IgnoredHeapRegion>* i1,
                           std::vector<simgrid::mc::IgnoredHeapRegion>* i2)
 {
-  if (mc_diff_info == NULL) {
+  if (mc_diff_info == nullptr) {
     mc_diff_info = xbt_new0(struct s_mc_diff, 1);
-    mc_diff_info->equals_to1 = NULL;
-    mc_diff_info->equals_to2 = NULL;
-    mc_diff_info->types1 = NULL;
-    mc_diff_info->types2 = NULL;
+    mc_diff_info->equals_to1 = nullptr;
+    mc_diff_info->equals_to2 = nullptr;
+    mc_diff_info->types1 = nullptr;
+    mc_diff_info->types2 = nullptr;
   }
   struct s_mc_diff *state = mc_diff_info;
 
@@ -385,7 +385,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
 
           res_compare =
               compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
-                                NULL, NULL, 0);
+                                nullptr, NULL, 0);
 
           if (res_compare != 1) {
             for (k = 1; k < heapinfo2->busy_block.size; k++)
@@ -424,7 +424,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
 
         res_compare =
             compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
-                              NULL, NULL, 0);
+                              nullptr, NULL, 0);
 
         if (res_compare != 1) {
           for (k = 1; k < heapinfo2b->busy_block.size; k++)
@@ -476,7 +476,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
 
             res_compare =
                 compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot1, snapshot2,
-                                  NULL, NULL, 0);
+                                  nullptr, NULL, 0);
 
             if (res_compare != 1)
               equal = 1;
@@ -524,7 +524,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
 
             res_compare =
                 compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot2, snapshot2,
-                                  NULL, NULL, 0);
+                                  nullptr, NULL, 0);
 
             if (res_compare != 1) {
               equal = 1;
@@ -714,7 +714,7 @@ static int compare_heap_area_without_type(struct s_mc_diff *state, int process_i
         // Both addreses are in the heap:
         res_compare =
             compare_heap_area(process_index, addr_pointed1, addr_pointed2, snapshot1,
-                              snapshot2, previous, NULL, 0);
+                              snapshot2, previous, nullptr, 0);
         if (res_compare == 1) {
           return res_compare;
         }
@@ -980,7 +980,7 @@ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::
       if (area_size > type->byte_size && area_size % type->byte_size == 0)
         return type;
       else
-        return NULL;
+        return nullptr;
     } else {
       for(simgrid::mc::Member& member : type->members) {
 
@@ -996,12 +996,12 @@ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::
         }
 
       }
-      return NULL;
+      return nullptr;
     }
     break;
   default:
     /* FIXME : other cases ? */
-    return NULL;
+    return nullptr;
     break;
   }
 }
@@ -1012,7 +1012,7 @@ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::
  * @param area2          Process address for state 2
  * @param snapshot1      Snapshot of state 1
  * @param snapshot2      Snapshot of state 2
- * @param previous       Pairs of blocks already compared on the current path (or NULL)
+ * @param previous       Pairs of blocks already compared on the current path (or nullptr)
  * @param type_id        Type of variable
  * @param pointer_level
  * @return 0 (same), 1 (different), -1
@@ -1034,7 +1034,7 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, m
   int type_size = -1;
   int offset1 = 0, offset2 = 0;
   int new_size1 = -1, new_size2 = -1;
-  simgrid::mc::Type *new_type1 = NULL, *new_type2 = NULL;
+  simgrid::mc::Type *new_type1 = nullptr, *new_type2 = NULL;
 
   int match_pairs = 0;
 
@@ -1048,7 +1048,7 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, m
 
   malloc_info heapinfo_temp1, heapinfo_temp2;
 
-  if (previous == NULL) {
+  if (previous == nullptr) {
     previous =
         xbt_dynar_new(sizeof(heap_area_pair_t), heap_area_pair_free_voidp);
     match_pairs = 1;
@@ -1093,7 +1093,7 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, m
       type = type->full_type;
 
     // This assume that for "boring" types (volatile ...) byte_size is absent:
-    while (type->byte_size == 0 && type->subtype != NULL)
+    while (type->byte_size == 0 && type->subtype != nullptr)
       type = type->subtype;
 
     // Find type_size:
@@ -1184,10 +1184,10 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, m
 
     // Remember (basic) type inference.
     // The current data structure only allows us to do this for the whole block.
-    if (type != NULL && area1 == real_addr_block1) {
+    if (type != nullptr && area1 == real_addr_block1) {
       state->types1_(block1, 0) = type;
     }
-    if (type != NULL && area2 == real_addr_block2) {
+    if (type != nullptr && area2 == real_addr_block2) {
       state->types2_(block2, 0) = type;
     }
 
@@ -1277,10 +1277,10 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, m
 
     // Remember (basic) type inference.
     // The current data structure only allows us to do this for the whole fragment.
-    if (type != NULL && area1 == real_addr_frag1) {
+    if (type != nullptr && area1 == real_addr_frag1) {
       state->types1_(block1, frag1) = type;
     }
-    if (type != NULL && area2 == real_addr_frag2) {
+    if (type != nullptr && area2 == real_addr_frag2) {
       state->types2_(block2, frag2) = type;
     }
     // The type of the variable is already known:
@@ -1289,28 +1289,28 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, m
       new_type2 = type;
     }
     // Type inference from the block type.
-    else if (state->types1_(block1, frag1) != NULL
-             || state->types2_(block2, frag2) != NULL) {
+    else if (state->types1_(block1, frag1) != nullptr
+             || state->types2_(block2, frag2) != nullptr) {
 
       offset1 = (char *) area1 - (char *) real_addr_frag1;
       offset2 = (char *) area2 - (char *) real_addr_frag2;
 
-      if (state->types1_(block1, frag1) != NULL
-          && state->types2_(block2, frag2) != NULL) {
+      if (state->types1_(block1, frag1) != nullptr
+          && state->types2_(block2, frag2) != nullptr) {
         new_type1 =
             get_offset_type(real_addr_frag1, state->types1_(block1, frag1),
                             offset1, size, snapshot1, process_index);
         new_type2 =
             get_offset_type(real_addr_frag2, state->types2_(block2, frag2),
                             offset1, size, snapshot2, process_index);
-      } else if (state->types1_(block1, frag1) != NULL) {
+      } else if (state->types1_(block1, frag1) != nullptr) {
         new_type1 =
             get_offset_type(real_addr_frag1, state->types1_(block1, frag1),
                             offset1, size, snapshot1, process_index);
         new_type2 =
             get_offset_type(real_addr_frag2, state->types1_(block1, frag1),
                             offset2, size, snapshot2, process_index);
-      } else if (state->types2_(block2, frag2) != NULL) {
+      } else if (state->types2_(block2, frag2) != nullptr) {
         new_type1 =
             get_offset_type(real_addr_frag1, state->types2_(block2, frag2),
                             offset1, size, snapshot1, process_index);
@@ -1325,15 +1325,15 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, m
         return -1;
       }
 
-      if (new_type1 != NULL && new_type2 != NULL && new_type1 != new_type2) {
+      if (new_type1 != nullptr && new_type2 != NULL && new_type1 != new_type2) {
 
         type = new_type1;
-        while (type->byte_size == 0 && type->subtype != NULL)
+        while (type->byte_size == 0 && type->subtype != nullptr)
           type = type->subtype;
         new_size1 = type->byte_size;
 
         type = new_type2;
-        while (type->byte_size == 0 && type->subtype != NULL)
+        while (type->byte_size == 0 && type->subtype != nullptr)
           type = type->subtype;
         new_size2 = type->byte_size;
 
@@ -1458,7 +1458,7 @@ int mmalloc_linear_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2)
 
   struct s_mc_diff *state = mc_diff_info;
 
-  if (heap1 == NULL && heap1 == NULL) {
+  if (heap1 == nullptr && heap1 == NULL) {
     XBT_DEBUG("Malloc descriptors null");
     return 0;
   }
index 54d49c6..38c7d3a 100644 (file)
@@ -100,7 +100,7 @@ static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, D
 /** \brief Get the DW_TAG_type of the DIE
  *
  *  \param die DIE
- *  \return DW_TAG_type attribute as a new string (NULL if none)
+ *  \return DW_TAG_type attribute as a new string (nullptr if none)
  */
 static std::uint64_t MC_dwarf_at_type(Dwarf_Die * die);
 
@@ -258,7 +258,7 @@ static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die,
 {
   Dwarf_Attribute attr;
   if (!dwarf_attr_integrate(die, attribute, &attr)) {
-    return NULL;
+    return nullptr;
   } else {
     return dwarf_formstring(&attr);
   }
@@ -272,7 +272,7 @@ static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die,
  *  DW_AT_MIPS_linkage_name is used (at least by GCC).
  *
  *  \param  the DIE
- *  \return linkage name of the given DIE (or NULL)
+ *  \return linkage name of the given DIE (or nullptr)
  * */
 static const char *MC_dwarf_at_linkage_name(Dwarf_Die * die)
 {
@@ -289,7 +289,7 @@ static Dwarf_Off MC_dwarf_attr_dieoffset(Dwarf_Die * die, int attribute)
     return 0;
   dwarf_attr_integrate(die, attribute, &attr);
   Dwarf_Die subtype_die;
-  if (dwarf_formref_die(&attr, &subtype_die) == NULL)
+  if (dwarf_formref_die(&attr, &subtype_die) == nullptr)
     xbt_die("Could not find DIE");
   return dwarf_dieoffset(&subtype_die);
 }
@@ -302,7 +302,7 @@ static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die * die,
     return 0;
   dwarf_attr_integrate(die, DW_AT_type, &attr);
   Dwarf_Die subtype_die;
-  if (dwarf_formref_die(&attr, &subtype_die) == NULL)
+  if (dwarf_formref_die(&attr, &subtype_die) == nullptr)
     xbt_die("Could not find DIE");
   return dwarf_dieoffset(&subtype_die);
 }
@@ -310,7 +310,7 @@ static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die * die,
 /** \brief Find the type/subtype (DW_AT_type) for a DIE
  *
  *  \param dit the DIE
- *  \return DW_AT_type reference as a global offset in hexadecimal (or NULL)
+ *  \return DW_AT_type reference as a global offset in hexadecimal (or nullptr)
  */
 static
 std::uint64_t MC_dwarf_at_type(Dwarf_Die * die)
@@ -321,7 +321,7 @@ std::uint64_t MC_dwarf_at_type(Dwarf_Die * die)
 static uint64_t MC_dwarf_attr_integrate_addr(Dwarf_Die * die, int attribute)
 {
   Dwarf_Attribute attr;
-  if (dwarf_attr_integrate(die, attribute, &attr) == NULL)
+  if (dwarf_attr_integrate(die, attribute, &attr) == nullptr)
     return 0;
   Dwarf_Addr value;
   if (dwarf_formaddr(&attr, &value) == 0)
@@ -334,7 +334,7 @@ static uint64_t MC_dwarf_attr_integrate_uint(Dwarf_Die * die, int attribute,
                                              uint64_t default_value)
 {
   Dwarf_Attribute attr;
-  if (dwarf_attr_integrate(die, attribute, &attr) == NULL)
+  if (dwarf_attr_integrate(die, attribute, &attr) == nullptr)
     return default_value;
   Dwarf_Word value;
   return dwarf_formudata(dwarf_attr_integrate(die, attribute, &attr),
@@ -631,7 +631,7 @@ static simgrid::mc::Type MC_dwarf_die_to_type(
   }
 
   const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
-  if (name != NULL) {
+  if (name != nullptr) {
     char* full_name = ns ? bprintf("%s%s::%s", prefix, ns, name) :
       bprintf("%s%s", prefix, name);
     type.name = std::string(full_name);
@@ -672,7 +672,7 @@ static simgrid::mc::Type MC_dwarf_die_to_type(
   case DW_TAG_union_type:
   case DW_TAG_class_type:
     MC_dwarf_add_members(info, die, unit, &type);
-    char *new_ns = ns == NULL ? xbt_strdup(type.name.c_str())
+    char *new_ns = ns == nullptr ? xbt_strdup(type.name.c_str())
         : bprintf("%s::%s", ns, name);
     MC_dwarf_handle_children(info, die, unit, frame, new_ns);
     free(new_ns);
@@ -708,14 +708,14 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
     return nullptr;
 
   Dwarf_Attribute attr_location;
-  if (dwarf_attr(die, DW_AT_location, &attr_location) == NULL)
+  if (dwarf_attr(die, DW_AT_location, &attr_location) == nullptr)
     // No location: do not add it ?
     return nullptr;
 
   std::unique_ptr<simgrid::mc::Variable> variable =
     std::unique_ptr<simgrid::mc::Variable>(new simgrid::mc::Variable());
   variable->dwarf_offset = dwarf_dieoffset(die);
-  variable->global = frame == NULL;     // Can be override base on DW_AT_location
+  variable->global = frame == nullptr;     // Can be override base on DW_AT_location
   variable->object_info = info;
 
   const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
@@ -790,7 +790,7 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
     default:
       xbt_die
           ("Unhandled form 0x%x, class 0x%X for DW_AT_start_scope of variable %s",
-           form, (int) form_class, name == NULL ? "?" : name);
+           form, (int) form_class, name == nullptr ? "?" : name);
     }
   }
 
@@ -927,7 +927,7 @@ static void mc_dwarf_handle_namespace_die(simgrid::mc::ObjectInformation* info,
   const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
   if (frame)
     xbt_die("Unexpected namespace in a subprogram");
-  char *new_ns = ns == NULL ? xbt_strdup(name)
+  char *new_ns = ns == nullptr ? xbt_strdup(name)
       : bprintf("%s::%s", ns, name);
   MC_dwarf_handle_children(info, die, unit, frame, new_ns);
   xbt_free(new_ns);
@@ -1005,7 +1005,7 @@ void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
   if (fd < 0)
     xbt_die("Could not open file %s", info->file_name.c_str());
   Dwarf *dwarf = dwarf_begin(fd, DWARF_C_READ);
-  if (dwarf == NULL)
+  if (dwarf == nullptr)
     xbt_die("Missing debugging information in %s\n"
       "Your program and its dependencies must have debugging information.\n"
       "You might want to recompile with -g or install the suitable debugging package.\n",
@@ -1020,11 +1020,11 @@ void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
   Dwarf_Off next_offset = 0;
   size_t length;
 
-  while (dwarf_nextcu(dwarf, offset, &next_offset, &length, NULL, NULL, NULL) ==
+  while (dwarf_nextcu(dwarf, offset, &next_offset, &length, nullptr, NULL, NULL) ==
          0) {
     Dwarf_Die unit_die;
-    if (dwarf_offdie(dwarf, offset + length, &unit_die) != NULL)
-      MC_dwarf_handle_children(info, &unit_die, &unit_die, NULL, NULL);
+    if (dwarf_offdie(dwarf, offset + length, &unit_die) != nullptr)
+      MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, NULL);
     offset = next_offset;
   }
 
index 6b9b8e7..da49931 100644 (file)
@@ -47,24 +47,24 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc,
 
 e_mc_mode_t mc_mode;
 
-double *mc_time = NULL;
+double *mc_time = nullptr;
 
 #ifdef HAVE_MC
 int user_max_depth_reached = 0;
 
 /* MC global data structures */
-mc_state_t mc_current_state = NULL;
+mc_state_t mc_current_state = nullptr;
 char mc_replay_mode = FALSE;
 
-mc_stats_t mc_stats = NULL;
-mc_global_t initial_global_state = NULL;
-xbt_fifo_t mc_stack = NULL;
+mc_stats_t mc_stats = nullptr;
+mc_global_t initial_global_state = nullptr;
+xbt_fifo_t mc_stack = nullptr;
 
 /* Liveness */
-xbt_automaton_t _mc_property_automaton = NULL;
+xbt_automaton_t _mc_property_automaton = nullptr;
 
 /* Dot output */
-FILE *dot_output = NULL;
+FILE *dot_output = nullptr;
 const char *colors[13];
 
 
@@ -90,7 +90,7 @@ void MC_init_dot_output()
 
   dot_output = fopen(_sg_mc_dot_output_file, "w");
 
-  if (dot_output == NULL) {
+  if (dot_output == nullptr) {
     perror("Error open dot output file");
     xbt_abort();
   }
@@ -186,7 +186,7 @@ void MC_replay(xbt_fifo_t stack)
 {
   int value, count = 1;
   char *req_str;
-  smx_simcall_t req = NULL, saved_req = NULL;
+  smx_simcall_t req = nullptr, saved_req = NULL;
   xbt_fifo_item_t item, start_item;
   mc_state_t state;
   
@@ -253,7 +253,7 @@ void MC_replay(xbt_fifo_t stack)
       MC_simcall_handle(req, value);
 
       if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
-        MC_handle_comm_pattern(call, req, value, NULL, 1);
+        MC_handle_comm_pattern(call, req, value, nullptr, 1);
 
       mc_model_checker->wait_for_requests();
 
@@ -272,9 +272,9 @@ void MC_replay(xbt_fifo_t stack)
 void MC_replay_liveness(xbt_fifo_t stack)
 {
   xbt_fifo_item_t item;
-  mc_pair_t pair = NULL;
-  mc_state_t state = NULL;
-  smx_simcall_t req = NULL, saved_req = NULL;
+  mc_pair_t pair = nullptr;
+  mc_state_t state = nullptr;
+  smx_simcall_t req = nullptr, saved_req = NULL;
   int value, depth = 1;
   char *req_str;
 
@@ -306,7 +306,7 @@ void MC_replay_liveness(xbt_fifo_t stack)
 
         saved_req = MC_state_get_executed_request(state, &value);
 
-        if (saved_req != NULL) {
+        if (saved_req != nullptr) {
           /* because we got a copy of the executed request, we have to fetch the
              real one, pointed by the request field of the issuer process */
           const smx_process_t issuer = MC_smx_simcall_get_issuer(saved_req);
@@ -347,7 +347,7 @@ void MC_dump_stack_safety(xbt_fifo_t stack)
   
   mc_state_t state;
 
-  while ((state = (mc_state_t) xbt_fifo_pop(stack)) != NULL)
+  while ((state = (mc_state_t) xbt_fifo_pop(stack)) != nullptr)
     MC_state_delete(state, !state->in_visited_states ? 1 : 0);
 }
 
@@ -358,7 +358,7 @@ void MC_show_stack_safety(xbt_fifo_t stack)
   mc_state_t state;
   xbt_fifo_item_t item;
   smx_simcall_t req;
-  char *req_str = NULL;
+  char *req_str = nullptr;
 
   for (item = xbt_fifo_get_last_item(stack);
        item; item = xbt_fifo_get_prev_item(item)) {
@@ -374,7 +374,7 @@ void MC_show_stack_safety(xbt_fifo_t stack)
 
 void MC_show_deadlock(smx_simcall_t req)
 {
-  /*char *req_str = NULL; */
+  /*char *req_str = nullptr; */
   XBT_INFO("**************************");
   XBT_INFO("*** DEAD-LOCK DETECTED ***");
   XBT_INFO("**************************");
@@ -403,7 +403,7 @@ void MC_show_stack_liveness(xbt_fifo_t stack)
   mc_pair_t pair;
   xbt_fifo_item_t item;
   smx_simcall_t req;
-  char *req_str = NULL;
+  char *req_str = nullptr;
 
   for (item = xbt_fifo_get_last_item(stack);
        item; item = xbt_fifo_get_prev_item(item)) {
@@ -421,7 +421,7 @@ void MC_show_stack_liveness(xbt_fifo_t stack)
 void MC_dump_stack_liveness(xbt_fifo_t stack)
 {
   mc_pair_t pair;
-  while ((pair = (mc_pair_t) xbt_fifo_pop(stack)) != NULL)
+  while ((pair = (mc_pair_t) xbt_fifo_pop(stack)) != nullptr)
     MC_pair_delete(pair);
 }
 
@@ -449,11 +449,11 @@ void MC_print_statistics(mc_stats_t stats)
     XBT_INFO("Visited pairs = %lu", stats->visited_pairs);
   }
   XBT_INFO("Executed transitions = %lu", stats->executed_transitions);
-  if ((_sg_mc_dot_output_file != NULL) && (_sg_mc_dot_output_file[0] != '\0')) {
+  if ((_sg_mc_dot_output_file != nullptr) && (_sg_mc_dot_output_file[0] != '\0')) {
     fprintf(dot_output, "}\n");
     fclose(dot_output);
   }
-  if (initial_global_state != NULL && (_sg_mc_comms_determinism || _sg_mc_send_determinism)) {
+  if (initial_global_state != nullptr && (_sg_mc_comms_determinism || _sg_mc_send_determinism)) {
     XBT_INFO("Send-deterministic : %s", !initial_global_state->send_deterministic ? "No" : "Yes");
     if (_sg_mc_comms_determinism)
       XBT_INFO("Recv-deterministic : %s", !initial_global_state->recv_deterministic ? "No" : "Yes");
@@ -466,7 +466,7 @@ void MC_print_statistics(mc_stats_t stats)
 
 void MC_automaton_load(const char *file)
 {
-  if (_mc_property_automaton == NULL)
+  if (_mc_property_automaton == nullptr)
     _mc_property_automaton = xbt_automaton_new();
 
   xbt_automaton_load(_mc_property_automaton, file);
@@ -510,7 +510,7 @@ static void MC_dump_stacks(FILE* file)
 double MC_process_clock_get(smx_process_t process)
 {
   if (mc_time) {
-    if (process != NULL)
+    if (process != nullptr)
       return mc_time[process->pid];
     else
       return -1;
index 73995fa..84e996d 100644 (file)
@@ -41,8 +41,8 @@ xbt_parmap_t parmap;
 static xbt_dynar_t get_atomic_propositions_values()
 {
   unsigned int cursor = 0;
-  xbt_automaton_propositional_symbol_t ps = NULL;
-  xbt_dynar_t values = xbt_dynar_new(sizeof(int), NULL);
+  xbt_automaton_propositional_symbol_t ps = nullptr;
+  xbt_dynar_t values = xbt_dynar_new(sizeof(int), nullptr);
   xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps) {
     int res = xbt_automaton_propositional_symbol_evaluate(ps);
     xbt_dynar_push_as(values, int, res);
@@ -53,7 +53,7 @@ static xbt_dynar_t get_atomic_propositions_values()
 
 static mc_visited_pair_t is_reached_acceptance_pair(mc_pair_t pair)
 {
-  mc_visited_pair_t new_pair = NULL;
+  mc_visited_pair_t new_pair = nullptr;
   new_pair = MC_visited_pair_new(pair->num, pair->automaton_state, pair->atomic_propositions, pair->graph_state);
   new_pair->acceptance_pair = 1;
 
@@ -87,9 +87,9 @@ static mc_visited_pair_t is_reached_acceptance_pair(mc_pair_t pair)
               if (snapshot_compare(pair_test, new_pair) == 0) {
                 XBT_INFO("Pair %d already reached (equal to pair %d) !", new_pair->num, pair_test->num);
                 xbt_fifo_shift(mc_stack);
-                if (dot_output != NULL)
+                if (dot_output != nullptr)
                   fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, pair_test->num, initial_global_state->prev_req);
-                return NULL;
+                return nullptr;
               }
             }
           }
@@ -115,7 +115,7 @@ static mc_visited_pair_t is_reached_acceptance_pair(mc_pair_t pair)
 static void remove_acceptance_pair(int pair_num)
 {
   unsigned int cursor = 0;
-  mc_visited_pair_t pair_test = NULL;
+  mc_visited_pair_t pair_test = nullptr;
   int pair_found = 0;
 
   xbt_dynar_foreach(acceptance_pairs, cursor, pair_test) {
@@ -158,7 +158,7 @@ static int MC_automaton_evaluate_label(xbt_automaton_exp_label_t l,
     }
   case 3:{
       unsigned int cursor = 0;
-      xbt_automaton_propositional_symbol_t p = NULL;
+      xbt_automaton_propositional_symbol_t p = nullptr;
       xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, p) {
         if (std::strcmp(xbt_automaton_propositional_symbol_get_name(p), l->u.predicat) == 0)
           return (int) xbt_dynar_get_as(atomic_propositions_values, cursor, int);
@@ -177,14 +177,14 @@ static int MC_modelcheck_liveness_main(void);
 
 static void MC_pre_modelcheck_liveness(void)
 {
-  mc_pair_t initial_pair = NULL;
+  mc_pair_t initial_pair = nullptr;
   smx_process_t process;
 
   mc_model_checker->wait_for_requests();
 
-  acceptance_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), NULL);
+  acceptance_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), nullptr);
   if(_sg_mc_visited > 0)
-    visited_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), NULL);
+    visited_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), nullptr);
 
   initial_global_state->snapshot = simgrid::mc::take_snapshot(0);
   initial_global_state->prev_pair = 0;
@@ -218,15 +218,15 @@ static void MC_pre_modelcheck_liveness(void)
 
 static int MC_modelcheck_liveness_main(void)
 {
-  smx_process_t process = NULL;
-  mc_pair_t current_pair = NULL;
+  smx_process_t process = nullptr;
+  mc_pair_t current_pair = nullptr;
   int value, res, visited_num = -1;
-  smx_simcall_t req = NULL;
-  xbt_automaton_transition_t transition_succ = NULL;
+  smx_simcall_t req = nullptr;
+  xbt_automaton_transition_t transition_succ = nullptr;
   int cursor = 0;
-  mc_pair_t next_pair = NULL;
-  xbt_dynar_t prop_values = NULL;
-  mc_visited_pair_t reached_pair = NULL;
+  mc_pair_t next_pair = nullptr;
+  xbt_dynar_t prop_values = nullptr;
+  mc_visited_pair_t reached_pair = nullptr;
   
   while(xbt_fifo_size(mc_stack) > 0){
 
@@ -245,7 +245,7 @@ static int MC_modelcheck_liveness_main(void)
 
       if (current_pair->automaton_state->type == 1 && current_pair->exploration_started == 0) {
         /* If new acceptance pair, return new pair */
-        if ((reached_pair = is_reached_acceptance_pair(current_pair)) == NULL) {
+        if ((reached_pair = is_reached_acceptance_pair(current_pair)) == nullptr) {
           int counter_example_depth = current_pair->depth;
           XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
           XBT_INFO("|             ACCEPTANCE CYCLE            |");
@@ -263,7 +263,7 @@ static int MC_modelcheck_liveness_main(void)
       /* Pair already visited ? stop the exploration on the current path */
       if ((current_pair->exploration_started == 0) && (visited_num = is_visited_pair(reached_pair, current_pair)) != -1) {
 
-        if (dot_output != NULL){
+        if (dot_output != nullptr){
           fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, visited_num, initial_global_state->prev_req);
           fflush(dot_output);
         }
@@ -276,7 +276,7 @@ static int MC_modelcheck_liveness_main(void)
 
         req = MC_state_get_request(current_pair->graph_state, &value);
 
-         if (dot_output != NULL) {
+         if (dot_output != nullptr) {
            if (initial_global_state->prev_pair != 0 && initial_global_state->prev_pair != current_pair->num) {
              fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, current_pair->num, initial_global_state->prev_req);
              xbt_free(initial_global_state->prev_req);
@@ -355,7 +355,7 @@ static int MC_modelcheck_liveness_main(void)
     
       /* Traverse the stack backwards until a pair with a non empty interleave
          set is found, deleting all the pairs that have it empty in the way. */
-      while ((current_pair = (mc_pair_t) xbt_fifo_shift(mc_stack)) != NULL) {
+      while ((current_pair = (mc_pair_t) xbt_fifo_shift(mc_stack)) != nullptr) {
         if (current_pair->requests > 0) {
           /* We found a backtracking point */
           XBT_DEBUG("Backtracking to depth %d", current_pair->depth);
index a6f7e6d..8ce5366 100644 (file)
@@ -16,7 +16,7 @@ namespace dwarf {
  * @param object   Process address of the struct/class
  * @param type     Type of the struct/class
  * @param member   Member description
- * @param snapshot Snapshot (or NULL)
+ * @param snapshot Snapshot (or nullptr)
  * @return Process address of the given member of the 'object' struct/class
  */
 void *resolve_member(
@@ -28,8 +28,8 @@ void *resolve_member(
     return ((char *) base) + member->offset();
 
   ExpressionContext state;
-  state.frame_base = NULL;
-  state.cursor = NULL;
+  state.frame_base = nullptr;
+  state.cursor = nullptr;
   state.address_space = address_space;
   state.process_index = process_index;
 
index dcbff99..21208f3 100644 (file)
@@ -11,7 +11,7 @@ extern "C" {
 
 mc_pair_t MC_pair_new()
 {
-  mc_pair_t p = NULL;
+  mc_pair_t p = nullptr;
   p = xbt_new0(s_mc_pair_t, 1);
   p->num = ++mc_stats->expanded_pairs;
   p->exploration_started = 0;
@@ -22,12 +22,12 @@ mc_pair_t MC_pair_new()
 
 void MC_pair_delete(mc_pair_t p)
 {
-  p->automaton_state = NULL;
+  p->automaton_state = nullptr;
   if(p->visited_pair_removed)
     MC_state_delete(p->graph_state, 1);
   xbt_dynar_free(&(p->atomic_propositions));
   xbt_free(p);
-  p = NULL;
+  p = nullptr;
 }
 
 }
index cee8330..c0708c4 100644 (file)
@@ -106,13 +106,13 @@ int MC_request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
 
   if (r1->call == SIMCALL_COMM_WAIT
       && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
-      && (synchro1->comm.src_proc == NULL || synchro1->comm.dst_proc == NULL))
+      && (synchro1->comm.src_proc == nullptr || synchro1->comm.dst_proc == NULL))
     return FALSE;
 
   if (r1->call == SIMCALL_COMM_TEST &&
-      (simcall_comm_test__get__comm(r1) == NULL
-       || synchro1->comm.src_buff == NULL
-       || synchro1->comm.dst_buff == NULL))
+      (simcall_comm_test__get__comm(r1) == nullptr
+       || synchro1->comm.src_buff == nullptr
+       || synchro1->comm.dst_buff == nullptr))
     return FALSE;
 
   if (r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT
@@ -121,10 +121,10 @@ int MC_request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
     return FALSE;
 
   if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
-      && synchro1->comm.src_buff != NULL
-      && synchro1->comm.dst_buff != NULL
-      && synchro2->comm.src_buff != NULL
-      && synchro2->comm.dst_buff != NULL
+      && synchro1->comm.src_buff != nullptr
+      && synchro1->comm.dst_buff != nullptr
+      && synchro2->comm.src_buff != nullptr
+      && synchro2->comm.dst_buff != nullptr
       && synchro1->comm.dst_buff != synchro2->comm.src_buff
       && synchro1->comm.dst_buff != synchro2->comm.dst_buff
       && synchro2->comm.dst_buff != synchro1->comm.src_buff)
@@ -166,10 +166,10 @@ int MC_request_depend(smx_simcall_t r1, smx_simcall_t r2)
     if (synchro1->comm.src_buff == synchro2->comm.src_buff
         && synchro1->comm.dst_buff == synchro2->comm.dst_buff)
       return FALSE;
-    else if (synchro1->comm.src_buff != NULL
-        && synchro1->comm.dst_buff != NULL
-        && synchro2->comm.src_buff != NULL
-        && synchro2->comm.dst_buff != NULL
+    else if (synchro1->comm.src_buff != nullptr
+        && synchro1->comm.dst_buff != nullptr
+        && synchro2->comm.src_buff != nullptr
+        && synchro2->comm.dst_buff != nullptr
         && synchro1->comm.dst_buff != synchro2->comm.src_buff
         && synchro1->comm.dst_buff != synchro2->comm.dst_buff
         && synchro2->comm.dst_buff != synchro1->comm.src_buff)
@@ -213,8 +213,8 @@ char *MC_request_to_string(smx_simcall_t req, int value, e_mc_request_type_t req
     break;
   }
 
-  const char* type = NULL;
-  char *args = NULL;
+  const char* type = nullptr;
+  char *args = nullptr;
 
   smx_process_t issuer = MC_smx_simcall_get_issuer(req);
 
@@ -313,7 +313,7 @@ char *MC_request_to_string(smx_simcall_t req, int value, e_mc_request_type_t req
         act = remote_act;
 
     char* p;
-    if (act->comm.src_proc == NULL || act->comm.dst_proc == NULL) {
+    if (act->comm.src_proc == nullptr || act->comm.dst_proc == NULL) {
       type = "Test FALSE";
       p = pointer_to_string(remote_act);
       args = bprintf("comm=%s", p);
@@ -388,19 +388,19 @@ char *MC_request_to_string(smx_simcall_t req, int value, e_mc_request_type_t req
 
     args = bprintf("locked = %d, owner = %d, sleeping = %d",
       mutex.locked,
-      mutex.owner != NULL ? (int) MC_smx_resolve_process(mutex.owner)->pid : -1,
+      mutex.owner != nullptr ? (int) MC_smx_resolve_process(mutex.owner)->pid : -1,
       mutex_sleeping.count);
     break;
   }
 
   case SIMCALL_MC_SNAPSHOT:
     type = "MC_SNAPSHOT";
-    args = NULL;
+    args = nullptr;
     break;
 
   case SIMCALL_MC_COMPARE_SNAPSHOTS:
     type = "MC_COMPARE_SNAPSHOTS";
-    args = NULL;
+    args = nullptr;
     break;
 
   case SIMCALL_MC_RANDOM:
@@ -413,7 +413,7 @@ char *MC_request_to_string(smx_simcall_t req, int value, e_mc_request_type_t req
   }
 
   char* str;
-  if (args != NULL) {
+  if (args != nullptr) {
     str =
         bprintf("[(%lu)%s (%s)] %s(%s)", issuer->pid,
                 MC_smx_process_get_host_name(issuer),
@@ -451,7 +451,7 @@ unsigned int MC_request_testany_fail(smx_simcall_t req)
   for (cursor=0; cursor != comms.used; ++cursor) {
 
     // Get the element:
-    smx_synchro_t remote_action = NULL;
+    smx_synchro_t remote_action = nullptr;
     memcpy(&remote_action, buffer + comms.elmsize * cursor, sizeof(remote_action));
 
     // Dereference the pointer:
@@ -469,7 +469,7 @@ unsigned int MC_request_testany_fail(smx_simcall_t req)
 
 int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
 {
-  smx_synchro_t remote_act = NULL;
+  smx_synchro_t remote_act = nullptr;
   switch (req->call) {
 
   case SIMCALL_COMM_WAIT:
@@ -510,7 +510,7 @@ int MC_process_is_enabled(smx_process_t process)
 
 char *MC_request_get_dot_output(smx_simcall_t req, int value)
 {
-  char *label = NULL;
+  char *label = nullptr;
 
   const smx_process_t issuer = MC_smx_simcall_get_issuer(req);
 
@@ -569,7 +569,7 @@ char *MC_request_get_dot_output(smx_simcall_t req, int value)
     s_smx_synchro_t synchro;
     mc_model_checker->process().read_bytes(&synchro,
       sizeof(synchro), remote(remote_act));
-    if (synchro.comm.src_proc == NULL || synchro.comm.dst_proc == NULL) {
+    if (synchro.comm.src_proc == nullptr || synchro.comm.dst_proc == NULL) {
       if (issuer->host)
         label =
             bprintf("[(%lu)%s] Test FALSE", issuer->pid,
index 4beb1d5..f25f11c 100644 (file)
@@ -34,7 +34,7 @@ static int is_exploration_stack_state(mc_state_t current_state){
 
   xbt_fifo_item_t item;
   mc_state_t stack_state;
-  for(item = xbt_fifo_get_first_item(mc_stack); item != NULL; item = xbt_fifo_get_next_item(item)) {
+  for(item = xbt_fifo_get_first_item(mc_stack); item != nullptr; item = xbt_fifo_get_next_item(item)) {
     stack_state = (mc_state_t) xbt_fifo_get_item_content(item);
     if(snapshot_compare(stack_state, current_state) == 0){
       XBT_INFO("Non-progressive cycle : state %d -> state %d", stack_state->num, current_state->num);
@@ -83,12 +83,12 @@ int MC_modelcheck_safety(void)
 {
   MC_modelcheck_safety_init();
 
-  char *req_str = NULL;
+  char *req_str = nullptr;
   int value;
-  smx_simcall_t req = NULL;
-  mc_state_t state = NULL, prev_state = NULL, next_state = NULL;
-  xbt_fifo_item_t item = NULL;
-  mc_visited_state_t visited_state = NULL;
+  smx_simcall_t req = nullptr;
+  mc_state_t state = nullptr, prev_state = NULL, next_state = NULL;
+  xbt_fifo_item_t item = nullptr;
+  mc_visited_state_t visited_state = nullptr;
 
   while (xbt_fifo_size(mc_stack) > 0) {
 
@@ -107,13 +107,13 @@ int MC_modelcheck_safety(void)
     /* If there are processes to interleave and the maximum depth has not been reached
        then perform one step of the exploration algorithm */
     if (xbt_fifo_size(mc_stack) <= _sg_mc_max_depth && !user_max_depth_reached
-        && (req = MC_state_get_request(state, &value)) && visited_state == NULL) {
+        && (req = MC_state_get_request(state, &value)) && visited_state == nullptr) {
 
       req_str = MC_request_to_string(req, value, MC_REQUEST_SIMIX);
       XBT_DEBUG("Execute: %s", req_str);
       xbt_free(req_str);
 
-      if (dot_output != NULL) {
+      if (dot_output != nullptr) {
         req_str = MC_request_get_dot_output(req, value);
       }
 
@@ -135,10 +135,10 @@ int MC_modelcheck_safety(void)
           return SIMGRID_MC_EXIT_NON_TERMINATION;
       }
 
-      if ((visited_state = is_visited_state(next_state)) == NULL) {
+      if ((visited_state = is_visited_state(next_state)) == nullptr) {
 
         /* Get an enabled process and insert it in the interleave set of the next state */
-        smx_process_t process = NULL;
+        smx_process_t process = nullptr;
         MC_EACH_SIMIX_PROCESS(process,
           if (MC_process_is_enabled(process)) {
             MC_state_interleave_process(next_state, process);
@@ -147,19 +147,19 @@ int MC_modelcheck_safety(void)
           }
         );
 
-        if (dot_output != NULL)
+        if (dot_output != nullptr)
           std::fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, next_state->num, req_str);
 
       } else {
 
-        if (dot_output != NULL)
+        if (dot_output != nullptr)
           std::fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str);
 
       }
 
       xbt_fifo_unshift(mc_stack, next_state);
 
-      if (dot_output != NULL)
+      if (dot_output != nullptr)
         xbt_free(req_str);
 
       /* Let's loop again */
@@ -167,11 +167,11 @@ int MC_modelcheck_safety(void)
       /* The interleave set is empty or the maximum depth is reached, let's back-track */
     } else {
 
-      if ((xbt_fifo_size(mc_stack) > _sg_mc_max_depth) || user_max_depth_reached || visited_state != NULL) {
+      if ((xbt_fifo_size(mc_stack) > _sg_mc_max_depth) || user_max_depth_reached || visited_state != nullptr) {
 
-        if (user_max_depth_reached && visited_state == NULL)
+        if (user_max_depth_reached && visited_state == nullptr)
           XBT_DEBUG("User max depth reached !");
-        else if (visited_state == NULL)
+        else if (visited_state == nullptr)
           XBT_WARN("/!\\ Max depth reached ! /!\\ ");
         else
           XBT_DEBUG("State already visited (equal to state %d), exploration stopped on this path.", visited_state->other_num == -1 ? visited_state->num : visited_state->other_num);
@@ -187,11 +187,11 @@ int MC_modelcheck_safety(void)
       XBT_DEBUG("Delete state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1);
       MC_state_delete(state, !state->in_visited_states ? 1 : 0);
 
-      visited_state = NULL;
+      visited_state = nullptr;
 
       /* Check for deadlocks */
       if (MC_deadlock_check()) {
-        MC_show_deadlock(NULL);
+        MC_show_deadlock(nullptr);
         return SIMGRID_MC_EXIT_DEADLOCK;
       }
 
index a9dfb37..9abf26b 100644 (file)
@@ -21,9 +21,9 @@ extern "C" {
 static
 void MC_smx_process_info_clear(mc_smx_process_info_t p)
 {
-  p->hostname = NULL;
+  p->hostname = nullptr;
   free(p->name);
-  p->name = NULL;
+  p->name = nullptr;
 }
 
 xbt_dynar_t MC_smx_process_info_list_new(void)
@@ -74,8 +74,8 @@ static void MC_process_refresh_simix_process_list(
 
     s_mc_smx_process_info_t info;
     info.address = p;
-    info.name = NULL;
-    info.hostname = NULL;
+    info.name = nullptr;
+    info.hostname = nullptr;
     process->read_bytes(&info.copy, sizeof(info.copy), remote(p));
     xbt_dynar_push(target, &info);
 
@@ -146,7 +146,7 @@ smx_process_t MC_smx_simcall_get_issuer(smx_simcall_t req)
 smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address)
 {
   if (!process_remote_address)
-    return NULL;
+    return nullptr;
   if (mc_mode == MC_MODE_CLIENT)
     return process_remote_address;
 
@@ -154,7 +154,7 @@ smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address)
   if (process_info)
     return &process_info->copy;
   else
-    return NULL;
+    return nullptr;
 }
 
 mc_smx_process_info_t MC_smx_resolve_process_info(smx_process_t process_remote_address)
@@ -216,7 +216,7 @@ const char* MC_smx_process_get_name(smx_process_t p)
   if (mc_mode == MC_MODE_CLIENT)
     return p->name;
   if (!p->name)
-    return NULL;
+    return nullptr;
 
   mc_smx_process_info_t info = MC_smx_process_get_info(p);
   if (!info->name) {
index aacc9d1..70f2080 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
  *  @param addr     Pointer
  *  @param snapshot Snapshot
  *  @param Snapshot region in the snapshot this pointer belongs to
- *         (or NULL if it does not belong to any snapshot region)
+ *         (or nullptr if it does not belong to any snapshot region)
  * */
 mc_mem_region_t mc_get_snapshot_region(
   const void* addr, const simgrid::mc::Snapshot* snapshot, int process_index)
@@ -61,7 +61,7 @@ mc_mem_region_t mc_get_snapshot_region(
     return region;
   }
 
-  return NULL;
+  return nullptr;
 }
 
 /** @brief Read memory from a snapshot region broken across fragmented pages
@@ -78,18 +78,18 @@ const void* MC_region_read_fragmented(mc_mem_region_t region, void* target, cons
   void* end = (char*) addr + size - 1;
 
   // Page of the last byte of the memory area:
-  size_t page_end = mc_page_number(NULL, end);
+  size_t page_end = mc_page_number(nullptr, end);
 
   void* dest = target;
 
-  if (dest==NULL) {
+  if (dest==nullptr) {
     xbt_die("Missing destination buffer for fragmented memory access");
   }
 
   // Read each page:
-  while (mc_page_number(NULL, addr) != page_end) {
+  while (mc_page_number(nullptr, addr) != page_end) {
     void* snapshot_addr = mc_translate_address_region_chunked((uintptr_t) addr, region);
-    void* next_page = mc_page_from_number(NULL, mc_page_number(NULL, addr) + 1);
+    void* next_page = mc_page_from_number(nullptr, mc_page_number(NULL, addr) + 1);
     size_t readable = (char*) next_page - (char*) addr;
     memcpy(dest, snapshot_addr, readable);
     addr = (char*) addr + readable;
@@ -120,10 +120,10 @@ int MC_snapshot_region_memcmp(
   // Using alloca() for large allocations may trigger stack overflow:
   // use malloc if the buffer is too big.
   bool stack_alloc = size < 64;
-  const bool region1_need_buffer = region1==NULL || region1->storage_type()==simgrid::mc::StorageType::Flat;
-  const bool region2_need_buffer = region2==NULL || region2->storage_type()==simgrid::mc::StorageType::Flat;
-  void* buffer1a = region1_need_buffer ? NULL : stack_alloc ? alloca(size) : malloc(size);
-  void* buffer2a = region2_need_buffer ? NULL : stack_alloc ? alloca(size) : malloc(size);
+  const bool region1_need_buffer = region1==nullptr || region1->storage_type()==simgrid::mc::StorageType::Flat;
+  const bool region2_need_buffer = region2==nullptr || region2->storage_type()==simgrid::mc::StorageType::Flat;
+  void* buffer1a = region1_need_buffer ? nullptr : stack_alloc ? alloca(size) : malloc(size);
+  void* buffer2a = region2_need_buffer ? nullptr : stack_alloc ? alloca(size) : malloc(size);
   const void* buffer1 = MC_region_read(region1, buffer1a, addr1, size);
   const void* buffer2 = MC_region_read(region2, buffer2a, addr2, size);
   int res;
@@ -247,7 +247,7 @@ static void test_snapshot(bool sparse_checkpoint) {
 
     // Store region page(s):
     size_t byte_size = n * xbt_pagesize;
-    void* source = mmap(NULL, byte_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+    void* source = mmap(nullptr, byte_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
     xbt_assert(source!=MAP_FAILED, "Could not allocate source memory");
 
     // Init memory and take snapshots:
@@ -260,7 +260,7 @@ static void test_snapshot(bool sparse_checkpoint) {
     simgrid::mc::RegionSnapshot region = simgrid::mc::sparse_region(
       simgrid::mc::RegionType::Unknown, source, source, byte_size, nullptr);
 
-    void* destination = mmap(NULL, byte_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+    void* destination = mmap(nullptr, byte_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
     xbt_assert(source!=MAP_FAILED, "Could not allocate destination memory");
 
     xbt_test_add("Reading whole region data for %i page(s)", n);
@@ -303,7 +303,7 @@ static void test_snapshot(bool sparse_checkpoint) {
   }
 
   delete mc_model_checker;
-  mc_model_checker = NULL;
+  mc_model_checker = nullptr;
 }
 
 #endif /* SIMGRID_TEST */
index 7786efd..7c81fd5 100644 (file)
@@ -34,10 +34,10 @@ mc_state_t MC_state_new()
 
   state->max_pid = MC_smx_get_maxpid();
   state->proc_status = xbt_new0(s_mc_procstate_t, state->max_pid);
-  state->system_state = NULL;
+  state->system_state = nullptr;
   state->num = ++mc_stats->expanded_states;
   state->in_visited_states = 0;
-  state->incomplete_comm_pattern = NULL;
+  state->incomplete_comm_pattern = nullptr;
   /* Stateful model checking */
   if((_sg_mc_checkpoint > 0 && (mc_stats->expanded_states % _sg_mc_checkpoint == 0)) ||  _sg_mc_termination){
     state->system_state = simgrid::mc::take_snapshot(state->num);
@@ -102,7 +102,7 @@ void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req,
   state->executed_req = *req;
   state->req_num = value;
 
-  smx_process_t process = NULL;
+  smx_process_t process = nullptr;
 
   /* The waitany and testany request are transformed into a wait or test request over the
    * corresponding communication action so it can be treated later by the dependence
@@ -193,9 +193,9 @@ static inline smx_simcall_t MC_state_get_request_for_process(
 
   if (procstate->state != MC_INTERLEAVE
       && procstate->state != MC_MORE_INTERLEAVE)
-      return NULL;
+      return nullptr;
   if (!MC_process_is_enabled(process))
-    return NULL;
+    return nullptr;
 
   switch (process->simcall.call) {
 
@@ -253,7 +253,7 @@ static inline smx_simcall_t MC_state_get_request_for_process(
         if (act.comm.src_proc && act.comm.dst_proc) {
           *value = 0;
         } else {
-          if (act.comm.src_proc == NULL && act.comm.type == SIMIX_COMM_READY
+          if (act.comm.src_proc == nullptr && act.comm.type == SIMIX_COMM_READY
               && act.comm.detached == 1)
             *value = 0;
           else
@@ -278,19 +278,19 @@ static inline smx_simcall_t MC_state_get_request_for_process(
         *value = 0;
         return &process->simcall;
   }
-  return NULL;
+  return nullptr;
 }
 
 smx_simcall_t MC_state_get_request(mc_state_t state, int *value)
 {
-  smx_process_t process = NULL;
+  smx_process_t process = nullptr;
   MC_EACH_SIMIX_PROCESS(process,
     smx_simcall_t res = MC_state_get_request_for_process(state, value, process);
     if (res)
       return res;
   );
 
-  return NULL;
+  return nullptr;
 }
 
 }
index 3b71d12..ab43771 100644 (file)
@@ -109,10 +109,10 @@ static void* get_reg(unw_context_t* context, unw_regnum_t regnum)
   case UNW_X86_64_R14: return &mcontext->gregs[REG_R14];
   case UNW_X86_64_R15: return &mcontext->gregs[REG_R15];
   case UNW_X86_64_RIP: return &mcontext->gregs[REG_RIP];
-  default: return NULL;
+  default: return nullptr;
   }
 #else
-  return NULL;
+  return nullptr;
 #endif
 }
 
index 391f445..1d218be 100644 (file)
@@ -79,10 +79,10 @@ static mc_visited_state_t visited_state_new()
 mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state)
 {
   simgrid::mc::Process* process = &(mc_model_checker->process());
-  mc_visited_pair_t pair = NULL;
+  mc_visited_pair_t pair = nullptr;
   pair = xbt_new0(s_mc_visited_pair_t, 1);
   pair->graph_state = graph_state;
-  if(pair->graph_state->system_state == NULL)
+  if(pair->graph_state->system_state == nullptr)
     pair->graph_state->system_state = simgrid::mc::take_snapshot(pair_num);
   pair->heap_bytes_used = mmalloc_get_bytes_used_remote(
     process->get_heap()->heaplimit,
@@ -98,7 +98,7 @@ mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automa
   pair->acceptance_removed = 0;
   pair->visited_removed = 0;
   pair->acceptance_pair = 0;
-  pair->atomic_propositions = xbt_dynar_new(sizeof(int), NULL);
+  pair->atomic_propositions = xbt_dynar_new(sizeof(int), nullptr);
   unsigned int cursor = 0;
   int value;
   xbt_dynar_foreach(atomic_propositions, cursor, value)
@@ -120,12 +120,12 @@ static int is_exploration_stack_pair(mc_visited_pair_t pair){
 
 void MC_visited_pair_delete(mc_visited_pair_t p)
 {
-  p->automaton_state = NULL;
+  p->automaton_state = nullptr;
   if( !is_exploration_stack_pair(p))
     MC_state_delete(p->graph_state, 1);
   xbt_dynar_free(&(p->atomic_propositions));
   xbt_free(p);
-  p = NULL;
+  p = nullptr;
 }
 
 /**
@@ -231,7 +231,7 @@ void replace_state(
   else
     new_state->other_num = state_test->other_num;
 
-  if (dot_output == NULL)
+  if (dot_output == nullptr)
     XBT_DEBUG("State %d already visited ! (equal to state %d)",
       new_state->num, state_test->num);
   else
@@ -242,7 +242,7 @@ void replace_state(
   /* Replace the old state with the new one (with a bigger num)
      (when the max number of visited states is reached,  the oldest
      one is removed according to its number (= with the min number) */
-  xbt_dynar_remove_at(visited_states, cursor, NULL);
+  xbt_dynar_remove_at(visited_states, cursor, nullptr);
   xbt_dynar_insert_at(visited_states, cursor, &new_state);
   XBT_DEBUG("Replace visited state %d with the new visited state %d",
     state_test->num, new_state->num);
@@ -270,7 +270,7 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state)
 {
 
   if (_sg_mc_visited == 0)
-    return NULL;
+    return nullptr;
 
   /* If comm determinism verification, we cannot stop the exploration if some 
      communications are not finished (at least, data are transfered). These communications 
@@ -286,7 +286,7 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state)
   if (xbt_dynar_is_empty(visited_states)) {
 
     xbt_dynar_push(visited_states, &new_state);
-    return NULL;
+    return nullptr;
 
   } else {
 
@@ -304,11 +304,11 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state)
          new_state->other_num = state_test->num;
          else
          new_state->other_num = state_test->other_num;
-         if(dot_output == NULL)
+         if(dot_output == nullptr)
          XBT_DEBUG("State %d already visited ! (equal to state %d)", new_state->num, state_test->num);
          else
          XBT_DEBUG("State %d already visited ! (equal to state %d (state %d in dot_output))", new_state->num, state_test->num, new_state->other_num);
-         xbt_dynar_remove_at(visited_states, (min + res) - 1, NULL);
+         xbt_dynar_remove_at(visited_states, (min + res) - 1, nullptr);
          xbt_dynar_insert_at(visited_states, (min+res) - 1, &new_state);
          return new_state->other_num;
          } */
@@ -369,11 +369,11 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state)
       }
 
       // and drop it:
-      xbt_dynar_remove_at(visited_states, index2, NULL);
+      xbt_dynar_remove_at(visited_states, index2, nullptr);
       XBT_DEBUG("Remove visited state (maximum number of stored states reached)");
     }
 
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -385,9 +385,9 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) {
   if (_sg_mc_visited == 0)
     return -1;
 
-  mc_visited_pair_t new_visited_pair = NULL;
+  mc_visited_pair_t new_visited_pair = nullptr;
 
-  if (visited_pair == NULL) {
+  if (visited_pair == nullptr) {
     new_visited_pair = MC_visited_pair_new(pair->num, pair->automaton_state, pair->atomic_propositions, pair->graph_state);
   } else {
     new_visited_pair = visited_pair;
@@ -414,11 +414,11 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) {
          pair->other_num = pair_test->num;
          else
          pair->other_num = pair_test->other_num;
-         if(dot_output == NULL)
+         if(dot_output == nullptr)
          XBT_DEBUG("Pair %d already visited ! (equal to pair %d)", pair->num, pair_test->num);
          else
          XBT_DEBUG("Pair %d already visited ! (equal to pair %d (pair %d in dot_output))", pair->num, pair_test->num, pair->other_num);
-         xbt_dynar_remove_at(visited_pairs, (min + res) - 1, NULL);
+         xbt_dynar_remove_at(visited_pairs, (min + res) - 1, nullptr);
          xbt_dynar_insert_at(visited_pairs, (min+res) - 1, &pair);
          pair_test->visited_removed = 1;
          if(pair_test->stack_removed && pair_test->visited_removed){
@@ -442,7 +442,7 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) {
                 new_visited_pair->other_num = pair_test->num;
               else
                 new_visited_pair->other_num = pair_test->other_num;
-              if (dot_output == NULL)
+              if (dot_output == nullptr)
                 XBT_DEBUG("Pair %d already visited ! (equal to pair %d)", new_visited_pair->num, pair_test->num);
               else
                 XBT_DEBUG("Pair %d already visited ! (equal to pair %d (pair %d in dot_output))", new_visited_pair->num, pair_test->num, new_visited_pair->other_num);
index a5dbc31..a0e7272 100644 (file)
@@ -136,7 +136,7 @@ char** argvdup(int argc, char** argv)
 {
   char** argv_copy = xbt_new(char*, argc+1);
   std::memcpy(argv_copy, argv, sizeof(char*) * argc);
-  argv_copy[argc] = NULL;
+  argv_copy[argc] = nullptr;
   return argv_copy;
 }