From: Arnaud Giersch Date: Wed, 16 Dec 2020 16:40:57 +0000 (+0100) Subject: Use transparent comparator 'std::less<>' with associative string container (sonar). X-Git-Tag: v3.27~607 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f409d6f711ba652a6fd78e185791cf7870b6765d Use transparent comparator 'std::less<>' with associative string container (sonar). See https://sonarcloud.io/organizations/simgrid/rules?open=cpp%3AS6045&rule_key=cpp%3AS6045 --- diff --git a/include/simgrid/kernel/routing/ClusterZone.hpp b/include/simgrid/kernel/routing/ClusterZone.hpp index cb2923e07e..e7e2617a9b 100644 --- a/include/simgrid/kernel/routing/ClusterZone.hpp +++ b/include/simgrid/kernel/routing/ClusterZone.hpp @@ -70,8 +70,8 @@ public: explicit ClusterZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel); void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; - void get_graph(const s_xbt_graph_t* graph, std::map* nodes, - std::map* edges) override; + void get_graph(const s_xbt_graph_t* graph, std::map>* nodes, + std::map>* edges) override; virtual void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position); virtual void parse_specific_arguments(ClusterCreationArgs*) diff --git a/include/simgrid/kernel/routing/EmptyZone.hpp b/include/simgrid/kernel/routing/EmptyZone.hpp index 8255827ca3..72609db880 100644 --- a/include/simgrid/kernel/routing/EmptyZone.hpp +++ b/include/simgrid/kernel/routing/EmptyZone.hpp @@ -29,8 +29,8 @@ public: /* There can't be route in an Empty zone */ } - void get_graph(const s_xbt_graph_t* graph, std::map* /*nodes*/, - std::map* /*edges*/) override; + void get_graph(const s_xbt_graph_t* graph, std::map>* /*nodes*/, + std::map>* /*edges*/) override; }; } // namespace routing } // namespace kernel diff --git a/include/simgrid/kernel/routing/NetZoneImpl.hpp b/include/simgrid/kernel/routing/NetZoneImpl.hpp index 8ef575a707..699f26405b 100644 --- a/include/simgrid/kernel/routing/NetZoneImpl.hpp +++ b/include/simgrid/kernel/routing/NetZoneImpl.hpp @@ -147,8 +147,8 @@ public: static void get_global_route(routing::NetPoint* src, routing::NetPoint* dst, /* OUT */ std::vector& links, double* latency); - virtual void get_graph(const s_xbt_graph_t* graph, std::map* nodes, - std::map* edges) = 0; + virtual void get_graph(const s_xbt_graph_t* graph, std::map>* nodes, + std::map>* edges) = 0; }; } // namespace routing } // namespace kernel diff --git a/include/simgrid/kernel/routing/RoutedZone.hpp b/include/simgrid/kernel/routing/RoutedZone.hpp index 6a2e142ebc..5cf45eaf04 100644 --- a/include/simgrid/kernel/routing/RoutedZone.hpp +++ b/include/simgrid/kernel/routing/RoutedZone.hpp @@ -52,8 +52,8 @@ class XBT_PRIVATE RoutedZone : public NetZoneImpl { public: explicit RoutedZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel); - void get_graph(const s_xbt_graph_t* graph, std::map* nodes, - std::map* edges) override; + void get_graph(const s_xbt_graph_t* graph, std::map>* nodes, + std::map>* edges) override; protected: RouteCreationArgs* new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst, @@ -73,8 +73,8 @@ protected: } // namespace simgrid XBT_PRIVATE xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name, - std::map* nodes); + std::map>* nodes); XBT_PRIVATE xbt_edge_t new_xbt_graph_edge(const s_xbt_graph_t* graph, xbt_node_t s, xbt_node_t d, - std::map* edges); + std::map>* edges); #endif /* SIMGRID_ROUTING_GENERIC_HPP_ */ diff --git a/include/simgrid/plugins/file_system.h b/include/simgrid/plugins/file_system.h index edf943a06e..96c9018153 100644 --- a/include/simgrid/plugins/file_system.h +++ b/include/simgrid/plugins/file_system.h @@ -156,7 +156,7 @@ public: }; class XBT_PUBLIC FileSystemDiskExt { - std::unique_ptr> content_; + std::unique_ptr>> content_; std::map remote_mount_points_; std::string mount_point_; sg_size_t used_size_ = 0; @@ -167,8 +167,8 @@ public: explicit FileSystemDiskExt(const Disk* ptr); FileSystemDiskExt(const FileSystemDiskExt&) = delete; FileSystemDiskExt& operator=(const FileSystemDiskExt&) = delete; - std::map* parse_content(const std::string& filename); - std::map* get_content() const { return content_.get(); } + std::map>* parse_content(const std::string& filename); + std::map>* get_content() const { return content_.get(); } const char* get_mount_point() const { return mount_point_.c_str(); } const char* get_mount_point(s4u::Host* remote_host) { return remote_mount_points_[remote_host].c_str(); } void add_remote_mount(Host* host, const std::string& mount_point) @@ -182,7 +182,7 @@ public: }; class XBT_PUBLIC FileSystemStorageExt { - std::unique_ptr> content_; + std::unique_ptr>> content_; sg_size_t used_size_ = 0; sg_size_t size_ = 0; @@ -191,8 +191,8 @@ public: explicit FileSystemStorageExt(const Storage* ptr); FileSystemStorageExt(const FileSystemStorageExt&) = delete; FileSystemStorageExt& operator=(const FileSystemStorageExt&) = delete; - std::map* parse_content(const std::string& filename); - std::map* get_content() { return content_.get(); } + std::map>* parse_content(const std::string& filename); + std::map>* get_content() { return content_.get(); } sg_size_t get_size() const { return size_; } sg_size_t get_used_size() const { return used_size_; } void decr_used_size(sg_size_t size); diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 537ab6ed24..ac9bf412ca 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -55,8 +55,8 @@ public: void set_property(const std::string& key, const std::string& value); std::vector get_children() const; - void extract_xbt_graph(const s_xbt_graph_t* graph, std::map* nodes, - std::map* edges); + void extract_xbt_graph(const s_xbt_graph_t* graph, std::map>* nodes, + std::map>* edges); /* Add content to the netzone, at parsing time. It should be sealed afterward. */ int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */ diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index eeca2250f0..4430150115 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -153,7 +153,7 @@ template typename std::enable_if()(std::declval()))>::value, void>::type bind_flag(std::string& value, const char* name, const char* description, - const std::map& valid_values, F callback) + const std::map>& valid_values, F callback) { declare_flag(name, description, value, std::function([&value, name, valid_values, callback](const std::string& val) { @@ -176,7 +176,7 @@ template typename std::enable_if()(std::declval()))>::value, void>::type bind_flag(std::string& value, const char* name, std::initializer_list aliases, const char* description, - const std::map& valid_values, F callback) + const std::map>& valid_values, F callback) { bind_flag(value, name, description, valid_values, std::move(callback)); alias(name, aliases); @@ -252,7 +252,8 @@ public: * and producing an informative error message when an invalid value is passed, or when help is passed as a value. */ template - Flag(const char* name, const char* desc, T value, const std::map& valid_values, F callback) + Flag(const char* name, const char* desc, T value, const std::map>& valid_values, + F callback) : value_(value), name_(name) { simgrid::config::bind_flag(value_, name, desc, std::move(valid_values), std::move(callback)); @@ -261,7 +262,7 @@ public: /* A constructor with everything */ template Flag(const char* name, std::initializer_list aliases, const char* desc, T value, - const std::map& valid_values, F callback) + const std::map>& valid_values, F callback) : value_(value), name_(name) { simgrid::config::bind_flag(value_, name, aliases, desc, valid_values, std::move(callback)); diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index 0635cee8cc..3da8510c56 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -17,13 +17,13 @@ enum class InstrUserVariable { DECLARE, SET, ADD, SUB }; XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API"); -std::set created_categories; -std::set declared_marks; -std::set user_host_variables; -std::set user_vm_variables; -std::set user_link_variables; +std::set> created_categories; +std::set> declared_marks; +std::set> user_host_variables; +std::set> user_vm_variables; +std::set> user_link_variables; -static xbt_dynar_t instr_set_to_dynar(const std::set& filter) +static xbt_dynar_t instr_set_to_dynar(const std::set>& filter) { if (not TRACE_is_enabled() || not TRACE_needs_platform()) return nullptr; @@ -258,7 +258,8 @@ xbt_dynar_t TRACE_get_marks () } static void instr_user_variable(double time, const char* resource, const char* variable_name, const char* father_type, - double value, InstrUserVariable what, const char* color, std::set* filter) + double value, InstrUserVariable what, const char* color, + std::set>* filter) { /* safe switches. tracing has to be activated and if platform is not traced, we don't allow user variables */ if (not TRACE_is_enabled() || not TRACE_needs_platform()) diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index dbb271da24..fe27724ee9 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -14,7 +14,7 @@ namespace simgrid { namespace instr { Container* Container::root_container_ = nullptr; /* the root container */ -std::map Container::all_containers_; /* all created containers indexed by name */ +std::map> Container::all_containers_; /* all created containers indexed by name */ NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father) : Container::Container(name, "", father) diff --git a/src/instr/instr_paje_containers.hpp b/src/instr/instr_paje_containers.hpp index 52a2b2d816..cdb78d350c 100644 --- a/src/instr/instr_paje_containers.hpp +++ b/src/instr/instr_paje_containers.hpp @@ -18,7 +18,7 @@ class VariableType; class Container { static Container* root_container_; - static std::map all_containers_; + static std::map> all_containers_; long long int id_; std::string name_; /* Unique name of this container */ @@ -37,7 +37,7 @@ public: Type* type_; /* Type of this container */ Container* father_; - std::map children_; + std::map> children_; static Container* by_name_or_null(const std::string& name); static Container* by_name(const std::string& name); diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index a075804b09..df25bde173 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -10,7 +10,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_types, instr, "Paje tracing event system (types)"); // to check if variables were previously set to 0, otherwise paje won't simulate them -static std::set platform_variables; +static std::set> platform_variables; namespace simgrid { namespace instr { diff --git a/src/instr/instr_paje_types.hpp b/src/instr/instr_paje_types.hpp index 9b69640ac7..51f55a356f 100644 --- a/src/instr/instr_paje_types.hpp +++ b/src/instr/instr_paje_types.hpp @@ -23,7 +23,7 @@ class Type { std::string name_; std::string color_; Type* father_; - std::map> children_; + std::map, std::less<>> children_; Container* issuer_ = nullptr; protected: @@ -41,7 +41,7 @@ public: const char* get_cname() const { return name_.c_str(); } const std::string& get_color() const { return color_; } Type* get_father() const { return father_; } - const std::map>& get_children() const { return children_; } + const std::map, std::less<>>& get_children() const { return children_; } bool is_colored() const { return not color_.empty(); } Type* by_name(const std::string& name); @@ -83,7 +83,7 @@ public: class ValueType : public Type { public: - std::map values_; + std::map> values_; ValueType(PajeEventType event_type, const std::string& name, const std::string& alias, Type* father) : Type(event_type, name, alias, "", father){}; ValueType(PajeEventType event_type, const std::string& name, Type* father) diff --git a/src/instr/instr_platform.cpp b/src/instr/instr_platform.cpp index f08514b19e..287d5315a6 100644 --- a/src/instr/instr_platform.cpp +++ b/src/instr/instr_platform.cpp @@ -65,7 +65,7 @@ static simgrid::instr::Container* lowestCommonAncestor(const simgrid::instr::Con } static void linkContainers(simgrid::instr::Container* src, simgrid::instr::Container* dst, - std::set* filter) + std::set>* filter) { // ignore loopback if (src->get_name() == "__loopback__" || dst->get_name() == "__loopback__") { @@ -115,7 +115,7 @@ static void linkContainers(simgrid::instr::Container* src, simgrid::instr::Conta } static void recursiveGraphExtraction(const simgrid::s4u::NetZone* netzone, simgrid::instr::Container* container, - std::set* filter) + std::set>* filter) { if (not TRACE_platform_topology()) { XBT_DEBUG("Graph extraction disabled by user."); @@ -131,8 +131,8 @@ static void recursiveGraphExtraction(const simgrid::s4u::NetZone* netzone, simgr } auto* graph = xbt_graph_new_graph(0, nullptr); - std::map nodes; - std::map edges; + std::map> nodes; + std::map> edges; netzone->get_impl()->get_graph(graph, &nodes, &edges); for (auto const& elm : edges) { @@ -217,8 +217,8 @@ namespace instr { void platform_graph_export_graphviz(const std::string& output_filename) { auto* g = xbt_graph_new_graph(0, nullptr); - std::map nodes; - std::map edges; + std::map> nodes; + std::map> edges; s4u::Engine::get_instance()->get_netzone_root()->extract_xbt_graph(g, &nodes, &edges); std::ofstream fs; @@ -356,7 +356,7 @@ static void on_action_state_change(kernel::resource::Action const& action, static void on_platform_created() { currentContainer.clear(); - std::set filter; + std::set> filter; XBT_DEBUG("Starting graph extraction."); recursiveGraphExtraction(s4u::Engine::get_instance()->get_netzone_root(), Container::get_root(), &filter); XBT_DEBUG("Graph extraction finished."); diff --git a/src/instr/instr_private.hpp b/src/instr/instr_private.hpp index 7819f951c0..5c7393a562 100644 --- a/src/instr/instr_private.hpp +++ b/src/instr/instr_private.hpp @@ -246,11 +246,11 @@ public: XBT_PRIVATE std::string instr_pid(simgrid::s4u::Actor const& proc); -extern XBT_PRIVATE std::set created_categories; -extern XBT_PRIVATE std::set declared_marks; -extern XBT_PRIVATE std::set user_host_variables; -extern XBT_PRIVATE std::set user_vm_variables; -extern XBT_PRIVATE std::set user_link_variables; +extern XBT_PRIVATE std::set> created_categories; +extern XBT_PRIVATE std::set> declared_marks; +extern XBT_PRIVATE std::set> user_host_variables; +extern XBT_PRIVATE std::set> user_vm_variables; +extern XBT_PRIVATE std::set> user_link_variables; /* from instr_config.c */ XBT_PRIVATE bool TRACE_needs_platform(); diff --git a/src/kernel/EngineImpl.hpp b/src/kernel/EngineImpl.hpp index 2e385c759b..e28a2d58fb 100644 --- a/src/kernel/EngineImpl.hpp +++ b/src/kernel/EngineImpl.hpp @@ -18,9 +18,9 @@ namespace simgrid { namespace kernel { class EngineImpl { - std::map hosts_; - std::map links_; - std::map storages_; + std::map> hosts_; + std::map> links_; + std::map> storages_; std::unordered_map netpoints_; std::unordered_map registered_functions; // Maps function names to actor code actor::ActorCodeFactory default_function; // Function to use as a fallback when the provided name matches nothing diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 21c4b65647..f99e870b4a 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -77,8 +77,8 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg } } -void ClusterZone::get_graph(const s_xbt_graph_t* graph, std::map* nodes, - std::map* edges) +void ClusterZone::get_graph(const s_xbt_graph_t* graph, std::map>* nodes, + std::map>* edges) { xbt_assert(router_, "Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph."); diff --git a/src/kernel/routing/EmptyZone.cpp b/src/kernel/routing/EmptyZone.cpp index 7a16f4549c..15c5765fe8 100644 --- a/src/kernel/routing/EmptyZone.cpp +++ b/src/kernel/routing/EmptyZone.cpp @@ -22,8 +22,8 @@ EmptyZone::EmptyZone(NetZoneImpl* father, const std::string& name, resource::Net EmptyZone::~EmptyZone() = default; -void EmptyZone::get_graph(const s_xbt_graph_t* /*graph*/, std::map* /*nodes*/, - std::map* /*edges*/) +void EmptyZone::get_graph(const s_xbt_graph_t* /*graph*/, std::map>* /*nodes*/, + std::map>* /*edges*/) { XBT_ERROR("No routing no graph"); } diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index f78403ba3b..a3f1a4781a 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -17,7 +17,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic imple /* ***************************************************************** */ /* *********************** GENERIC METHODS ************************* */ -xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name, std::map* nodes) +xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name, + std::map>* nodes) { auto elm = nodes->find(name); if (elm == nodes->end()) { @@ -29,7 +30,7 @@ xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name, std: } xbt_edge_t new_xbt_graph_edge(const s_xbt_graph_t* graph, xbt_node_t s, xbt_node_t d, - std::map* edges) + std::map>* edges) { const auto* sn = static_cast(xbt_graph_node_get_data(s)); const auto* dn = static_cast(xbt_graph_node_get_data(d)); @@ -58,8 +59,8 @@ RoutedZone::RoutedZone(NetZoneImpl* father, const std::string& name, resource::N { } -void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map* nodes, - std::map* edges) +void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map>* nodes, + std::map>* edges) { std::vector vertices = get_vertices(); diff --git a/src/mc/ModelChecker.hpp b/src/mc/ModelChecker.hpp index faca1facba..dc1572caa9 100644 --- a/src/mc/ModelChecker.hpp +++ b/src/mc/ModelChecker.hpp @@ -22,7 +22,7 @@ namespace mc { class ModelChecker { CheckerSide checker_side_; /** String pool for host names */ - std::set hostnames_; + std::set> hostnames_; // This is the parent snapshot of the current state: PageStore page_store_{500}; std::unique_ptr remote_simulation_; diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index 7308985348..46c0016f9b 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -116,7 +116,7 @@ File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpa ext->file_descriptor_table->pop_back(); XBT_DEBUG("\tOpen file '%s'", path_.c_str()); - std::map* content = nullptr; + std::map>* content = nullptr; if (local_storage_) content = local_storage_->extension()->get_content(); @@ -236,7 +236,7 @@ sg_size_t File::write_on_disk(sg_size_t size, bool write_inside) size_ = current_position_; } kernel::actor::simcall([this] { - std::map* content = local_disk_->extension()->get_content(); + std::map>* content = local_disk_->extension()->get_content(); content->erase(path_); content->insert({path_, size_}); @@ -276,7 +276,8 @@ sg_size_t File::write_on_storage(sg_size_t size, bool write_inside) size_ = current_position_; } kernel::actor::simcall([this] { - std::map* content = local_storage_->extension()->get_content(); + std::map>* content = + local_storage_->extension()->get_content(); content->erase(path_); content->insert({path_, size_}); @@ -334,7 +335,7 @@ void File::move(const std::string& fullpath) const { /* Check if the new full path is on the same mount point */ if (fullpath.compare(0, mount_point_.length(), mount_point_) == 0) { - std::map* content = nullptr; + std::map>* content = nullptr; if (local_storage_) content = local_storage_->extension()->get_content(); if (local_disk_) @@ -359,7 +360,7 @@ void File::move(const std::string& fullpath) const int File::unlink() const { /* Check if the file is on local storage */ - std::map* content = nullptr; + std::map>* content = nullptr; const char* name = ""; if (local_storage_) { content = local_storage_->extension()->get_content(); @@ -504,12 +505,12 @@ FileSystemStorageExt::FileSystemStorageExt(const Storage* ptr) : size_(ptr->get_ content_.reset(parse_content(ptr->get_impl()->content_name_)); } -std::map* FileSystemDiskExt::parse_content(const std::string& filename) +std::map>* FileSystemDiskExt::parse_content(const std::string& filename) { if (filename.empty()) return nullptr; - auto* parse_content = new std::map(); + auto* parse_content = new std::map>(); auto fs = std::unique_ptr(surf_ifsopen(filename)); xbt_assert(not fs->fail(), "Cannot open file '%s' (path=%s)", filename.c_str(), @@ -532,12 +533,12 @@ std::map* FileSystemDiskExt::parse_content(const std::st return parse_content; } -std::map* FileSystemStorageExt::parse_content(const std::string& filename) +std::map>* FileSystemStorageExt::parse_content(const std::string& filename) { if (filename.empty()) return nullptr; - auto* parse_content = new std::map(); + auto* parse_content = new std::map>(); auto fs = std::unique_ptr(surf_ifsopen(filename)); xbt_assert(not fs->fail(), "Cannot open file '%s' (path=%s)", filename.c_str(), @@ -831,7 +832,7 @@ sg_size_t sg_storage_get_size(const_sg_storage_t st) xbt_dict_t sg_storage_get_content(const_sg_storage_t storage) { - const std::map* content = + const std::map>* content = storage->extension()->get_content(); // Note: ::operator delete is ok here (no destructor called) since the dict elements are of POD type sg_size_t. xbt_dict_t content_as_dict = xbt_dict_new_homogeneous(::operator delete); diff --git a/src/plugins/host_dvfs.cpp b/src/plugins/host_dvfs.cpp index ecf3445211..4c203c2d02 100644 --- a/src/plugins/host_dvfs.cpp +++ b/src/plugins/host_dvfs.cpp @@ -33,7 +33,7 @@ static simgrid::config::Flag cfg_governor("plugin/dvfs/governor", "Which Governor should be used that adapts the CPU frequency?", "performance", - std::map({ + std::map>({ #if HAVE_SMPI {"adagio", "TODO: Doc"}, #endif diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 8ab5462637..6ee90d7718 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -91,8 +91,8 @@ void NetZone::add_bypass_route(kernel::routing::NetPoint* src, kernel::routing:: pimpl_->add_bypass_route(src, dst, gw_src, gw_dst, link_list, symmetrical); } -void NetZone::extract_xbt_graph(const s_xbt_graph_t* graph, std::map* nodes, - std::map* edges) +void NetZone::extract_xbt_graph(const s_xbt_graph_t* graph, std::map>* nodes, + std::map>* edges) { for (auto const& child : get_children()) child->extract_xbt_graph(graph, nodes, edges); diff --git a/src/simdag/sd_daxloader.cpp b/src/simdag/sd_daxloader.cpp index 4131660a6e..4f3c9522d5 100644 --- a/src/simdag/sd_daxloader.cpp +++ b/src/simdag/sd_daxloader.cpp @@ -130,8 +130,8 @@ bool acyclic_graph_detail(const_xbt_dynar_t dag) static YY_BUFFER_STATE input_buffer; static xbt_dynar_t result; -static std::map jobs; -static std::map files; +static std::map> jobs; +static std::map> files; static SD_task_t current_job; /** @brief loads a DAX file describing a DAG diff --git a/src/smpi/colls/smpi_coll.cpp b/src/smpi/colls/smpi_coll.cpp index d4d9b10e37..68e796332a 100644 --- a/src/smpi/colls/smpi_coll.cpp +++ b/src/smpi/colls/smpi_coll.cpp @@ -20,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI colle namespace simgrid { namespace smpi { -std::map> smpi_coll_descriptions( +std::map, std::less<>> smpi_coll_descriptions( {{std::string("gather"), {{"default", "gather default collective", (void*)gather__default}, {"ompi", "gather ompi collective", (void*)gather__ompi}, diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index c9635c4f1b..5233d091fc 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -506,7 +506,7 @@ struct papi_process_data { papi_counter_t counter_data; int event_set; }; -extern std::map units2papi_setup; +extern std::map> units2papi_setup; extern std::unordered_map location2speedup; diff --git a/src/smpi/include/smpi_info.hpp b/src/smpi/include/smpi_info.hpp index 8ff3be861d..6af1f0c3c7 100644 --- a/src/smpi/include/smpi_info.hpp +++ b/src/smpi/include/smpi_info.hpp @@ -16,7 +16,7 @@ namespace simgrid{ namespace smpi{ class Info : public F2C{ - std::map map_; + std::map> map_; int refcount_ = 1; public: diff --git a/src/smpi/internals/instr_smpi.cpp b/src/smpi/internals/instr_smpi.cpp index 4fd7b76f61..0fc1251d3e 100644 --- a/src/smpi/internals/instr_smpi.cpp +++ b/src/smpi/internals/instr_smpi.cpp @@ -21,63 +21,62 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_smpi, instr, "Tracing SMPI"); static std::unordered_map> keys; -static std::map smpi_colors = {{"recv", "1 0 0"}, - {"irecv", "1 0.52 0.52"}, - {"send", "0 0 1"}, - {"isend", "0.52 0.52 1"}, - {"sendrecv", "0 1 1"}, - {"wait", "1 1 0"}, - {"waitall", "0.78 0.78 0"}, - {"waitany", "0.78 0.78 0.58"}, - {"test", "0.52 0.52 0"}, - - {"allgather", "1 0 0"}, - {"allgatherv", "1 0.52 0.52"}, - {"allreduce", "1 0 1"}, - {"alltoall", "0.52 0 1"}, - {"alltoallv", "0.78 0.52 1"}, - {"barrier", "0 0.39 0.78"}, - {"bcast", "0 0.78 0.39"}, - {"gather", "1 1 0"}, - {"gatherv", "1 1 0.52"}, - {"reduce", "0 1 0"}, - {"reducescatter", "0.52 1 0.52"}, - {"scan", "1 0.58 0.23"}, - {"exscan", "1 0.54 0.25"}, - {"scatterv", "0.52 0 0.52"}, - {"scatter", "1 0.74 0.54"}, - - {"computing", "0 1 1"}, - {"sleeping", "0 0.5 0.5"}, - - {"init", "0 1 0"}, - {"finalize", "0 1 0"}, - - {"put", "0.3 1 0"}, - {"get", "0 1 0.3"}, - {"accumulate", "1 0.3 0"}, - {"rput", "0.3 1 0"}, - {"rget", "0 1 0.3"}, - {"raccumulate", "1 0.3 0"}, - {"compare_and_swap", "0.3 1 0"}, - {"get_accumulate", "0 1 0.3"}, - {"rget_accumulate", "1 0.3 0"}, - {"win_fence", "1 0 0.3"}, - {"win_post", "1 0 0.8"}, - {"win_wait", "1 0.8 0"}, - {"win_start", "0.8 0 1"}, - {"win_complete", "0.8 1 0"}, - {"win_lock", "1 0 0.3"}, - {"win_unlock", "1 0 0.3"}, - {"win_lock_all", "1 0 0.8"}, - {"win_unlock_all", "1 0.8 0"}, - {"win_flush", "1 0 0.3"}, - {"win_flush_local", "1 0 0.8"}, - {"win_flush_all", "1 0.8 0"}, - {"win_flush_local_all", "1 0 0.3"}, - - {"file_read", "1 1 0.3"} -}; +static std::map> smpi_colors = {{"recv", "1 0 0"}, + {"irecv", "1 0.52 0.52"}, + {"send", "0 0 1"}, + {"isend", "0.52 0.52 1"}, + {"sendrecv", "0 1 1"}, + {"wait", "1 1 0"}, + {"waitall", "0.78 0.78 0"}, + {"waitany", "0.78 0.78 0.58"}, + {"test", "0.52 0.52 0"}, + + {"allgather", "1 0 0"}, + {"allgatherv", "1 0.52 0.52"}, + {"allreduce", "1 0 1"}, + {"alltoall", "0.52 0 1"}, + {"alltoallv", "0.78 0.52 1"}, + {"barrier", "0 0.39 0.78"}, + {"bcast", "0 0.78 0.39"}, + {"gather", "1 1 0"}, + {"gatherv", "1 1 0.52"}, + {"reduce", "0 1 0"}, + {"reducescatter", "0.52 1 0.52"}, + {"scan", "1 0.58 0.23"}, + {"exscan", "1 0.54 0.25"}, + {"scatterv", "0.52 0 0.52"}, + {"scatter", "1 0.74 0.54"}, + + {"computing", "0 1 1"}, + {"sleeping", "0 0.5 0.5"}, + + {"init", "0 1 0"}, + {"finalize", "0 1 0"}, + + {"put", "0.3 1 0"}, + {"get", "0 1 0.3"}, + {"accumulate", "1 0.3 0"}, + {"rput", "0.3 1 0"}, + {"rget", "0 1 0.3"}, + {"raccumulate", "1 0.3 0"}, + {"compare_and_swap", "0.3 1 0"}, + {"get_accumulate", "0 1 0.3"}, + {"rget_accumulate", "1 0.3 0"}, + {"win_fence", "1 0 0.3"}, + {"win_post", "1 0 0.8"}, + {"win_wait", "1 0.8 0"}, + {"win_start", "0.8 0 1"}, + {"win_complete", "0.8 1 0"}, + {"win_lock", "1 0 0.3"}, + {"win_unlock", "1 0 0.3"}, + {"win_lock_all", "1 0 0.8"}, + {"win_unlock_all", "1 0.8 0"}, + {"win_flush", "1 0 0.3"}, + {"win_flush_local", "1 0 0.8"}, + {"win_flush_all", "1 0.8 0"}, + {"win_flush_local_all", "1 0 0.3"}, + + {"file_read", "1 1 0.3"}}; static const char* instr_find_color(const char* c_state) { diff --git a/src/smpi/internals/smpi_deployment.cpp b/src/smpi/internals/smpi_deployment.cpp index c23f5352b1..9225be9f28 100644 --- a/src/smpi/internals/smpi_deployment.cpp +++ b/src/smpi/internals/smpi_deployment.cpp @@ -41,7 +41,7 @@ public: using simgrid::smpi::app::Instance; -static std::map smpi_instances; +static std::map> smpi_instances; /** @ingroup smpi_simulation * @brief Registers a running instance of an MPI program. diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 3d96f244ba..741fc1033f 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -63,7 +63,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (ke #if HAVE_PAPI std::string papi_default_config_name = "default"; -std::map units2papi_setup; +std::map> units2papi_setup; #endif std::unordered_map location2speedup; diff --git a/src/smpi/internals/smpi_shared.cpp b/src/smpi/internals/smpi_shared.cpp index 87838e7d85..b9c0eba4ae 100644 --- a/src/smpi/internals/smpi_shared.cpp +++ b/src/smpi/internals/smpi_shared.cpp @@ -91,7 +91,7 @@ struct shared_metadata_t { }; std::map allocs_metadata; -std::map calls; +std::map> calls; #ifndef WIN32 int smpi_shared_malloc_bogusfile = -1; diff --git a/src/smpi/plugins/ampi/instr_ampi.cpp b/src/smpi/plugins/ampi/instr_ampi.cpp index d6ea5b014f..ff99b6f871 100644 --- a/src/smpi/plugins/ampi/instr_ampi.cpp +++ b/src/smpi/plugins/ampi/instr_ampi.cpp @@ -9,9 +9,8 @@ #include #include -static std::map ampi_colors = {{"migrate", "0.2 0.5 0.2"}, - {"iteration", "0.5 0.5 0.5"} -}; +static std::map> ampi_colors = {{"migrate", "0.2 0.5 0.2"}, + {"iteration", "0.5 0.5 0.5"}}; void TRACE_Iteration_in(int rank, simgrid::instr::TIData* extra) { diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 08ae367bfb..19f5103f56 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -45,7 +45,7 @@ public: class XBT_PRIVATE HostImpl : public xbt::PropertyHolder { std::vector actors_at_boot_; s4u::Host* piface_ = nullptr; // we must have a pointer there because the VM wants to change the piface in its ctor - std::map storage_; + std::map> storage_; std::vector disks_; public: @@ -61,7 +61,10 @@ public: /** @brief Get the vector of storages (by names) attached to the Host */ virtual std::vector get_attached_storages(); std::unordered_map* get_mounted_storages(); - void set_storages(const std::map& storages) { storage_ = storages; } + void set_storages(const std::map>& storages) + { + storage_ = storages; + } s4u::Host* get_iface() const { return piface_; } diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 255ff2bb31..ce6945ee0b 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu, "Logging specific to the static simgrid::config::Flag cpu_optim_opt("cpu/optim", "Optimization algorithm to use for CPU resources. ", "Lazy", - std::map({ + std::map>({ {"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining)."}, {"TI", "Trace integration. Highly optimized mode when using availability traces (only available " "for the Cas01 CPU model for now)."}, diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 21698f75ad..fdcf7dda59 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -43,8 +43,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf, "Logging specific to the SURF network * Crude globals * *****************/ -extern std::map flow_from_sock; -extern std::map sink_from_sock; +extern std::map> flow_from_sock; +extern std::map> sink_from_sock; static ns3::InternetStackHelper stack; diff --git a/src/surf/ns3/ns3_simulator.cpp b/src/surf/ns3/ns3_simulator.cpp index fe3c36376a..8458f15a4d 100644 --- a/src/surf/ns3/ns3_simulator.cpp +++ b/src/surf/ns3/ns3_simulator.cpp @@ -16,8 +16,8 @@ #include -std::map flow_from_sock; // ns3::sock -> SgFlow -std::map sink_from_sock; // ns3::sock -> ns3::PacketSink +std::map> flow_from_sock; // ns3::sock -> SgFlow +std::map> sink_from_sock; // ns3::sock -> ns3::PacketSink static void receive_callback(ns3::Ptr socket); static void datasent_cb(ns3::Ptr socket, uint32_t dataSent); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 42f498c0aa..a6a1be4c2c 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -30,7 +30,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse); -XBT_PRIVATE std::map mount_list; +XBT_PRIVATE std::map> mount_list; XBT_PRIVATE std::vector known_storages; namespace simgrid { @@ -42,7 +42,7 @@ xbt::signal on_cluster_creation; } // namespace simgrid static int surf_parse_models_setup_already_called = 0; -std::map storage_types; +std::map> storage_types; /** The current AS in the parsing */ static simgrid::kernel::routing::NetZoneImpl* current_routing = nullptr; diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index dba05a810f..8c3eac9543 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -17,7 +17,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_storage); /************* * CallBacks * *************/ -extern std::map storage_types; +extern std::map> storage_types; void check_disk_attachment() { diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 9170f1d11d..a90436e5f4 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -34,8 +34,8 @@ std::vector all_existing_models; /* to destro simgrid::kernel::profile::FutureEvtSet future_evt_set; std::vector surf_path; /** set of hosts for which one want to be notified if they ever restart. */ -std::set watched_hosts; -extern std::map storage_types; +std::set> watched_hosts; +extern std::map> storage_types; std::vector* surf_plugin_description = nullptr; diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 6a61c06c9a..7d7c0a43df 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -30,7 +30,7 @@ extern XBT_PRIVATE double sg_bandwidth_factor; extern XBT_PRIVATE double sg_weight_S_parameter; extern XBT_PRIVATE std::vector surf_path; extern XBT_PRIVATE std::unordered_map traces_set_list; -extern XBT_PRIVATE std::set watched_hosts; +extern XBT_PRIVATE std::set> watched_hosts; static inline void double_update(double* variable, double value, double precision) { diff --git a/src/xbt/PropertyHolder.cpp b/src/xbt/PropertyHolder.cpp index cc5a7b4b77..6ed3c8a18b 100644 --- a/src/xbt/PropertyHolder.cpp +++ b/src/xbt/PropertyHolder.cpp @@ -50,7 +50,7 @@ template void PropertyHolder::set_properties(const Assoc& properti properties_->swap(props); } -template void PropertyHolder::set_properties(const std::map& properties); +template void PropertyHolder::set_properties(const std::map>& properties); template void PropertyHolder::set_properties(const std::unordered_map& properties); } // namespace xbt diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index 416dfbb3ba..0bb9605de9 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -245,9 +245,9 @@ template const char* TypedConfigurationElement::get_type_name() // class Config { private: // name -> ConfigElement: - std::map> options; + std::map, std::less<>> options; // alias -> ConfigElement from options: - std::map aliases; + std::map> aliases; bool warn_for_aliases = true; public: diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 035a0a662b..39b0195e28 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -61,7 +61,7 @@ static void display_disk_content(const simgrid::s4u::Disk* disk) { XBT_INFO("*** Dump a disk ***"); XBT_INFO("Print the content of the disk: %s", disk->get_cname()); - const std::map* content = disk->extension()->get_content(); + const auto* content = disk->extension()->get_content(); if (not content->empty()) { for (auto const& entry : *content) XBT_INFO(" %s size: %llu bytes", entry.first.c_str(), entry.second);