From cc4eceb15c80a597e44222b8c0ff60caf85db959 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 27 Feb 2019 15:11:36 +0100 Subject: [PATCH] Enforce "Rule-of-Three/Five". --- .../s4u/app-bittorrent/s4u-bittorrent.hpp | 2 ++ examples/s4u/dht-chord/s4u-dht-chord.hpp | 2 ++ examples/s4u/dht-kademlia/message.hpp | 2 ++ include/simgrid/Exception.hpp | 3 +-- include/simgrid/jedule/jedule.hpp | 2 ++ include/simgrid/jedule/jedule_events.hpp | 2 ++ include/simgrid/jedule/jedule_platform.hpp | 2 ++ include/simgrid/kernel/future.hpp | 1 + include/simgrid/kernel/resource/Action.hpp | 2 ++ include/simgrid/kernel/resource/Model.hpp | 2 ++ .../simgrid/kernel/routing/DijkstraZone.hpp | 4 +++- .../simgrid/kernel/routing/DragonflyZone.hpp | 4 ++++ .../simgrid/kernel/routing/FatTreeZone.hpp | 2 ++ include/simgrid/kernel/routing/FloydZone.hpp | 2 ++ include/simgrid/kernel/routing/FullZone.hpp | 4 +++- .../simgrid/kernel/routing/NetZoneImpl.hpp | 2 ++ include/simgrid/plugins/file_system.h | 6 ++++++ include/xbt/Extendable.hpp | 2 ++ include/xbt/backtrace.hpp | 3 +++ src/instr/instr_paje_containers.hpp | 2 ++ src/kernel/EngineImpl.hpp | 2 ++ src/kernel/context/Context.hpp | 5 ++++- src/kernel/context/ContextSwapped.hpp | 4 ++++ src/kernel/context/ContextThread.hpp | 4 ++++ src/kernel/resource/profile/trace_mgr.hpp | 2 ++ src/mc/mc_unw.hpp | 1 + src/msg/msg_private.hpp | 4 +++- src/simix/ActorImpl.hpp | 2 ++ src/smpi/include/smpi_actor.hpp | 2 ++ src/smpi/include/smpi_datatype.hpp | 2 ++ src/smpi/include/smpi_datatype_derived.hpp | 8 +++++++ src/smpi/include/smpi_topo.hpp | 6 ++++++ src/smpi/include/smpi_win.hpp | 2 ++ src/surf/PropertyHolder.hpp | 2 ++ src/surf/StorageImpl.hpp | 4 ++++ src/surf/cpu_cas01.hpp | 6 ++++++ src/surf/cpu_interface.hpp | 2 ++ src/surf/cpu_ti.hpp | 6 ++++++ src/surf/network_ib.hpp | 2 ++ src/surf/network_interface.hpp | 4 ++++ src/surf/ptask_L07.hpp | 12 +++++++++++ src/xbt/backtrace.cpp | 21 +++++++++++++++++++ 42 files changed, 148 insertions(+), 6 deletions(-) diff --git a/examples/s4u/app-bittorrent/s4u-bittorrent.hpp b/examples/s4u/app-bittorrent/s4u-bittorrent.hpp index 4b1728bfd0..69759e6ea4 100644 --- a/examples/s4u/app-bittorrent/s4u-bittorrent.hpp +++ b/examples/s4u/app-bittorrent/s4u-bittorrent.hpp @@ -90,6 +90,8 @@ public: std::string descr = std::string("RngSream<") + host->get_cname() + ">"; stream_ = RngStream_CreateStream(descr.c_str()); } + HostBittorrent(const HostBittorrent&) = delete; + HostBittorrent& operator=(const HostBittorrent&) = delete; ~HostBittorrent() { RngStream_DeleteStream(&stream_); }; diff --git a/examples/s4u/dht-chord/s4u-dht-chord.hpp b/examples/s4u/dht-chord/s4u-dht-chord.hpp index 0ca638a9e9..7db25b19da 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord.hpp +++ b/examples/s4u/dht-chord/s4u-dht-chord.hpp @@ -33,6 +33,8 @@ public: std::string descr = std::string("RngSream<") + host->get_cname() + ">"; stream_ = RngStream_CreateStream(descr.c_str()); } + HostChord(const HostChord&) = delete; + HostChord& operator=(const HostChord&) = delete; ~HostChord() { RngStream_DeleteStream(&stream_); }; diff --git a/examples/s4u/dht-kademlia/message.hpp b/examples/s4u/dht-kademlia/message.hpp index 5a19b91a57..04306c0aae 100644 --- a/examples/s4u/dht-kademlia/message.hpp +++ b/examples/s4u/dht-kademlia/message.hpp @@ -33,6 +33,8 @@ public: : Message(sender_id, destination_id, nullptr, mailbox, hostname) { } + Message(const Message&) = delete; + Message& operator=(const Message&) = delete; ~Message() { if (issuer_host_name_) diff --git a/include/simgrid/Exception.hpp b/include/simgrid/Exception.hpp index 0e2ce75440..6de2686a3d 100644 --- a/include/simgrid/Exception.hpp +++ b/include/simgrid/Exception.hpp @@ -53,8 +53,7 @@ public: /** Create a ThrowPoint with (__FILE__, __LINE__, __func__) */ #define XBT_THROW_POINT \ - ::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__, std::move(simgrid::xbt::Backtrace()), xbt_procname(), \ - xbt_getpid()) + ::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid()) } // namespace xbt /** Ancestor class of all SimGrid exception */ diff --git a/include/simgrid/jedule/jedule.hpp b/include/simgrid/jedule/jedule.hpp index 0fe85320be..fd39db599c 100644 --- a/include/simgrid/jedule/jedule.hpp +++ b/include/simgrid/jedule/jedule.hpp @@ -17,6 +17,8 @@ namespace jedule{ class XBT_PUBLIC Jedule { public: Jedule()=default; + Jedule(const Jedule&) = delete; + Jedule& operator=(const Jedule&) = delete; ~Jedule(); std::vector event_set_; Container* root_container_ = nullptr; diff --git a/include/simgrid/jedule/jedule_events.hpp b/include/simgrid/jedule/jedule_events.hpp index d57b8646fa..21e4aa9826 100644 --- a/include/simgrid/jedule/jedule_events.hpp +++ b/include/simgrid/jedule/jedule_events.hpp @@ -20,6 +20,8 @@ namespace jedule{ class XBT_PUBLIC Event { public: Event(std::string name, double start_time, double end_time, std::string type); + Event(const Event&) = delete; + Event& operator=(const Event&) = delete; ~Event(); void add_characteristic(char* characteristic); void add_resources(std::vector* host_selection); diff --git a/include/simgrid/jedule/jedule_platform.hpp b/include/simgrid/jedule/jedule_platform.hpp index 5ce6ae06fc..0d8cf5ca16 100644 --- a/include/simgrid/jedule/jedule_platform.hpp +++ b/include/simgrid/jedule/jedule_platform.hpp @@ -18,6 +18,8 @@ namespace jedule{ class XBT_PUBLIC Container { public: explicit Container(std::string name); + Container(const Container&) = delete; + Container& operator=(const Container&) = delete; virtual ~Container(); private: int last_id_; diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index 810e9dd233..10ec3e003e 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -291,6 +291,7 @@ class Future { public: Future() = default; explicit Future(std::shared_ptr> state) : state_(std::move(state)) {} + ~Future() = default; // Move type: Future(Future&) = delete; diff --git a/include/simgrid/kernel/resource/Action.hpp b/include/simgrid/kernel/resource/Action.hpp index bde56a29e8..6ce0e7cc7f 100644 --- a/include/simgrid/kernel/resource/Action.hpp +++ b/include/simgrid/kernel/resource/Action.hpp @@ -98,6 +98,8 @@ public: * @param var The lmm variable associated to this Action if it is part of a LMM component */ Action(Model* model, double cost, bool failed, lmm::Variable* var); + Action(const Action&) = delete; + Action& operator=(const Action&) = delete; virtual ~Action(); diff --git a/include/simgrid/kernel/resource/Model.hpp b/include/simgrid/kernel/resource/Model.hpp index 9520ef28a8..49918bb978 100644 --- a/include/simgrid/kernel/resource/Model.hpp +++ b/include/simgrid/kernel/resource/Model.hpp @@ -28,6 +28,8 @@ public: }; explicit Model(Model::UpdateAlgo algo); + Model(const Model&) = delete; + Model& operator=(const Model&) = delete; virtual ~Model(); diff --git a/include/simgrid/kernel/routing/DijkstraZone.hpp b/include/simgrid/kernel/routing/DijkstraZone.hpp index c180b75825..3ae74ff881 100644 --- a/include/simgrid/kernel/routing/DijkstraZone.hpp +++ b/include/simgrid/kernel/routing/DijkstraZone.hpp @@ -25,7 +25,8 @@ namespace routing { class XBT_PRIVATE DijkstraZone : public RoutedZone { public: DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached); - void seal() override; + DijkstraZone(const DijkstraZone&) = delete; + DijkstraZone& operator=(const DijkstraZone&) = delete; ~DijkstraZone() override; @@ -46,6 +47,7 @@ public: * After this function returns, any node in the graph * will have a loopback attached to it. */ + void seal() override; void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override; void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, std::vector& link_list, bool symmetrical) override; diff --git a/include/simgrid/kernel/routing/DragonflyZone.hpp b/include/simgrid/kernel/routing/DragonflyZone.hpp index aaec77a7f2..f1c16f48c8 100644 --- a/include/simgrid/kernel/routing/DragonflyZone.hpp +++ b/include/simgrid/kernel/routing/DragonflyZone.hpp @@ -23,6 +23,8 @@ public: resource::LinkImpl** green_links_ = nullptr; resource::LinkImpl** my_nodes_ = nullptr; DragonflyRouter(int i, int j, int k); + DragonflyRouter(const DragonflyRouter&) = delete; + DragonflyRouter& operator=(const DragonflyRouter&) = delete; ~DragonflyRouter(); }; @@ -62,6 +64,8 @@ public: class XBT_PUBLIC DragonflyZone : public ClusterZone { public: explicit DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel); + DragonflyZone(const DragonflyZone&) = delete; + DragonflyZone& operator=(const DragonflyZone&) = delete; ~DragonflyZone() override; // void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override; void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; diff --git a/include/simgrid/kernel/routing/FatTreeZone.hpp b/include/simgrid/kernel/routing/FatTreeZone.hpp index bcc3f5a8aa..9539888cc9 100644 --- a/include/simgrid/kernel/routing/FatTreeZone.hpp +++ b/include/simgrid/kernel/routing/FatTreeZone.hpp @@ -99,6 +99,8 @@ public: class XBT_PRIVATE FatTreeZone : public ClusterZone { public: explicit FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel); + FatTreeZone(const FatTreeZone&) = delete; + FatTreeZone& operator=(const FatTreeZone&) = delete; ~FatTreeZone() override; void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; diff --git a/include/simgrid/kernel/routing/FloydZone.hpp b/include/simgrid/kernel/routing/FloydZone.hpp index 0ecc05b9e8..6bebe5c696 100644 --- a/include/simgrid/kernel/routing/FloydZone.hpp +++ b/include/simgrid/kernel/routing/FloydZone.hpp @@ -24,6 +24,8 @@ namespace routing { class XBT_PRIVATE FloydZone : public RoutedZone { public: explicit FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel); + FloydZone(const FloydZone&) = delete; + FloydZone& operator=(const FloydZone&) = delete; ~FloydZone() override; void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; diff --git a/include/simgrid/kernel/routing/FullZone.hpp b/include/simgrid/kernel/routing/FullZone.hpp index 87f4c5d8b4..2cf77e7243 100644 --- a/include/simgrid/kernel/routing/FullZone.hpp +++ b/include/simgrid/kernel/routing/FullZone.hpp @@ -21,9 +21,11 @@ namespace routing { class XBT_PRIVATE FullZone : public RoutedZone { public: explicit FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel); - void seal() override; + FullZone(const FullZone&) = delete; + FullZone& operator=(const FullZone) = delete; ~FullZone() override; + void seal() override; void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, std::vector& link_list, bool symmetrical) override; diff --git a/include/simgrid/kernel/routing/NetZoneImpl.hpp b/include/simgrid/kernel/routing/NetZoneImpl.hpp index cb5b62f682..b8720fa5d0 100644 --- a/include/simgrid/kernel/routing/NetZoneImpl.hpp +++ b/include/simgrid/kernel/routing/NetZoneImpl.hpp @@ -52,6 +52,8 @@ class XBT_PUBLIC NetZoneImpl { protected: explicit NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model); + NetZoneImpl(const NetZoneImpl&) = delete; + NetZoneImpl& operator=(const NetZoneImpl&) = delete; virtual ~NetZoneImpl(); public: diff --git a/include/simgrid/plugins/file_system.h b/include/simgrid/plugins/file_system.h index 0df1458397..7538d38918 100644 --- a/include/simgrid/plugins/file_system.h +++ b/include/simgrid/plugins/file_system.h @@ -90,6 +90,8 @@ class XBT_PUBLIC File { public: File(std::string fullpath, void* userdata); File(std::string fullpath, sg_host_t host, void* userdata); + File(const File&) = delete; + File& operator=(const File&) = delete; ~File(); /** Retrieves the path to the file */ @@ -135,6 +137,8 @@ class XBT_PUBLIC FileSystemStorageExt { public: static simgrid::xbt::Extension EXTENSION_ID; explicit FileSystemStorageExt(Storage* ptr); + FileSystemStorageExt(const FileSystemStorageExt&) = delete; + FileSystemStorageExt& operator=(const FileSystemStorageExt&) = delete; ~FileSystemStorageExt(); std::map* parse_content(const std::string& filename); std::map* get_content() { return content_; } @@ -153,6 +157,8 @@ class XBT_PUBLIC FileDescriptorHostExt { public: static simgrid::xbt::Extension EXTENSION_ID; FileDescriptorHostExt() = default; + FileDescriptorHostExt(const FileDescriptorHostExt&) = delete; + FileDescriptorHostExt& operator=(const FileDescriptorHostExt&) = delete; ~FileDescriptorHostExt() { delete file_descriptor_table; } std::vector* file_descriptor_table = nullptr; // Created lazily on need }; diff --git a/include/xbt/Extendable.hpp b/include/xbt/Extendable.hpp index b6be879ebd..a157c6751c 100644 --- a/include/xbt/Extendable.hpp +++ b/include/xbt/Extendable.hpp @@ -67,6 +67,8 @@ public: return Extension(extension_create([](void* p) { delete static_cast(p); })); } Extendable() : extensions_(deleters_.size(), nullptr) {} + Extendable(const Extendable&) = delete; + Extendable& operator=(const Extendable&) = delete; ~Extendable() { /* Call destructors in reverse order of their registrations diff --git a/include/xbt/backtrace.hpp b/include/xbt/backtrace.hpp index 35dc7b7ecf..220ed64a67 100644 --- a/include/xbt/backtrace.hpp +++ b/include/xbt/backtrace.hpp @@ -40,6 +40,9 @@ public: BacktraceImpl* impl_ = nullptr; Backtrace(); Backtrace(const Backtrace& bt); + Backtrace(Backtrace&& bt); + Backtrace& operator=(const Backtrace& rhs); + Backtrace& operator=(Backtrace&& rhs); ~Backtrace(); /** @brief Translate the backtrace in a human friendly form, unmangled with source code locations. */ std::string const resolve() const; diff --git a/src/instr/instr_paje_containers.hpp b/src/instr/instr_paje_containers.hpp index 3e27997aa5..da60460031 100644 --- a/src/instr/instr_paje_containers.hpp +++ b/src/instr/instr_paje_containers.hpp @@ -21,6 +21,8 @@ class Container { std::string name_; /* Unique name of this container */ public: Container(std::string name, const std::string& type_name, Container* father); + Container(const Container&) = delete; + Container& operator=(const Container&) = delete; virtual ~Container(); Type* type_; /* Type of this container */ diff --git a/src/kernel/EngineImpl.hpp b/src/kernel/EngineImpl.hpp index 58c0b63feb..27530d9b10 100644 --- a/src/kernel/EngineImpl.hpp +++ b/src/kernel/EngineImpl.hpp @@ -15,6 +15,8 @@ namespace kernel { class EngineImpl { public: EngineImpl(); + EngineImpl(const EngineImpl&) = delete; + EngineImpl& operator=(const EngineImpl&) = delete; virtual ~EngineImpl(); kernel::routing::NetZoneImpl* netzone_root_ = nullptr; diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index e1e7bf10d6..4486bd0d95 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -19,6 +19,8 @@ namespace context { class XBT_PUBLIC ContextFactory { public: explicit ContextFactory() {} + ContextFactory(const ContextFactory&) = delete; + ContextFactory& operator=(const ContextFactory&) = delete; virtual ~ContextFactory(); virtual Context* create_context(std::function code, smx_actor_t actor) = 0; @@ -71,7 +73,8 @@ public: class XBT_PUBLIC AttachContext : public Context { public: AttachContext(std::function code, smx_actor_t actor) : Context(std::move(code), actor) {} - + AttachContext(const AttachContext&) = delete; + AttachContext& operator=(const AttachContext&) = delete; ~AttachContext() override; /** Called by the context when it is ready to give control diff --git a/src/kernel/context/ContextSwapped.hpp b/src/kernel/context/ContextSwapped.hpp index 507fbb0bcd..0195e1b7c0 100644 --- a/src/kernel/context/ContextSwapped.hpp +++ b/src/kernel/context/ContextSwapped.hpp @@ -19,6 +19,8 @@ class SwappedContextFactory : public ContextFactory { friend SwappedContext; // Reads whether we are in parallel mode public: SwappedContextFactory(); + SwappedContextFactory(const SwappedContextFactory&) = delete; + SwappedContextFactory& operator=(const SwappedContextFactory&) = delete; ~SwappedContextFactory() override; void run_all() override; @@ -36,6 +38,8 @@ private: class SwappedContext : public Context { public: SwappedContext(std::function code, smx_actor_t get_actor, SwappedContextFactory* factory); + SwappedContext(const SwappedContext&) = delete; + SwappedContext& operator=(const SwappedContext&) = delete; virtual ~SwappedContext(); void suspend() override; diff --git a/src/kernel/context/ContextThread.hpp b/src/kernel/context/ContextThread.hpp index 6f6125a59b..47be1bb773 100644 --- a/src/kernel/context/ContextThread.hpp +++ b/src/kernel/context/ContextThread.hpp @@ -21,6 +21,8 @@ namespace context { class XBT_PUBLIC ThreadContext : public AttachContext { public: ThreadContext(std::function code, smx_actor_t actor, bool maestro); + ThreadContext(const ThreadContext&) = delete; + ThreadContext& operator=(const ThreadContext&) = delete; ~ThreadContext() override; void stop() override; void suspend() override; @@ -80,6 +82,8 @@ private: class ThreadContextFactory : public ContextFactory { public: ThreadContextFactory(); + ThreadContextFactory(const ThreadContextFactory&) = delete; + ThreadContextFactory& operator=(const ThreadContextFactory&) = delete; ~ThreadContextFactory() override; ThreadContext* create_context(std::function code, smx_actor_t actor) override { diff --git a/src/kernel/resource/profile/trace_mgr.hpp b/src/kernel/resource/profile/trace_mgr.hpp index 16c33e1356..c0abe9e5ff 100644 --- a/src/kernel/resource/profile/trace_mgr.hpp +++ b/src/kernel/resource/profile/trace_mgr.hpp @@ -94,6 +94,8 @@ private: class XBT_PUBLIC FutureEvtSet { public: FutureEvtSet(); + FutureEvtSet(const FutureEvtSet&) = delete; + FutureEvtSet& operator=(const FutureEvtSet&) = delete; virtual ~FutureEvtSet(); double next_date() const; Event* pop_leq(double date, double* value, resource::Resource** resource); diff --git a/src/mc/mc_unw.hpp b/src/mc/mc_unw.hpp index 466b3dfe04..4e949d4139 100644 --- a/src/mc/mc_unw.hpp +++ b/src/mc/mc_unw.hpp @@ -50,6 +50,7 @@ class UnwindContext { public: UnwindContext() = default; UnwindContext(const UnwindContext&) = default; + UnwindContext& operator=(const UnwindContext&) = default; ~UnwindContext() { clear(); } void initialize(simgrid::mc::RemoteClient* process, unw_context_t* c); void clear(); diff --git a/src/msg/msg_private.hpp b/src/msg/msg_private.hpp index 42fae27d45..0b832dedf7 100644 --- a/src/msg/msg_private.hpp +++ b/src/msg/msg_private.hpp @@ -21,7 +21,6 @@ class Task { long long int id_; public: - ~Task(); explicit Task(std::string name, double flops_amount, double bytes_amount, void* data) : name_(std::move(name)), userdata_(data), flops_amount(flops_amount), bytes_amount(bytes_amount) { @@ -30,6 +29,9 @@ public: if (MC_is_active()) MC_ignore_heap(&(id_), sizeof(id_)); } + Task(const Task&) = delete; + Task& operator=(const Task&) = delete; + ~Task(); void set_used(); void set_not_used() { this->is_used = false; } diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index f8d8102050..14af36a060 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -34,6 +34,8 @@ class XBT_PUBLIC ActorImpl : public surf::PropertyHolder { public: xbt::string name_; ActorImpl(xbt::string name, s4u::Host* host); + ActorImpl(const ActorImpl&) = delete; + ActorImpl& operator=(const ActorImpl&) = delete; ~ActorImpl(); double get_kill_time(); diff --git a/src/smpi/include/smpi_actor.hpp b/src/smpi/include/smpi_actor.hpp index 7389c39cbc..067fe283fb 100644 --- a/src/smpi/include/smpi_actor.hpp +++ b/src/smpi/include/smpi_actor.hpp @@ -40,6 +40,8 @@ private: #endif public: explicit ActorExt(simgrid::s4u::ActorPtr actor, simgrid::s4u::Barrier* barrier); + ActorExt(const ActorExt&) = delete; + ActorExt& operator=(const ActorExt&) = delete; ~ActorExt(); void set_data(const char* instance_id); void finalize(); diff --git a/src/smpi/include/smpi_datatype.hpp b/src/smpi/include/smpi_datatype.hpp index b183c19368..6c8b8d9954 100644 --- a/src/smpi/include/smpi_datatype.hpp +++ b/src/smpi/include/smpi_datatype.hpp @@ -98,6 +98,8 @@ public: Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags); Datatype(char* name, int size, MPI_Aint lb, MPI_Aint ub, int flags); Datatype(Datatype* datatype, int* ret); + Datatype(const Datatype&) = delete; + Datatype& operator=(const Datatype&) = delete; virtual ~Datatype(); char* name(); diff --git a/src/smpi/include/smpi_datatype_derived.hpp b/src/smpi/include/smpi_datatype_derived.hpp index 7f9864b133..30b4e9e232 100644 --- a/src/smpi/include/smpi_datatype_derived.hpp +++ b/src/smpi/include/smpi_datatype_derived.hpp @@ -18,6 +18,8 @@ class Type_Contiguous: public Datatype { public: Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type); + Type_Contiguous(const Type_Contiguous&) = delete; + Type_Contiguous& operator=(const Type_Contiguous&) = delete; ~Type_Contiguous(); void serialize(void* noncontiguous, void* contiguous, int count); void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op); @@ -32,6 +34,8 @@ class Type_Hvector: public Datatype{ public: Type_Hvector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride, MPI_Datatype old_type); + Type_Hvector(const Type_Hvector&) = delete; + Type_Hvector& operator=(const Type_Hvector&) = delete; ~Type_Hvector(); void serialize(void* noncontiguous, void* contiguous, int count); void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op); @@ -54,6 +58,8 @@ public: MPI_Aint* block_indices, MPI_Datatype old_type); Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices, MPI_Datatype old_type, MPI_Aint factor); + Type_Hindexed(const Type_Hindexed&) = delete; + Type_Hindexed& operator=(const Type_Hindexed&) = delete; ~Type_Hindexed(); void serialize(void* noncontiguous, void* contiguous, int count); void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op); @@ -74,6 +80,8 @@ class Type_Struct: public Datatype{ public: Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype* old_types); + Type_Struct(const Type_Struct&) = delete; + Type_Struct& operator=(const Type_Struct&) = delete; ~Type_Struct(); void serialize(void* noncontiguous, void* contiguous, int count); void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op); diff --git a/src/smpi/include/smpi_topo.hpp b/src/smpi/include/smpi_topo.hpp index 2ba978fc06..35e3196d52 100644 --- a/src/smpi/include/smpi_topo.hpp +++ b/src/smpi/include/smpi_topo.hpp @@ -33,6 +33,8 @@ class Topo_Cart: public Topo { int *position_; public: explicit Topo_Cart(int ndims); + Topo_Cart(const Topo_Cart&) = delete; + Topo_Cart& operator=(const Topo_Cart&) = delete; ~Topo_Cart(); Topo_Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart); Topo_Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ; @@ -52,6 +54,8 @@ class Topo_Graph: public Topo { int *edges_; public: Topo_Graph(); + Topo_Graph(const Topo_Graph&) = delete; + Topo_Graph& operator=(const Topo_Graph&) = delete; ~Topo_Graph(); }; @@ -63,6 +67,8 @@ class Topo_Dist_Graph: public Topo { int *out_weights_; public: Topo_Dist_Graph(); + Topo_Dist_Graph(const Topo_Dist_Graph&) = delete; + Topo_Dist_Graph& operator=(const Topo_Dist_Graph&) = delete; ~Topo_Dist_Graph(); }; diff --git a/src/smpi/include/smpi_win.hpp b/src/smpi/include/smpi_win.hpp index ade60756c8..beee0b4927 100644 --- a/src/smpi/include/smpi_win.hpp +++ b/src/smpi/include/smpi_win.hpp @@ -48,6 +48,8 @@ public: Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated = 0, int dynamic = 0); Win(MPI_Info info, MPI_Comm comm) : Win(MPI_BOTTOM, 0, 1, info, comm, 0, 1) {}; + Win(const Win&) = delete; + Win& operator=(const Win&) = delete; ~Win(); int attach (void *base, MPI_Aint size); int detach (void *base); diff --git a/src/surf/PropertyHolder.hpp b/src/surf/PropertyHolder.hpp index 04ff48837f..5f39e635b4 100644 --- a/src/surf/PropertyHolder.hpp +++ b/src/surf/PropertyHolder.hpp @@ -19,6 +19,8 @@ class PropertyHolder { // DO NOT DERIVE THIS CLASS, or the diamond inheritance m public: PropertyHolder() = default; + PropertyHolder(const PropertyHolder&) = delete; + PropertyHolder& operator=(const PropertyHolder&) = delete; ~PropertyHolder(); const char* get_property(const std::string& key); diff --git a/src/surf/StorageImpl.hpp b/src/surf/StorageImpl.hpp index 145b7f8dec..e3c508acd3 100644 --- a/src/surf/StorageImpl.hpp +++ b/src/surf/StorageImpl.hpp @@ -51,6 +51,8 @@ simgrid::xbt::signal* speed_per_pstate, int core) override; @@ -36,6 +38,8 @@ public: class CpuCas01 : public Cpu { public: CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core); + CpuCas01(const CpuCas01&) = delete; + CpuCas01& operator=(const CpuCas01&) = delete; ~CpuCas01() override; void apply_event(simgrid::kernel::profile::Event* event, double value) override; CpuAction* execution_start(double size) override; @@ -59,6 +63,8 @@ public: kernel::lmm::Constraint* constraint, int core_count); CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed, kernel::lmm::Constraint* constraint); + CpuCas01Action(const CpuCas01Action&) = delete; + CpuCas01Action& operator=(const CpuCas01Action&) = delete; ~CpuCas01Action() override; int requested_core(); diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 74bd125f3c..93bc683aec 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -76,6 +76,8 @@ public: Cpu(simgrid::kernel::resource::Model * model, simgrid::s4u::Host * host, std::vector * speedPerPstate, int core); + Cpu(const Cpu&) = delete; + Cpu& operator=(const Cpu&) = delete; ~Cpu(); /** diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 2e9ec6db18..2b3dff1f50 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -77,6 +77,8 @@ class XBT_PRIVATE CpuTiAction : public CpuAction { friend class CpuTi; public: CpuTiAction(CpuTi* cpu, double cost); + CpuTiAction(const CpuTiAction&) = delete; + CpuTiAction& operator=(const CpuTiAction&) = delete; ~CpuTiAction(); void set_state(kernel::resource::Action::State state) override; @@ -101,6 +103,8 @@ typedef boost::intrusive::list ActionTiList; class CpuTi : public Cpu { public: CpuTi(CpuTiModel* model, simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core); + CpuTi(const CpuTi&) = delete; + CpuTi& operator&(const CpuTi&) = delete; ~CpuTi() override; void set_speed_profile(kernel::profile::Profile* profile) override; @@ -140,6 +144,8 @@ public: static void create_pm_vm_models(); // Make both models be TI models CpuTiModel(); + CpuTiModel(const CpuTiModel&) = delete; + CpuTiModel& operator=(const CpuTiModel&) = delete; ~CpuTiModel() override; Cpu* create_cpu(simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core) override; double next_occuring_event(double now) override; diff --git a/src/surf/network_ib.hpp b/src/surf/network_ib.hpp index 13ce97a6de..f15fcfd1a9 100644 --- a/src/surf/network_ib.hpp +++ b/src/surf/network_ib.hpp @@ -49,6 +49,8 @@ private: public: NetworkIBModel(); explicit NetworkIBModel(const char* name); + NetworkIBModel(const NetworkIBModel&) = delete; + NetworkIBModel& operator=(const NetworkIBModel&) = delete; ~NetworkIBModel() override; void updateIBfactors(NetworkAction* action, IBNode* from, IBNode* to, int remove); diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 6cc74b2746..de80df17ee 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -37,6 +37,8 @@ public: static simgrid::config::Flag cfg_crosstraffic; explicit NetworkModel(Model::UpdateAlgo algo) : Model(algo) {} + NetworkModel(const NetworkModel&) = delete; + NetworkModel& operator=(const NetworkModel&) = delete; ~NetworkModel() override; /** @@ -113,6 +115,8 @@ public: class LinkImpl : public Resource, public simgrid::surf::PropertyHolder { protected: LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint); + LinkImpl(const LinkImpl&) = delete; + LinkImpl& operator=(const LinkImpl&) = delete; ~LinkImpl() override; public: diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 6cba667c1b..c5781cf02e 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -36,6 +36,8 @@ class XBT_PRIVATE L07Action; class HostL07Model : public HostModel { public: HostL07Model(); + HostL07Model(const HostL07Model&) = delete; + HostL07Model& operator=(const HostL07Model&) = delete; ~HostL07Model() override; double next_occuring_event(double now) override; @@ -47,6 +49,8 @@ public: class CpuL07Model : public CpuModel { public: CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys); + CpuL07Model(const CpuL07Model&) = delete; + CpuL07Model& operator=(const CpuL07Model&) = delete; ~CpuL07Model(); Cpu* create_cpu(simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core) override; @@ -56,6 +60,8 @@ public: class NetworkL07Model : public kernel::resource::NetworkModel { public: NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys); + NetworkL07Model(const NetworkL07Model&) = delete; + NetworkL07Model& operator=(const NetworkL07Model&) = delete; ~NetworkL07Model(); kernel::resource::LinkImpl* create_link(const std::string& name, double bandwidth, double latency, s4u::Link::SharingPolicy policy) override; @@ -72,6 +78,8 @@ public: class CpuL07 : public Cpu { public: CpuL07(CpuL07Model* model, s4u::Host* host, std::vector* speed_per_pstate, int core); + CpuL07(const CpuL07&) = delete; + CpuL07& operator=(const CpuL07&) = delete; ~CpuL07() override; bool is_used() override; void apply_event(kernel::profile::Event* event, double value) override; @@ -91,6 +99,8 @@ class LinkL07 : public kernel::resource::LinkImpl { public: LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency, s4u::Link::SharingPolicy policy); + LinkL07(const LinkL07&) = delete; + LinkL07& operator=(const LinkL07&) = delete; ~LinkL07() override; bool is_used() override; void apply_event(kernel::profile::Event* event, double value) override; @@ -111,6 +121,8 @@ class L07Action : public CpuAction { public: L07Action(kernel::resource::Model* model, size_t host_nb, s4u::Host* const* host_list, const double* flops_amount, const double* bytes_amount, double rate); + L07Action(const L07Action&) = delete; + L07Action& operator=(const L07Action&) = delete; ~L07Action(); void updateBound(); diff --git a/src/xbt/backtrace.cpp b/src/xbt/backtrace.cpp index 7af4ee60e3..b9f4009f05 100644 --- a/src/xbt/backtrace.cpp +++ b/src/xbt/backtrace.cpp @@ -84,6 +84,27 @@ Backtrace::Backtrace(const Backtrace& bt) impl_->ref(); } +Backtrace::Backtrace(Backtrace&& bt) +{ + impl_ = bt.impl_; + bt.impl_ = nullptr; +} + +Backtrace& Backtrace::operator=(const Backtrace& rhs) +{ + impl_ = rhs.impl_; + if (impl_) + impl_->ref(); + return *this; +} + +Backtrace& Backtrace::operator=(Backtrace&& rhs) +{ + impl_ = rhs.impl_; + rhs.impl_ = nullptr; + return *this; +} + Backtrace::~Backtrace() { if (impl_ != nullptr && impl_->unref()) { -- 2.20.1