From: Martin Quinson Date: Fri, 28 Oct 2016 18:24:23 +0000 (+0200) Subject: fix MC builds X-Git-Tag: v3_14~276 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7eb05b56d98d3527843b2ceccf4fb26ffab538f9 fix MC builds It seems that MC does not love when exceptions are raised. --- diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index ed367e8d8f..e7a2c0cd4d 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -20,7 +20,7 @@ #include "simgrid/s4u/host.hpp" #include "simgrid/s4u/storage.hpp" -std::unordered_map host_list; // FIXME: move it to Engine +std::unordered_map host_list; // FIXME: move it to Engine int MSG_HOST_LEVEL = -1; int USER_HOST_LEVEL = -1; @@ -78,11 +78,9 @@ Host* Host::by_name(std::string name) } Host* Host::by_name_or_null(const char* name) { - try { - return host_list.at(name); - } catch (std::out_of_range& e) { + if (host_list.find(name) == host_list.end()) return nullptr; - } + return host_list.at(name); } Host *Host::current(){ diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 09bb7323e5..90034b03f0 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts"); -extern std::unordered_map +extern std::unordered_map host_list; // FIXME: don't dupplicate the content of s4u::Host this way void sg_host_exit()