Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Restore warning for unit-less values.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 18 Apr 2019 12:16:17 +0000 (14:16 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 18 Apr 2019 20:38:25 +0000 (22:38 +0200)
src/smpi/internals/smpi_utils.cpp
src/surf/xml/surfxml_sax_cb.cpp

index 931d3ec..ae8df44 100644 (file)
@@ -49,7 +49,7 @@ std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string)
         }
       } else {
         try {
-          fact.values.push_back(surf_parse_get_time((*factor_iter).c_str(), "smpi factor", std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter));
+          fact.values.push_back(surf_parse_get_time((*factor_iter).c_str(), "smpi factor", ""));
         } catch (std::invalid_argument& ia) {
           throw std::invalid_argument(std::string("Invalid factor value ") + std::to_string(iteration) + " in chunk " +
                                       std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter);
index e57ae9f..ef5aa09 100644 (file)
@@ -171,7 +171,7 @@ unit_scale::unit_scale(std::initializer_list<std::tuple<const std::string, doubl
   }
 }
 
-/* Note: field `unit' for the last element of parameter `units' should be nullptr. */
+/* Note: no warning is issued for unit-less values when `name' is empty. */
 double surf_parse_get_value_with_unit(const char* string, const unit_scale& units, const char* entity_kind,
                                       const std::string& name, const char* error_msg, const char* default_unit)
 {
@@ -183,6 +183,9 @@ double surf_parse_get_value_with_unit(const char* string, const unit_scale& unit
   if (ptr == string)
     surf_parse_error(std::string("cannot parse number:") + string);
   if (ptr[0] == '\0') {
+    // Ok, 0 can be unit-less
+    if (res != 0 && not name.empty())
+      XBT_WARN("Deprecated unit-less value '%s' for %s %s. %s", string, entity_kind, name.c_str(), error_msg);
     ptr = (char*)default_unit;
   }
   auto u = units.find(ptr);