From: Arnaud Giersch Date: Wed, 24 May 2023 16:18:15 +0000 (+0200) Subject: Disable implicit conversions in nlohmann/json. X-Git-Tag: v3.34~97 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/21fcea405599709be4094257c2c4b2cee942a2d1 Disable implicit conversions in nlohmann/json. See https://github.com/nlohmann/json#implicit-conversions --- diff --git a/src/dag/loaders.cpp b/src/dag/loaders.cpp index f0d18268fd..218aa71b36 100644 --- a/src/dag/loaders.cpp +++ b/src/dag/loaders.cpp @@ -21,6 +21,11 @@ #include "dax_dtd.c" #if SIMGRID_HAVE_JSON +// Disable implicit conversions. See https://github.com/nlohmann/json#implicit-conversions +#ifdef JSON_USE_IMPLICIT_CONVERSIONS +#undef JSON_USE_IMPLICIT_CONVERSIONS +#endif +#define JSON_USE_IMPLICIT_CONVERSIONS 0 #include #include #endif @@ -101,14 +106,19 @@ std::vector create_DAG_from_json(const std::string& filename) for (auto const& task: data["workflow"]["tasks"]) { if (task["type"] == "compute") { - current = Exec::init()->set_name(task["name"])->set_flops_amount(task["runtime"]); + current = + Exec::init()->set_name(task["name"].get())->set_flops_amount(task["runtime"].get()); if (task.contains("machine")) - dynamic_cast(current.get())->set_host(simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"])); + dynamic_cast(current.get()) + ->set_host(simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"].get())); } else if (task["type"] == "transfer"){ - current = Comm::sendto_init()->set_name(task["name"])->set_payload_size(task["bytesWritten"]); + current = Comm::sendto_init() + ->set_name(task["name"].get()) + ->set_payload_size(task["bytesWritten"].get()); if (task.contains("machine")) - comms_destinations[current] = simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"]); + comms_destinations[current] = + simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"].get()); if (task["parents"].size() == 1) { ActivityPtr parent_activity; for (auto const& activity: dag) { @@ -130,7 +140,7 @@ std::vector create_DAG_from_json(const std::string& filename) dag.push_back(current); for (auto const& parent : task["parents"]) - successors[parent].push_back(current); + successors[parent.get()].push_back(current); } // Assign successors for (auto const& [parent, successors_list] : successors)