Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix comment.
[simgrid.git] / src / mc / explo / DFSExplorer.cpp
index b34cec5..3a99ca5 100644 (file)
@@ -60,7 +60,7 @@ void DFSExplorer::check_non_termination(const State* current_state)
                get_record_trace().to_string().c_str());
       log_state();
 
-      throw TerminationError();
+      throw McError(ExitStatus::NON_TERMINATION);
     }
   }
 #endif
@@ -81,8 +81,8 @@ std::vector<std::string> DFSExplorer::get_textual_trace() // override
   for (auto const& transition : stack_.back()->get_recipe()) {
     trace.push_back(xbt::string_printf("%ld: %s", transition->aid_, transition->to_string().c_str()));
   }
-  trace.push_back(xbt::string_printf("%ld: %s", stack_.back()->get_transition()->aid_,
-                                     stack_.back()->get_transition()->to_string().c_str()));
+  if (const auto* trans = stack_.back()->get_transition(); trans != nullptr)
+    trace.push_back(xbt::string_printf("%ld: %s", trans->aid_, trans->to_string().c_str()));
   return trace;
 }
 
@@ -151,7 +151,7 @@ void DFSExplorer::run()
 #endif
 
     // Search for the next transition
-    // next_transition returns a pair<aid_t, double> in case we want to consider multiple state (eg. during backtrack)
+    // next_transition returns a pair<aid_t, int> in case we want to consider multiple state (eg. during backtrack)
     auto [next, _] = state->next_transition_guided();
 
     if (next < 0) { // If there is no more transition in the current state, backtrack.
@@ -203,7 +203,7 @@ void DFSExplorer::run()
       aid_t issuer_id   = state->get_transition()->aid_;
       stack_t tmp_stack = stack_;
       while (not tmp_stack.empty()) {
-        if (State* prev_state = tmp_stack.back().get();
+        if (const State* prev_state = tmp_stack.back().get();
             state->get_transition()->aid_ == prev_state->get_transition()->aid_) {
           XBT_DEBUG("Simcall >>%s<< and >>%s<< with same issuer %ld", state->get_transition()->to_string().c_str(),
                     prev_state->get_transition()->to_string().c_str(), issuer_id);