Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use transparent comparator 'std::less<>' with associative string container (sonar).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 16 Dec 2020 16:40:57 +0000 (17:40 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 16 Dec 2020 21:13:11 +0000 (22:13 +0100)
See https://sonarcloud.io/organizations/simgrid/rules?open=cpp%3AS6045&rule_key=cpp%3AS6045

42 files changed:
include/simgrid/kernel/routing/ClusterZone.hpp
include/simgrid/kernel/routing/EmptyZone.hpp
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/kernel/routing/RoutedZone.hpp
include/simgrid/plugins/file_system.h
include/simgrid/s4u/NetZone.hpp
include/xbt/config.hpp
src/instr/instr_interface.cpp
src/instr/instr_paje_containers.cpp
src/instr/instr_paje_containers.hpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_types.hpp
src/instr/instr_platform.cpp
src/instr/instr_private.hpp
src/kernel/EngineImpl.hpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/EmptyZone.cpp
src/kernel/routing/RoutedZone.cpp
src/mc/ModelChecker.hpp
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/host_dvfs.cpp
src/s4u/s4u_Netzone.cpp
src/simdag/sd_daxloader.cpp
src/smpi/colls/smpi_coll.cpp
src/smpi/include/private.hpp
src/smpi/include/smpi_info.hpp
src/smpi/internals/instr_smpi.cpp
src/smpi/internals/smpi_deployment.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_shared.cpp
src/smpi/plugins/ampi/instr_ampi.cpp
src/surf/HostImpl.hpp
src/surf/cpu_cas01.cpp
src/surf/network_ns3.cpp
src/surf/ns3/ns3_simulator.cpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
src/xbt/PropertyHolder.cpp
src/xbt/config.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp

index cb2923e..e7e2617 100644 (file)
@@ -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<std::string, xbt_node_t>* nodes,
-                 std::map<std::string, xbt_edge_t>* edges) override;
+  void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
+                 std::map<std::string, xbt_edge_t, std::less<>>* edges) override;
 
   virtual void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position);
   virtual void parse_specific_arguments(ClusterCreationArgs*)
index 8255827..72609db 100644 (file)
@@ -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<std::string, xbt_node_t>* /*nodes*/,
-                 std::map<std::string, xbt_edge_t>* /*edges*/) override;
+  void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* /*nodes*/,
+                 std::map<std::string, xbt_edge_t, std::less<>>* /*edges*/) override;
 };
 } // namespace routing
 } // namespace kernel
index 8ef575a..699f264 100644 (file)
@@ -147,8 +147,8 @@ public:
   static void get_global_route(routing::NetPoint* src, routing::NetPoint* dst,
                                /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
 
-  virtual void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
-                         std::map<std::string, xbt_edge_t>* edges) = 0;
+  virtual void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
+                         std::map<std::string, xbt_edge_t, std::less<>>* edges) = 0;
 };
 } // namespace routing
 } // namespace kernel
index 6a2e142..5cf45ea 100644 (file)
@@ -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<std::string, xbt_node_t>* nodes,
-                 std::map<std::string, xbt_edge_t>* edges) override;
+  void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
+                 std::map<std::string, xbt_edge_t, std::less<>>* 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<std::string, xbt_node_t>* nodes);
+                                          std::map<std::string, xbt_node_t, std::less<>>* 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<std::string, xbt_edge_t>* edges);
+                                          std::map<std::string, xbt_edge_t, std::less<>>* edges);
 
 #endif /* SIMGRID_ROUTING_GENERIC_HPP_ */
