From e44f9774238ec0236589e28a4f4dc35706aab511 Mon Sep 17 00:00:00 2001 From: degomme Date: Mon, 15 Apr 2019 11:12:48 +0200 Subject: [PATCH] Allow units in smpi factors. To make it optional (as parse_factor is used for actual factors and not only seconds on some occasions), remove the warning in surf if a unit-less value is used. --- src/smpi/internals/smpi_utils.cpp | 3 ++- src/surf/xml/surfxml_sax_cb.cpp | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/smpi/internals/smpi_utils.cpp b/src/smpi/internals/smpi_utils.cpp index ddde90d51f..931d3ecba0 100644 --- a/src/smpi/internals/smpi_utils.cpp +++ b/src/smpi/internals/smpi_utils.cpp @@ -8,6 +8,7 @@ #include "xbt/log.h" #include "xbt/sysdep.h" #include +#include "src/surf/xml/platf_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)"); @@ -48,7 +49,7 @@ std::vector parse_factor(const std::string& smpi_coef_string) } } else { try { - fact.values.push_back(std::stod(*factor_iter)); + fact.values.push_back(surf_parse_get_time((*factor_iter).c_str(), "smpi factor", std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter)); } 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); diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 26046c6b5e..e57ae9f91c 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -183,10 +183,6 @@ 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') { - if (res == 0) - return res; // Ok, 0 can be unit-less - - 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); -- 2.20.1