From 88474126433cd47e2289512aef9f6e0ddd260a4a Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Mon, 30 May 2016 16:09:24 +0200 Subject: [PATCH] Make some constructors explicit --- include/simgrid/s4u/As.hpp | 2 +- include/simgrid/s4u/actor.hpp | 2 +- include/simgrid/s4u/host.hpp | 2 +- include/simgrid/simix.hpp | 2 +- src/mc/Channel.hpp | 2 +- src/mc/Client.hpp | 2 +- src/simix/SynchroComm.hpp | 2 +- src/surf/AsCluster.hpp | 2 +- src/surf/AsClusterFatTree.hpp | 2 +- src/surf/AsClusterTorus.hpp | 2 +- src/surf/AsFloyd.hpp | 2 +- src/surf/AsFull.hpp | 2 +- src/surf/AsImpl.hpp | 2 +- src/surf/AsNone.hpp | 2 +- src/surf/AsRoutedGraph.hpp | 2 +- src/surf/AsVivaldi.hpp | 2 +- src/surf/PropertyHolder.hpp | 2 +- src/surf/cpu_ti.hpp | 2 +- src/surf/network_ib.hpp | 4 ++-- src/surf/plugins/energy.hpp | 2 +- src/surf/surf_routing.hpp | 2 +- teshsuite/surf/trace_usage/trace_usage.cpp | 2 +- 22 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/simgrid/s4u/As.hpp b/include/simgrid/s4u/As.hpp index 370edfc224..8e92e0426d 100644 --- a/include/simgrid/s4u/As.hpp +++ b/include/simgrid/s4u/As.hpp @@ -33,7 +33,7 @@ XBT_PUBLIC_CLASS As { protected: friend simgrid::surf::AsImpl; - As(const char *name); + explicit As(const char *name); virtual ~As(); public: diff --git a/include/simgrid/s4u/actor.hpp b/include/simgrid/s4u/actor.hpp index 7044347b65..fd818b7454 100644 --- a/include/simgrid/s4u/actor.hpp +++ b/include/simgrid/s4u/actor.hpp @@ -40,7 +40,7 @@ namespace s4u { * */ XBT_PUBLIC_CLASS Actor { - Actor(smx_process_t smx_proc); + explicit Actor(smx_process_t smx_proc); public: Actor(const char* name, s4u::Host *host, double killTime, std::function code); Actor(const char* name, s4u::Host *host, std::function code) diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index c129ad221b..3cec9864d0 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -41,7 +41,7 @@ XBT_PUBLIC_CLASS Host : public simgrid::xbt::Extendable { private: - Host(const char *name); + explicit Host(const char *name); public: // TODO, make me private ~Host(); public: diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index ad30d41907..c1b6a8212a 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -61,7 +61,7 @@ private: std::string name_; public: - ContextFactory(std::string name) : name_(std::move(name)) {} + explicit ContextFactory(std::string name) : name_(std::move(name)) {} virtual ~ContextFactory(); virtual Context* create_context(std::function code, void_pfn_smxprocess_t cleanup, smx_process_t process) = 0; diff --git a/src/mc/Channel.hpp b/src/mc/Channel.hpp index 5ede34f106..4766e163c9 100644 --- a/src/mc/Channel.hpp +++ b/src/mc/Channel.hpp @@ -31,7 +31,7 @@ class Channel { public: Channel() {} - Channel(int sock) : socket_(sock) {} + explicit Channel(int sock) : socket_(sock) {} ~Channel(); // No copy: diff --git a/src/mc/Client.hpp b/src/mc/Client.hpp index 36a6578c83..9c6c642a24 100644 --- a/src/mc/Client.hpp +++ b/src/mc/Client.hpp @@ -33,7 +33,7 @@ private: static std::unique_ptr client_; public: Client(); - Client(int fd) : active_(true), channel_(fd) {} + explicit Client(int fd) : active_(true), channel_(fd) {} void handleMessages(); Channel const& getChannel() const { return channel_; } Channel& getChannel() { return channel_; } diff --git a/src/simix/SynchroComm.hpp b/src/simix/SynchroComm.hpp index eca91c9828..fe672fc7b8 100644 --- a/src/simix/SynchroComm.hpp +++ b/src/simix/SynchroComm.hpp @@ -22,7 +22,7 @@ namespace simix { XBT_PUBLIC_CLASS Comm : public Synchro { ~Comm() override; public: - Comm(e_smx_comm_type_t type); + explicit Comm(e_smx_comm_type_t type); void suspend() override; void resume() override; void post() override; diff --git a/src/surf/AsCluster.hpp b/src/surf/AsCluster.hpp index 9271732df4..aeaeb65b36 100644 --- a/src/surf/AsCluster.hpp +++ b/src/surf/AsCluster.hpp @@ -13,7 +13,7 @@ namespace surf { class XBT_PRIVATE AsCluster: public AsImpl { public: - AsCluster(const char*name); + explicit AsCluster(const char*name); ~AsCluster(); virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; diff --git a/src/surf/AsClusterFatTree.hpp b/src/surf/AsClusterFatTree.hpp index e4cb4c057f..f6aef466dc 100644 --- a/src/surf/AsClusterFatTree.hpp +++ b/src/surf/AsClusterFatTree.hpp @@ -101,7 +101,7 @@ public: */ class XBT_PRIVATE AsClusterFatTree : public AsCluster { public: - AsClusterFatTree(const char*name); + explicit AsClusterFatTree(const char*name); ~AsClusterFatTree(); virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, diff --git a/src/surf/AsClusterTorus.hpp b/src/surf/AsClusterTorus.hpp index 58f747897d..59d059388c 100644 --- a/src/surf/AsClusterTorus.hpp +++ b/src/surf/AsClusterTorus.hpp @@ -13,7 +13,7 @@ namespace simgrid { class XBT_PRIVATE AsClusterTorus:public simgrid::surf::AsCluster { public: - AsClusterTorus(const char*name); + explicit AsClusterTorus(const char*name); virtual ~AsClusterTorus(); void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override; void getRouteAndLatency(NetCard * src, NetCard * dst, sg_platf_route_cbarg_t into, double *latency) override; diff --git a/src/surf/AsFloyd.hpp b/src/surf/AsFloyd.hpp index 4c04f39289..1524311f7c 100644 --- a/src/surf/AsFloyd.hpp +++ b/src/surf/AsFloyd.hpp @@ -14,7 +14,7 @@ namespace surf { /** Floyd routing data: slow initialization, fast lookup, lesser memory requirements, shortest path routing only */ class XBT_PRIVATE AsFloyd: public AsRoutedGraph { public: - AsFloyd(const char *name); + explicit AsFloyd(const char *name); ~AsFloyd(); void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; diff --git a/src/surf/AsFull.hpp b/src/surf/AsFull.hpp index f91b021d91..a9fd274d19 100644 --- a/src/surf/AsFull.hpp +++ b/src/surf/AsFull.hpp @@ -15,7 +15,7 @@ namespace surf { class XBT_PRIVATE AsFull: public AsRoutedGraph { public: - AsFull(const char*name); + explicit AsFull(const char*name); void seal() override; ~AsFull(); diff --git a/src/surf/AsImpl.hpp b/src/surf/AsImpl.hpp index 2e498580c7..f196fb7783 100644 --- a/src/surf/AsImpl.hpp +++ b/src/surf/AsImpl.hpp @@ -27,7 +27,7 @@ namespace surf { XBT_PUBLIC_CLASS AsImpl : public s4u::As { friend simgrid::surf::RoutingPlatf; protected: - AsImpl(const char *name); + explicit AsImpl(const char *name); ~AsImpl(); public: diff --git a/src/surf/AsNone.hpp b/src/surf/AsNone.hpp index 9976d1b5c3..c1a2cab8cf 100644 --- a/src/surf/AsNone.hpp +++ b/src/surf/AsNone.hpp @@ -14,7 +14,7 @@ namespace surf { /** No specific routing. Mainly useful with the constant network model */ class XBT_PRIVATE AsNone : public AsImpl { public: - AsNone(const char*name); + explicit AsNone(const char*name); ~AsNone(); void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; diff --git a/src/surf/AsRoutedGraph.hpp b/src/surf/AsRoutedGraph.hpp index 4079e8f14f..144e9fb863 100644 --- a/src/surf/AsRoutedGraph.hpp +++ b/src/surf/AsRoutedGraph.hpp @@ -13,7 +13,7 @@ namespace surf { class XBT_PRIVATE AsRoutedGraph : public AsImpl { public: - AsRoutedGraph(const char*name); + explicit AsRoutedGraph(const char*name); ~AsRoutedGraph(); xbt_dynar_t getOneLinkRoutes() override; diff --git a/src/surf/AsVivaldi.hpp b/src/surf/AsVivaldi.hpp index 3903496c65..94504eae05 100644 --- a/src/surf/AsVivaldi.hpp +++ b/src/surf/AsVivaldi.hpp @@ -14,7 +14,7 @@ namespace surf { /* This derivates from cluster because each host has a private link */ class XBT_PRIVATE AsVivaldi: public AsCluster { public: - AsVivaldi(const char *name); + explicit AsVivaldi(const char *name); ~AsVivaldi() {}; xbt_dynar_t getOneLinkRoutes() override {return NULL;}; diff --git a/src/surf/PropertyHolder.hpp b/src/surf/PropertyHolder.hpp index 3d2cdf1d82..d58c486307 100644 --- a/src/surf/PropertyHolder.hpp +++ b/src/surf/PropertyHolder.hpp @@ -17,7 +17,7 @@ namespace surf { class PropertyHolder { // DO NOT DERIVE THIS CLASS, or the diamond inheritance mayhem will get you public: - PropertyHolder(xbt_dict_t props); + explicit PropertyHolder(xbt_dict_t props); ~PropertyHolder(); const char *getProperty(const char*id); diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 9d3491d8c6..c635170b74 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -32,7 +32,7 @@ struct tiTag; *********/ class CpuTiTrace { public: - CpuTiTrace(tmgr_trace_t speedTrace); + explicit CpuTiTrace(tmgr_trace_t speedTrace); ~CpuTiTrace(); double integrateSimple(double a, double b); diff --git a/src/surf/network_ib.hpp b/src/surf/network_ib.hpp index b8357fb559..a457a61f3c 100644 --- a/src/surf/network_ib.hpp +++ b/src/surf/network_ib.hpp @@ -35,7 +35,7 @@ namespace simgrid { std::map ActiveCommsDown; //number of comms the node is receiving int nbActiveCommsDown; - IBNode(int id) : id(id),nbActiveCommsDown(0){}; + explicit IBNode(int id) : id(id),nbActiveCommsDown(0){}; ~IBNode(){}; }; @@ -45,7 +45,7 @@ namespace simgrid { void computeIBfactors(IBNode *root); public: NetworkIBModel(); - NetworkIBModel(const char *name); + explicit NetworkIBModel(const char *name); ~NetworkIBModel(); void updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove); diff --git a/src/surf/plugins/energy.hpp b/src/surf/plugins/energy.hpp index 59db005032..2d9709c26d 100644 --- a/src/surf/plugins/energy.hpp +++ b/src/surf/plugins/energy.hpp @@ -25,7 +25,7 @@ public: static simgrid::xbt::Extension EXTENSION_ID; typedef std::pair power_range; - HostEnergy(simgrid::s4u::Host *ptr); + explicit HostEnergy(simgrid::s4u::Host *ptr); ~HostEnergy(); double getCurrentWattsValue(double cpu_load); diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index e48ee7b001..e404638daa 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -100,7 +100,7 @@ public: */ XBT_PUBLIC_CLASS RoutingPlatf { public: - RoutingPlatf(Link *loopback); + explicit RoutingPlatf(Link *loopback); ~RoutingPlatf(); AsImpl *root_ = nullptr; Link *loopback_; diff --git a/teshsuite/surf/trace_usage/trace_usage.cpp b/teshsuite/surf/trace_usage/trace_usage.cpp index 6b04385abd..30a48c40d6 100644 --- a/teshsuite/surf/trace_usage/trace_usage.cpp +++ b/teshsuite/surf/trace_usage/trace_usage.cpp @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example"); class DummyTestResource : public simgrid::surf::Resource { public: - DummyTestResource(const char *name) : Resource(nullptr,name) {} + explicit DummyTestResource(const char *name) : Resource(nullptr,name) {} bool isUsed() override {return false;} void apply_event(tmgr_trace_iterator_t it, double value) override {} }; -- 2.20.1