index edf943a..96c9018 100644 (file)
@@ -156,7 +156,7 @@ public:
 };
 
 class XBT_PUBLIC FileSystemDiskExt {
-  std::unique_ptr<std::map<std::string, sg_size_t>> content_;
+  std::unique_ptr<std::map<std::string, sg_size_t, std::less<>>> content_;
   std::map<Host*, std::string> 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<std::string, sg_size_t>* parse_content(const std::string& filename);
-  std::map<std::string, sg_size_t>* get_content() const { return content_.get(); }
+  std::map<std::string, sg_size_t, std::less<>>* parse_content(const std::string& filename);
+  std::map<std::string, sg_size_t, std::less<>>* 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<std::map<std::string, sg_size_t>> content_;
+  std::unique_ptr<std::map<std::string, sg_size_t, std::less<>>> 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<std::string, sg_size_t>* parse_content(const std::string& filename);
-  std::map<std::string, sg_size_t>* get_content() { return content_.get(); }
+  std::map<std::string, sg_size_t, std::less<>>* parse_content(const std::string& filename);
+  std::map<std::string, sg_size_t, std::less<>>* 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);
index 537ab6e..ac9bf41 100644 (file)
@@ -55,8 +55,8 @@ public:
   void set_property(const std::string& key, const std::string& value);
 
   std::vector<NetZone*> get_children() const;
