From 93aac5fa0be82b8181108551816394039196cc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Skrzy=C5=84ski?= Date: Thu, 9 May 2024 22:43:28 +0200 Subject: [PATCH] #2264: fix non-virtual-dtor and suggest-override warnings --- src/vt/group/base/group_info_base.h | 2 ++ src/vt/group/collective/group_info_collective.h | 2 ++ src/vt/group/rooted/group_info_rooted.h | 1 + src/vt/messaging/message/smart_ptr.h | 2 +- src/vt/objgroup/holder/holder_base.h | 2 +- src/vt/runtime/component/component_name.h | 1 + src/vt/runtime/component/diagnostic.h | 2 ++ src/vt/runtime/component/progressable.h | 2 ++ src/vt/termination/term_action.h | 1 + src/vt/termination/term_terminated.h | 2 ++ src/vt/vrt/collection/holders/base_holder.h | 1 + src/vt/vrt/collection/types/has_migrate.h | 3 +++ tests/unit/active/test_active_bcast_put.cc | 4 ++-- tests/unit/active/test_active_broadcast.cc | 4 ++-- tests/unit/active/test_active_send.cc | 2 +- tests/unit/active/test_active_send_put.cc | 2 +- tests/unit/collection/test_lb_data_retention.cc | 3 +-- tests/unit/index/test_index.nompi.cc | 4 ++-- tests/unit/memory/test_memory_lifetime.cc | 2 +- tests/unit/pool/test_pool.cc | 2 +- tests/unit/pool/test_pool_message_sizes.cc | 2 +- tests/unit/test_parallel_harness.h | 4 ++-- 22 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/vt/group/base/group_info_base.h b/src/vt/group/base/group_info_base.h index 05f1cc39c6..50115e5a22 100644 --- a/src/vt/group/base/group_info_base.h +++ b/src/vt/group/base/group_info_base.h @@ -59,6 +59,8 @@ struct InfoBase { using TreeType = collective::tree::Tree; using TreePtrType = std::unique_ptr; + virtual ~InfoBase() = default; + protected: virtual GroupType getGroupID() const = 0; virtual ActionType getAction() const = 0; diff --git a/src/vt/group/collective/group_info_collective.h b/src/vt/group/collective/group_info_collective.h index df251f40a1..327ac77b4c 100644 --- a/src/vt/group/collective/group_info_collective.h +++ b/src/vt/group/collective/group_info_collective.h @@ -75,6 +75,8 @@ struct InfoColl : virtual InfoBase { { } + virtual ~InfoColl() = default; + private: /* * Inner struct used as functor reduce target after the collective group is diff --git a/src/vt/group/rooted/group_info_rooted.h b/src/vt/group/rooted/group_info_rooted.h index f091f392a3..9e4821f646 100644 --- a/src/vt/group/rooted/group_info_rooted.h +++ b/src/vt/group/rooted/group_info_rooted.h @@ -68,6 +68,7 @@ struct InfoRooted : virtual InfoBase { bool const& in_is_remote, RegionPtrType in_region, RegionType::SizeType const& in_total_size ); + virtual ~InfoRooted() = default; protected: void setupRooted(); diff --git a/src/vt/messaging/message/smart_ptr.h b/src/vt/messaging/message/smart_ptr.h index 4cd31ab46d..efcc215c56 100644 --- a/src/vt/messaging/message/smart_ptr.h +++ b/src/vt/messaging/message/smart_ptr.h @@ -88,7 +88,7 @@ struct MsgPtrImplBase { template struct MsgPtrImplTyped : MsgPtrImplBase { - virtual void messageDeref(std::byte* msg_ptr) { + virtual void messageDeref(std::byte* msg_ptr) override { // N.B. messageDeref invokes delete-expr T. vt::messageDeref(reinterpret_cast(msg_ptr)); } diff --git a/src/vt/objgroup/holder/holder_base.h b/src/vt/objgroup/holder/holder_base.h index 0cd9f6439b..9ff67bcfec 100644 --- a/src/vt/objgroup/holder/holder_base.h +++ b/src/vt/objgroup/holder/holder_base.h @@ -78,7 +78,7 @@ template struct HolderObjBase : HolderBase { virtual ~HolderObjBase() = default; virtual ObjT* get() = 0; - virtual std::byte* getPtr() = 0; + virtual std::byte* getPtr() override = 0; }; }}} /* end namespace vt::objgroup::holder */ diff --git a/src/vt/runtime/component/component_name.h b/src/vt/runtime/component/component_name.h index 0a2af860e8..fd16f3ebb1 100644 --- a/src/vt/runtime/component/component_name.h +++ b/src/vt/runtime/component/component_name.h @@ -55,6 +55,7 @@ namespace vt { namespace runtime { namespace component { * unique name for the given component. */ struct ComponentName { + virtual ~ComponentName() = default; /** * \internal \brief Get the name of the component */ diff --git a/src/vt/runtime/component/diagnostic.h b/src/vt/runtime/component/diagnostic.h index 0513f4d1d5..6febcd0e23 100644 --- a/src/vt/runtime/component/diagnostic.h +++ b/src/vt/runtime/component/diagnostic.h @@ -69,6 +69,8 @@ struct Diagnostic : ComponentName, ComponentReducer { using UpdateType = DiagnosticUpdate; using UnitType = DiagnosticUnit; + virtual ~Diagnostic() = default; + virtual void dumpState() = 0; /** diff --git a/src/vt/runtime/component/progressable.h b/src/vt/runtime/component/progressable.h index 0c345cf2c0..fee3c4091c 100644 --- a/src/vt/runtime/component/progressable.h +++ b/src/vt/runtime/component/progressable.h @@ -54,6 +54,8 @@ namespace vt { namespace runtime { namespace component { */ struct Progressable { + virtual ~Progressable() = default; + /** * \brief Progress function for incremental polling * diff --git a/src/vt/termination/term_action.h b/src/vt/termination/term_action.h index 6836b6137a..555bbc29a9 100644 --- a/src/vt/termination/term_action.h +++ b/src/vt/termination/term_action.h @@ -104,6 +104,7 @@ struct TermAction : TermTerminated { using EpochStateType = std::unordered_map; TermAction() = default; + virtual ~TermAction() = default; public: void addDefaultAction(ActionType action); diff --git a/src/vt/termination/term_terminated.h b/src/vt/termination/term_terminated.h index 5f6f7ba87e..07df5791fb 100644 --- a/src/vt/termination/term_terminated.h +++ b/src/vt/termination/term_terminated.h @@ -59,6 +59,8 @@ enum struct TermStatusEnum : int8_t { }; struct TermTerminated { + virtual ~TermTerminated() = default; + virtual TermStatusEnum testEpochTerminated(EpochType epoch) = 0; }; diff --git a/src/vt/vrt/collection/holders/base_holder.h b/src/vt/vrt/collection/holders/base_holder.h index 1d2edf4ab2..b4c8df5f12 100644 --- a/src/vt/vrt/collection/holders/base_holder.h +++ b/src/vt/vrt/collection/holders/base_holder.h @@ -51,6 +51,7 @@ namespace vt { namespace vrt { namespace collection { struct BaseHolder { BaseHolder() = default; + virtual ~BaseHolder() = default; virtual void destroy() = 0; }; diff --git a/src/vt/vrt/collection/types/has_migrate.h b/src/vt/vrt/collection/types/has_migrate.h index 32e73a7bf6..10ab6bfac2 100644 --- a/src/vt/vrt/collection/types/has_migrate.h +++ b/src/vt/vrt/collection/types/has_migrate.h @@ -41,6 +41,7 @@ //@HEADER */ +#include "vt/vrt/context/context_vrtmanager.impl.h" #if !defined INCLUDED_VT_VRT_COLLECTION_TYPES_HAS_MIGRATE_H #define INCLUDED_VT_VRT_COLLECTION_TYPES_HAS_MIGRATE_H @@ -49,6 +50,8 @@ namespace vt { namespace vrt { namespace collection { struct HasMigrate { + virtual ~HasMigrate() = default; + virtual void migrate(NodeType const& to_node) = 0; }; diff --git a/tests/unit/active/test_active_bcast_put.cc b/tests/unit/active/test_active_bcast_put.cc index c14a2661e0..da47608775 100644 --- a/tests/unit/active/test_active_bcast_put.cc +++ b/tests/unit/active/test_active_bcast_put.cc @@ -64,7 +64,7 @@ struct TestActiveBroadcastPut : TestParameterHarnessNode { static int num_msg_sent; static size_t put_size; - virtual void SetUp() { + virtual void SetUp() override { TestParameterHarnessNode::SetUp(); handler_count = 0; num_msg_sent = 1; @@ -72,7 +72,7 @@ struct TestActiveBroadcastPut : TestParameterHarnessNode { SET_MIN_NUM_NODES_CONSTRAINT(2); } - virtual void TearDown() { + virtual void TearDown() override { TestParameterHarnessNode::TearDown(); } diff --git a/tests/unit/active/test_active_broadcast.cc b/tests/unit/active/test_active_broadcast.cc index 274ba5846a..549d13f56a 100644 --- a/tests/unit/active/test_active_broadcast.cc +++ b/tests/unit/active/test_active_broadcast.cc @@ -59,7 +59,7 @@ struct TestActiveBroadcast : TestParameterHarnessNode { static int handler_count; static int num_msg_sent; - virtual void SetUp() { + virtual void SetUp() override { TestParameterHarnessNode::SetUp(); handler_count = 0; @@ -68,7 +68,7 @@ struct TestActiveBroadcast : TestParameterHarnessNode { SET_MIN_NUM_NODES_CONSTRAINT(2); } - virtual void TearDown() { + virtual void TearDown() override { TestParameterHarnessNode::TearDown(); } diff --git a/tests/unit/active/test_active_send.cc b/tests/unit/active/test_active_send.cc index 7bc04977f4..f42c276f3d 100644 --- a/tests/unit/active/test_active_send.cc +++ b/tests/unit/active/test_active_send.cc @@ -83,7 +83,7 @@ struct TestActiveSend : TestParallelHarness { static int handler_count; static int num_msg_sent; - virtual void SetUp() { + virtual void SetUp() override { TestParallelHarness::SetUp(); handler_count = 0; diff --git a/tests/unit/active/test_active_send_put.cc b/tests/unit/active/test_active_send_put.cc index 1345d69cde..a2c765fed7 100644 --- a/tests/unit/active/test_active_send_put.cc +++ b/tests/unit/active/test_active_send_put.cc @@ -64,7 +64,7 @@ struct TestActiveSendPut : TestParameterHarnessNode { static NodeType from_node; static NodeType to_node; - virtual void SetUp() { + virtual void SetUp() override { TestParameterHarnessNode::SetUp(); from_node = 0; to_node = 1; diff --git a/tests/unit/collection/test_lb_data_retention.cc b/tests/unit/collection/test_lb_data_retention.cc index 432e36fd9f..f25678775f 100644 --- a/tests/unit/collection/test_lb_data_retention.cc +++ b/tests/unit/collection/test_lb_data_retention.cc @@ -107,7 +107,7 @@ struct TestCol : vt::Collection { static constexpr int32_t const num_elms = 16; struct TestLBDataRetention : TestParallelHarness { - virtual void SetUp() { + virtual void SetUp() override { TestParallelHarness::SetUp(); // We must have more or equal number of elements than nodes for this test to @@ -116,7 +116,6 @@ struct TestLBDataRetention : TestParallelHarness { } }; -using vt::vrt::collection::balance::LoadModel; using vt::vrt::collection::balance::PersistenceMedianLastN; TEST_F(TestLBDataRetention, test_lbdata_retention_last1) { diff --git a/tests/unit/index/test_index.nompi.cc b/tests/unit/index/test_index.nompi.cc index 1f5b245199..bd68b5b58f 100644 --- a/tests/unit/index/test_index.nompi.cc +++ b/tests/unit/index/test_index.nompi.cc @@ -51,11 +51,11 @@ namespace vt { namespace tests { namespace unit { class TestIndex : public TestHarness { - virtual void SetUp() { + virtual void SetUp() override { TestHarness::SetUp(); } - virtual void TearDown() { + virtual void TearDown() override { TestHarness::TearDown(); } }; diff --git a/tests/unit/memory/test_memory_lifetime.cc b/tests/unit/memory/test_memory_lifetime.cc index 8ab52b14c4..b883d05fc4 100644 --- a/tests/unit/memory/test_memory_lifetime.cc +++ b/tests/unit/memory/test_memory_lifetime.cc @@ -91,7 +91,7 @@ using NormalTestMsg = TrackMsg; using SerialTestMsg = SerialTrackMsg; struct TestMemoryLifetime : TestParallelHarness { - virtual void SetUp() { + virtual void SetUp() override { TestParallelHarness::SetUp(); SerialTestMsg::alloc_count = 0; local_count = 0; diff --git a/tests/unit/pool/test_pool.cc b/tests/unit/pool/test_pool.cc index 09c379fb38..6d9fd39316 100644 --- a/tests/unit/pool/test_pool.cc +++ b/tests/unit/pool/test_pool.cc @@ -63,7 +63,7 @@ struct TestPool : TestParallelHarness { template static void testPoolFun(TestMsg* prev_msg); - virtual void SetUp() { + virtual void SetUp() override { TestParallelHarness::SetUp(); } }; diff --git a/tests/unit/pool/test_pool_message_sizes.cc b/tests/unit/pool/test_pool_message_sizes.cc index 2af7a6eeb0..9ea981e079 100644 --- a/tests/unit/pool/test_pool_message_sizes.cc +++ b/tests/unit/pool/test_pool_message_sizes.cc @@ -65,7 +65,7 @@ static constexpr NodeType const to_node = 1; struct TestPoolMessageSizes : TestParallelHarness { static int count; - virtual void SetUp() { + virtual void SetUp() override { TestParallelHarness::SetUp(); count = 0; } diff --git a/tests/unit/test_parallel_harness.h b/tests/unit/test_parallel_harness.h index 5e3971bc09..13b3c806aa 100644 --- a/tests/unit/test_parallel_harness.h +++ b/tests/unit/test_parallel_harness.h @@ -60,7 +60,7 @@ extern char** test_argv; template struct TestParallelHarnessAny : TestHarnessAny { - virtual void SetUp() { + virtual void SetUp() override { using namespace vt; TestHarnessAny::SetUp(); @@ -102,7 +102,7 @@ struct TestParallelHarnessAny : TestHarnessAny { #endif } - virtual void TearDown() { + virtual void TearDown() override { using namespace vt; try {