From: Gabriel Corona Date: Mon, 4 Apr 2016 15:22:51 +0000 (+0200) Subject: [mc] Fix warnings X-Git-Tag: v3_13~187^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7ebd6d64a6382e0dad15e4d63cd4f84d94d8312f [mc] Fix warnings --- diff --git a/src/mc/CommunicationDeterminismChecker.cpp b/src/mc/CommunicationDeterminismChecker.cpp index 7075a2e498..b2c8e0babc 100644 --- a/src/mc/CommunicationDeterminismChecker.cpp +++ b/src/mc/CommunicationDeterminismChecker.cpp @@ -416,7 +416,7 @@ int CommunicationDeterminismChecker::main(void) /* Update statistics */ mc_stats->visited_states++; - if (stack_.size() <= _sg_mc_max_depth + if (stack_.size() <= (std::size_t) _sg_mc_max_depth && (req = MC_state_get_request(state, &value)) && (visited_state == nullptr)) { @@ -479,7 +479,7 @@ int CommunicationDeterminismChecker::main(void) } else { - if (stack_.size() > _sg_mc_max_depth) + if (stack_.size() > (std::size_t) _sg_mc_max_depth) XBT_WARN("/!\\ Max depth reached ! /!\\ "); 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); @@ -507,7 +507,7 @@ int CommunicationDeterminismChecker::main(void) std::unique_ptr state = std::move(stack_.back()); stack_.pop_back(); if (MC_state_interleave_size(state.get()) - && stack_.size() < _sg_mc_max_depth) { + && stack_.size() < (std::size_t) _sg_mc_max_depth) { /* We found a back-tracking point, let's loop */ XBT_DEBUG("Back-tracking to state %d at depth %zi", state->num, stack_.size() + 1); diff --git a/src/mc/SafetyChecker.cpp b/src/mc/SafetyChecker.cpp index 4f527cbf39..25abd4bb1c 100644 --- a/src/mc/SafetyChecker.cpp +++ b/src/mc/SafetyChecker.cpp @@ -98,11 +98,8 @@ int SafetyChecker::run() { this->init(); - char *req_str = nullptr; int value; smx_simcall_t req = nullptr; - simgrid::mc::State* prev_state = nullptr; - xbt_fifo_item_t item = nullptr; std::unique_ptr visited_state = nullptr; while (!stack_.empty()) { @@ -121,10 +118,10 @@ int SafetyChecker::run() /* If there are processes to interleave and the maximum depth has not been reached then perform one step of the exploration algorithm */ - if (stack_.size() <= _sg_mc_max_depth && !user_max_depth_reached + if (stack_.size() <= (std::size_t) _sg_mc_max_depth && !user_max_depth_reached && (req = MC_state_get_request(state, &value)) && visited_state == nullptr) { - req_str = simgrid::mc::request_to_string(req, value, simgrid::mc::RequestType::simix); + char* req_str = simgrid::mc::request_to_string(req, value, simgrid::mc::RequestType::simix); XBT_DEBUG("Execute: %s", req_str); xbt_free(req_str); @@ -177,7 +174,8 @@ int SafetyChecker::run() /* The interleave set is empty or the maximum depth is reached, let's back-track */ } else { - if (stack_.size() > _sg_mc_max_depth || user_max_depth_reached + if (stack_.size() > (std::size_t) _sg_mc_max_depth + || user_max_depth_reached || visited_state != nullptr) { if (user_max_depth_reached && visited_state == nullptr) @@ -226,7 +224,7 @@ int SafetyChecker::run() if (XBT_LOG_ISENABLED(mc_safety, xbt_log_priority_debug)) { XBT_DEBUG("Dependent Transitions:"); smx_simcall_t prev_req = MC_state_get_executed_request(prev_state, &value); - req_str = simgrid::mc::request_to_string(prev_req, value, simgrid::mc::RequestType::internal); + char* req_str = simgrid::mc::request_to_string(prev_req, value, simgrid::mc::RequestType::internal); XBT_DEBUG("%s (state=%d)", req_str, prev_state->num); xbt_free(req_str); prev_req = MC_state_get_executed_request(state.get(), &value); @@ -261,7 +259,7 @@ int SafetyChecker::run() } if (MC_state_interleave_size(state.get()) - && stack_.size() < _sg_mc_max_depth) { + && stack_.size() < (std::size_t) _sg_mc_max_depth) { /* We found a back-tracking point, let's loop */ XBT_DEBUG("Back-tracking to state %d at depth %zi", state->num, stack_.size() + 1);