-  void extract_xbt_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
-                         std::map<std::string, xbt_edge_t>* edges);
+  void extract_xbt_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
+                         std::map<std::string, xbt_edge_t, std::less<>>* 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 */
index eeca225..4430150 100644 (file)
@@ -153,7 +153,7 @@ template <class F>
 typename std::enable_if<std::is_same<void, decltype(std::declval<F>()(std::declval<const std::string&>()))>::value,
                         void>::type
 bind_flag(std::string& value, const char* name, const char* description,
-          const std::map<std::string, std::string>& valid_values, F callback)
+          const std::map<std::string, std::string, std::less<>>& valid_values, F callback)
 {
   declare_flag(name, description, value,
                std::function<void(const std::string&)>([&value, name, valid_values, callback](const std::string& val) {
@@ -176,7 +176,7 @@ template <class F>
 typename std::enable_if<std::is_same<void, decltype(std::declval<F>()(std::declval<const std::string&>()))>::value,
                         void>::type
 bind_flag(std::string& value, const char* name, std::initializer_list<const char*> aliases, const char* description,
-          const std::map<std::string, std::string>& valid_values, F callback)
+          const std::map<std::string, std::string, std::less<>>& 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 <class F>
-  Flag(const char* name, const char* desc, T value, const std::map<std::string, std::string>& valid_values, F callback)
+  Flag(const char* name, const char* desc, T value, const std::map<std::string, std::string, std::less<>>& 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 <class F>
   Flag(const char* name, std::initializer_list<const char*> aliases, const char* desc, T value,
-       const std::map<std::string, std::string>& valid_values, F callback)
+       const std::map<std::string, std::string, std::less<>>& valid_values, F callback)
       : value_(value), name_(name)
   {
     simgrid::config::bind_flag(value_, name, aliases, desc, valid_values, std::move(callback));
index 0635cee..3da8510 100644 (file)
@@ -17,13 +17,13 @@ enum class InstrUserVariable { DECLARE, SET, ADD, SUB };
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
 
-std::set<std::string> created_categories;
-std::set<std::string> declared_marks;
-std::set<std::string> user_host_variables;
-std::set<std::string> user_vm_variables;
-std::set<std::string> user_link_variables;
+std::set<std::string, std::less<>> created_categories;
+std::set<std::string, std::less<>> declared_marks;
+std::set<std::string, std::less<>> user_host_variables;
+std::set<std::string, std::less<>> user_vm_variables;
+std::set<std::string, std::less<>> user_link_variables;
 
-static xbt_dynar_t instr_set_to_dynar(const std::set<std::string>& filter)
+static xbt_dynar_t instr_set_to_dynar(const std::set<std::string, std::less<>>& 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<std::string>* filter)
+                                double value, InstrUserVariable what, const char* color,
+                                std::set<std::string, std::less<>>* 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())
index dbb271d..fe27724 100644 (file)
@@ -14,7 +14,7 @@ namespace simgrid {
 namespace instr {
 
 Container* Container::root_container_ = nullptr;              /* the root container */
-std::map<std::string, Container*> Container::all_containers_; /* all created containers indexed by name */
+std::map<std::string, Container*, std::less<>> Container::all_containers_; /* all created containers indexed by name */
 
 NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father)
     : Container::Container(name, "", father)
index 52a2b2d..cdb78d3 100644 (file)
@@ -18,7 +18,7 @@ class VariableType;
 
 class Container {
   static Container* root_container_;
-  static std::map<std::string, Container*> all_containers_;
+  static std::map<std::string, Container*, std::less<>> 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<std::string, Container*> children_;
+  std::map<std::string, Container*, std::less<>> children_;
 
   static Container* by_name_or_null(const std::string& name);
   static Container* by_name(const std::string& name);
index a075804..df25bde 100644 (file)
@@ -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<std::string> platform_variables;
+static std::set<std::string, std::less<>> platform_variables;
 
 namespace simgrid {
 namespace instr {
index 9b69640..51f55a3 100644 (file)
@@ -23,7 +23,7 @@ class Type {
   std::string name_;
   std::string color_;
   Type* father_;
-  std::map<std::string, std::unique_ptr<Type>> children_;
+  std::map<std::string, std::unique_ptr<Type>, 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<std::string, std::unique_ptr<Type>>& get_children() const { return children_; }
+  const std::map<std::string, std::unique_ptr<Type>, 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<std::string, EntityValue> values_;
+  std::map<std::string, EntityValue, std::less<>> 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)
index f08514b..287d531 100644 (file)
@@ -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<std::string>* filter)
+                           std::set<std::string, std::less<>>* 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<std::string>* filter)
+                                     std::set<std::string, std::less<>>* 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<std::string, xbt_node_t> nodes;
-  std::map<std::string, xbt_edge_t> edges;
+  std::map<std::string, xbt_node_t, std::less<>> nodes;
+  std::map<std::string, xbt_edge_t, std::less<>> 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<std::string, xbt_node_t> nodes;
-  std::map<std::string, xbt_edge_t> edges;
+  std::map<std::string, xbt_node_t, std::less<>> nodes;
+  std::map<std::string, xbt_edge_t, std::less<>> 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<std::string> filter;
+  std::set<std::string, std::less<>> filter;
   XBT_DEBUG("Starting graph extraction.");
   recursiveGraphExtraction(s4u::Engine::get_instance()->get_netzone_root(), Container::get_root(), &filter);
   XBT_DEBUG("Graph extraction finished.");
index 7819f95..5c7393a 100644 (file)
@@ -246,11 +246,11 @@ public:
 
 XBT_PRIVATE std::string instr_pid(simgrid::s4u::Actor const& proc);
 
-extern XBT_PRIVATE std::set<std::string> created_categories;
-extern XBT_PRIVATE std::set<std::string> declared_marks;
-extern XBT_PRIVATE std::set<std::string> user_host_variables;
-extern XBT_PRIVATE std::set<std::string> user_vm_variables;
-extern XBT_PRIVATE std::set<std::string> user_link_variables;
+extern XBT_PRIVATE std::set<std::string, std::less<>> created_categories;
+extern XBT_PRIVATE std::set<std::string, std::less<>> declared_marks;
+extern XBT_PRIVATE std::set<std::string, std::less<>> user_host_variables;
+extern XBT_PRIVATE std::set<std::string, std::less<>> user_vm_variables;
+extern XBT_PRIVATE std::set<std::string, std::less<>> user_link_variables;
 
 /* from instr_config.c */
 XBT_PRIVATE bool TRACE_needs_platform();
index 2e385c7..e28a2d5 100644 (file)
@@ -18,9 +18,9 @@ namespace simgrid {
 namespace kernel {
 
 class EngineImpl {
-  std::map<std::string, s4u::Host*> hosts_;
-  std::map<std::string, resource::LinkImpl*> links_;
-  std::map<std::string, resource::StorageImpl*> storages_;
+  std::map<std::string, s4u::Host*, std::less<>> hosts_;
+  std::map<std::string, resource::LinkImpl*, std::less<>> links_;
+  std::map<std::string, resource::StorageImpl*, std::less<>> storages_;
   std::unordered_map<std::string, routing::NetPoint*> netpoints_;
   std::unordered_map<std::string, actor::ActorCodeFactory> registered_functions; // Maps function names to actor code
   actor::ActorCodeFactory default_function; // Function to use as a fallback when the provided name matches nothing
index 21c4b65..f99e870 100644 (file)
@@ -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<std::string, xbt_node_t>* nodes,
-                            std::map<std::string, xbt_edge_t>* edges)
+void ClusterZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
+                            std::map<std::string, xbt_edge_t, std::less<>>* edges)
 {
   xbt_assert(router_,
              "Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph.");
index 7a16f45..15c5765 100644 (file)
@@ -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<std::string, xbt_node_t>* /*nodes*/,
-                          std::map<std::string, xbt_edge_t>* /*edges*/)
+void EmptyZone::get_graph(const s_xbt_graph_t* /*graph*/, std::map<std::string, xbt_node_t, std::less<>>* /*nodes*/,
+                          std::map<std::string, xbt_edge_t, std::less<>>* /*edges*/)
 {
   XBT_ERROR("No routing no graph");
 }
index f78403b..a3f1a47 100644 (file)
@@ -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<std::string, xbt_node_t>* nodes)
+xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name,
+                              std::map<std::string, xbt_node_t, std::less<>>* 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<std::string, xbt_edge_t>* edges)
+                              std::map<std::string, xbt_edge_t, std::less<>>* edges)
 {
   const auto* sn   = static_cast<const char*>(xbt_graph_node_get_data(s));
   const auto* dn   = static_cast<const char*>(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<std::string, xbt_node_t>* nodes,
-                           std::map<std::string, xbt_edge_t>* edges)
+void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
+                           std::map<std::string, xbt_edge_t, std::less<>>* edges)
 {
   std::vector<NetPoint*> vertices = get_vertices();
 
index faca1fa..dc1572c 100644 (file)
@@ -22,7 +22,7 @@ namespace mc {
 class ModelChecker {
   CheckerSide checker_side_;
   /** String pool for host names */
-  std::set<std::string> hostnames_;
+  std::set<std::string, std::less<>> hostnames_;
   // This is the parent snapshot of the current state:
   PageStore page_store_{500};
   std::unique_ptr<RemoteSimulation> remote_simulation_;
index 7308985..46c0016 100644 (file)
@@ -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<std::string, sg_size_t>* content = nullptr;
+    std::map<std::string, sg_size_t, std::less<>>* content = nullptr;
     if (local_storage_)
       content = local_storage_->extension<FileSystemStorageExt>()->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<std::string, sg_size_t>* content = local_disk_->extension<FileSystemDiskExt>()->get_content();
+    std::map<std::string, sg_size_t, std::less<>>* content = local_disk_->extension<FileSystemDiskExt>()->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<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+    std::map<std::string, sg_size_t, std::less<>>* content =
+        local_storage_->extension<FileSystemStorageExt>()->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<std::string, sg_size_t>* content = nullptr;
+    std::map<std::string, sg_size_t, std::less<>>* content = nullptr;
     if (local_storage_)
       content = local_storage_->extension<FileSystemStorageExt>()->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<std::string, sg_size_t>* content = nullptr;
+  std::map<std::string, sg_size_t, std::less<>>* content = nullptr;
   const char* name = "";
   if (local_storage_) {
     content = local_storage_->extension<FileSystemStorageExt>()->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<std::string, sg_size_t>* FileSystemDiskExt::parse_content(const std::string& filename)
+std::map<std::string, sg_size_t, std::less<>>* FileSystemDiskExt::parse_content(const std::string& filename)
 {
   if (filename.empty())
     return nullptr;
 
-  auto* parse_content = new std::map<std::string, sg_size_t>();
+  auto* parse_content = new std::map<std::string, sg_size_t, std::less<>>();
 
   auto fs = std::unique_ptr<std::ifstream>(surf_ifsopen(filename));
   xbt_assert(not fs->fail(), "Cannot open file '%s' (path=%s)", filename.c_str(),
@@ -532,12 +533,12 @@ std::map<std::string, sg_size_t>* FileSystemDiskExt::parse_content(const std::st
   return parse_content;
 }
 
-std::map<std::string, sg_size_t>* FileSystemStorageExt::parse_content(const std::string& filename)
+std::map<std::string, sg_size_t, std::less<>>* FileSystemStorageExt::parse_content(const std::string& filename)
 {
   if (filename.empty())
     return nullptr;
 
-  auto* parse_content = new std::map<std::string, sg_size_t>();
+  auto* parse_content = new std::map<std::string, sg_size_t, std::less<>>();
 
   auto fs = std::unique_ptr<std::ifstream>(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<std::string, sg_size_t>* content =
+  const std::map<std::string, sg_size_t, std::less<>>* content =
       storage->extension<simgrid::s4u::FileSystemStorageExt>()->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);
index ecf3445..4c203c2 100644 (file)
@@ -33,7 +33,7 @@ static simgrid::config::Flag<std::string> cfg_governor("plugin/dvfs/governor",
                                                        "Which Governor should be used that adapts the CPU frequency?",
                                                        "performance",
 
-                                                       std::map<std::string, std::string>({
+                                                       std::map<std::string, std::string, std::less<>>({
 #if HAVE_SMPI
                                                          {"adagio", "TODO: Doc"},
 #endif
index 8ab5462..6ee90d7 100644 (file)
@@ -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<std::string, xbt_node_t>* nodes,
-                                std::map<std::string, xbt_edge_t>* edges)
+void NetZone::extract_xbt_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
+                                std::map<std::string, xbt_edge_t, std::less<>>* edges)
 {
   for (auto const& child : get_children())
     child->extract_xbt_graph(graph, nodes, edges);
index 4131660..4f3c952 100644 (file)
@@ -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<std::string, SD_task_t> jobs;
-static std::map<std::string, SD_task_t> files;
+static std::map<std::string, SD_task_t, std::less<>> jobs;
+static std::map<std::string, SD_task_t, std::less<>> files;
 static SD_task_t current_job;
 
 /** @brief loads a DAX file describing a DAG
index d4d9b10..68e7963 100644 (file)
@@ -20,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI colle
 namespace simgrid {
 namespace smpi {
 
-std::map<std::string, std::vector<s_mpi_coll_description_t>> smpi_coll_descriptions(
+std::map<std::string, std::vector<s_mpi_coll_description_t>, std::less<>> smpi_coll_descriptions(
     {{std::string("gather"),
       {{"default", "gather default collective", (void*)gather__default},
        {"ompi", "gather ompi collective", (void*)gather__ompi},
index c9635c4..5233d09 100644 (file)
@@ -506,7 +506,7 @@ struct papi_process_data {
   papi_counter_t counter_data;
   int event_set;
 };
-extern std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
+extern std::map</* computation unit name */ std::string, papi_process_data, std::less<>> units2papi_setup;
 
 extern std::unordered_map<std::string, double> location2speedup;
 
index 8ff3be8..6af1f0c 100644 (file)
@@ -16,7 +16,7 @@ namespace simgrid{
 namespace smpi{
 
 class Info : public F2C{
-  std::map<std::string, std::string> map_;
+  std::map<std::string, std::string, std::less<>> map_;
   int refcount_ = 1;
 
 public:
index 4fd7b76..0fc1251 100644 (file)
@@ -21,63 +21,62 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_smpi, instr, "Tracing SMPI");
 
 static std::unordered_map<std::string, std::deque<std::string>> keys;
 
-static std::map<std::string, std::string> 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<std::string, std::string, std::less<>> 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)
 {
index c23f535..9225be9 100644 (file)
@@ -41,7 +41,7 @@ public:
 
 using simgrid::smpi::app::Instance;
 
-static std::map<std::string, Instance> smpi_instances;
+static std::map<std::string, Instance, std::less<>> smpi_instances;
 
 /** @ingroup smpi_simulation
  * @brief Registers a running instance of an MPI program.
index 3d96f24..741fc10 100644 (file)
@@ -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</* computation unit name */ std::string, papi_process_data> units2papi_setup;
+std::map</* computation unit name */ std::string, papi_process_data, std::less<>> units2papi_setup;
 #endif
 
 std::unordered_map<std::string, double> location2speedup;
index 87838e7..b9c0eba 100644 (file)
@@ -91,7 +91,7 @@ struct shared_metadata_t {
 };
 
 std::map<const void*, shared_metadata_t> allocs_metadata;
-std::map<std::string, void*> calls;
+std::map<std::string, void*, std::less<>> calls;
 
 #ifndef WIN32
 int smpi_shared_malloc_bogusfile           = -1;
index d6ea5b0..ff99b6f 100644 (file)
@@ -9,9 +9,8 @@
 #include <src/instr/instr_smpi.hpp>
 #include <src/smpi/include/smpi_actor.hpp>
 
-static std::map<std::string, std::string> ampi_colors = {{"migrate", "0.2 0.5 0.2"},
-  {"iteration", "0.5 0.5 0.5"}
-};
+static std::map<std::string, std::string, std::less<>> 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)
 {
index 08ae367..19f5103 100644 (file)
@@ -45,7 +45,7 @@ public:
 class XBT_PRIVATE HostImpl : public xbt::PropertyHolder {
   std::vector<kernel::actor::ProcessArg*> 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<std::string, kernel::resource::StorageImpl*> storage_;
+  std::map<std::string, kernel::resource::StorageImpl*, std::less<>> storage_;
   std::vector<kernel::resource::DiskImpl*> disks_;
 
 public:
@@ -61,7 +61,10 @@ public:
   /** @brief Get the vector of storages (by names) attached to the Host */
   virtual std::vector<const char*> get_attached_storages();
   std::unordered_map<std::string, s4u::Storage*>* get_mounted_storages();
-  void set_storages(const std::map<std::string, kernel::resource::StorageImpl*>& storages) { storage_ = storages; }
+  void set_storages(const std::map<std::string, kernel::resource::StorageImpl*, std::less<>>& storages)
+  {
+    storage_ = storages;
+  }
 
   s4u::Host* get_iface() const { return piface_; }
 
index 255ff2b..ce6945e 100644 (file)
@@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu, "Logging specific to the
 static simgrid::config::Flag<std::string>
     cpu_optim_opt("cpu/optim", "Optimization algorithm to use for CPU resources. ", "Lazy",
 
-                  std::map<std::string, std::string>({
+                  std::map<std::string, std::string, std::less<>>({
                       {"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)."},
index 21698f7..fdcf7dd 100644 (file)
@@ -43,8 +43,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf, "Logging specific to the SURF network
  * Crude globals *
  *****************/
 
-extern std::map<std::string, SgFlow*> flow_from_sock;
-extern std::map<std::string, ns3::ApplicationContainer> sink_from_sock;
+extern std::map<std::string, SgFlow*, std::less<>> flow_from_sock;
+extern std::map<std::string, ns3::ApplicationContainer, std::less<>> sink_from_sock;
 
 static ns3::InternetStackHelper stack;
 
index fe3c363..8458f15 100644 (file)
@@ -16,8 +16,8 @@
 
 #include <algorithm>
 
-std::map<std::string, SgFlow*> flow_from_sock; // ns3::sock -> SgFlow
-std::map<std::string, ns3::ApplicationContainer> sink_from_sock; // ns3::sock -> ns3::PacketSink
+std::map<std::string, SgFlow*, std::less<>> flow_from_sock;                   // ns3::sock -> SgFlow
+std::map<std::string, ns3::ApplicationContainer, std::less<>> sink_from_sock; // ns3::sock -> ns3::PacketSink
 
 static void receive_callback(ns3::Ptr<ns3::Socket> socket);
 static void datasent_cb(ns3::Ptr<ns3::Socket> socket, uint32_t dataSent);
index 42f498c..a6a1be4 100644 (file)
@@ -30,7 +30,7 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
 
-XBT_PRIVATE std::map<std::string, simgrid::kernel::resource::StorageImpl*> mount_list;
+XBT_PRIVATE std::map<std::string, simgrid::kernel::resource::StorageImpl*, std::less<>> mount_list;
 XBT_PRIVATE std::vector<std::string> known_storages;
 
 namespace simgrid {
@@ -42,7 +42,7 @@ xbt::signal<void(ClusterCreationArgs const&)> on_cluster_creation;
 } // namespace simgrid
 
 static int surf_parse_models_setup_already_called = 0;
-std::map<std::string, simgrid::kernel::resource::StorageType*> storage_types;
+std::map<std::string, simgrid::kernel::resource::StorageType*, std::less<>> storage_types;
 
 /** The current AS in the parsing */
 static simgrid::kernel::routing::NetZoneImpl* current_routing = nullptr;
index dba05a8..8c3eac9 100644 (file)
@@ -17,7 +17,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_storage);
 /*************
  * CallBacks *
  *************/
-extern std::map<std::string, simgrid::kernel::resource::StorageType*> storage_types;
+extern std::map<std::string, simgrid::kernel::resource::StorageType*, std::less<>> storage_types;
 
 void check_disk_attachment()
 {
index 9170f1d..a90436e 100644 (file)
@@ -34,8 +34,8 @@ std::vector<simgrid::kernel::resource::Model*> all_existing_models; /* to destro
 simgrid::kernel::profile::FutureEvtSet future_evt_set;
 std::vector<std::string> surf_path;
 /**  set of hosts for which one want to be notified if they ever restart. */
-std::set<std::string> watched_hosts;
-extern std::map<std::string, simgrid::kernel::resource::StorageType*> storage_types;
+std::set<std::string, std::less<>> watched_hosts;
+extern std::map<std::string, simgrid::kernel::resource::StorageType*, std::less<>> storage_types;
 
 std::vector<surf_model_description_t>* surf_plugin_description = nullptr;
 
index 6a61c06..7d7c0a4 100644 (file)
@@ -30,7 +30,7 @@ extern XBT_PRIVATE double sg_bandwidth_factor;
 extern XBT_PRIVATE double sg_weight_S_parameter;
 extern XBT_PRIVATE std::vector<std::string> surf_path;
 extern XBT_PRIVATE std::unordered_map<std::string, simgrid::kernel::profile::Profile*> traces_set_list;
-extern XBT_PRIVATE std::set<std::string> watched_hosts;
+extern XBT_PRIVATE std::set<std::string, std::less<>> watched_hosts;
 
 static inline void double_update(double* variable, double value, double precision)
 {
index cc5a7b4..6ed3c8a 100644 (file)
@@ -50,7 +50,7 @@ template <class Assoc> void PropertyHolder::set_properties(const Assoc& properti
   properties_->swap(props);
 }
 
-template void PropertyHolder::set_properties(const std::map<std::string, std::string>& properties);
+template void PropertyHolder::set_properties(const std::map<std::string, std::string, std::less<>>& properties);
 template void PropertyHolder::set_properties(const std::unordered_map<std::string, std::string>& properties);
 
 } // namespace xbt
index 416dfbb..0bb9605 100644 (file)
@@ -245,9 +245,9 @@ template <class T> const char* TypedConfigurationElement<T>::get_type_name() //
 class Config {
 private:
   // name -> ConfigElement:
-  std::map<std::string, std::unique_ptr<ConfigurationElement>> options;
+  std::map<std::string, std::unique_ptr<ConfigurationElement>, std::less<>> options;
   // alias -> ConfigElement from options:
-  std::map<std::string, ConfigurationElement*> aliases;
+  std::map<std::string, ConfigurationElement*, std::less<>> aliases;
   bool warn_for_aliases = true;
 
 public:
index 035a0a6..39b0195 100644 (file)
@@ -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<std::string, sg_size_t>* content = disk->extension<simgrid::s4u::FileSystemDiskExt>()->get_content();
+  const auto* content = disk->extension<simgrid::s4u::FileSystemDiskExt>()->get_content();
   if (not content->empty()) {
     for (auto const& entry : *content)
       XBT_INFO("  %s size: %llu bytes", entry.first.c_str(), entry.second);