Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a few dead stores spotted by fbinfer.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 16 Jan 2021 17:34:44 +0000 (18:34 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 17 Jan 2021 22:35:59 +0000 (23:35 +0100)
src/surf/surf_c_bindings.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/xbt_str_test.cpp

index f0b0d5f..aec38d9 100644 (file)
@@ -22,16 +22,15 @@ extern double NOW;
 
 void surf_presolve()
 {
-  double next_event_date = -1.0;
-  simgrid::kernel::profile::Event* event        = nullptr;
-  double value = -1.0;
-  simgrid::kernel::resource::Resource* resource = nullptr;
-
   XBT_DEBUG ("Consume all trace events occurring before the starting time.");
+  double next_event_date;
   while ((next_event_date = simgrid::kernel::profile::future_evt_set.next_date()) != -1.0) {
     if (next_event_date > NOW)
       break;
 
+    simgrid::kernel::profile::Event* event;
+    double value                                  = -1.0;
+    simgrid::kernel::resource::Resource* resource = nullptr;
     while ((event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource))) {
       if (value >= 0)
         resource->apply_event(event, value);
index 1739eb4..e783bd1 100644 (file)
@@ -535,7 +535,7 @@ void STag_surfxml_link___ctn()
     surf_parse_error(std::string("Invalid direction for link ") + A_surfxml_link___ctn_id);
   }
 
-  const char* dirname = "";
+  const char* dirname;
   switch (A_surfxml_link___ctn_direction) {
     case A_surfxml_link___ctn_direction_UP:
       dirname = " (upward)";
index 182d5b0..ec659e4 100644 (file)
@@ -35,7 +35,7 @@ template <typename F> void test_parse_error(F function, const std::string& name,
 template <typename F, typename T> void test_parse_ok(F function, const std::string& name, const char* str, T value)
 {
   INFO(name);
-  auto variable = static_cast<T>(-9999);
+  T variable;
   REQUIRE_NOTHROW(variable = function(str, "Parse error"));
   REQUIRE(variable == value); /* Fail to parse str */
 }