From db37125c5fc1febd6ba6ab6454f375ec546a8664 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 20 Jan 2023 15:12:25 -0500 Subject: [PATCH] lib: cpp: mitigate warnings due to non-virtual destructors Commit 042580f53441efe1bc5c80c89351fcb30740659e removed the `virtual` keyword from the declaration of `~TConnectedClient()`. While mostly benign, it does cause a warning in some versions of GCC, which can throw off CI sometimes when building with `-Werror`. Signed-off-by: Chris Friedt --- lib/cpp/src/thrift/TNonCopyable.h | 2 +- lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h | 4 ++-- lib/cpp/src/thrift/async/TEvhttpServer.h | 2 +- lib/cpp/src/thrift/transport/TFileTransport.h | 2 +- lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h | 4 ++-- lib/cpp/src/thrift/windows/Sync.h | 8 ++++---- lib/cpp/src/thrift/windows/TWinsockSingleton.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/cpp/src/thrift/TNonCopyable.h b/lib/cpp/src/thrift/TNonCopyable.h index a60f1f0fb4b..51c94e2a0d5 100644 --- a/lib/cpp/src/thrift/TNonCopyable.h +++ b/lib/cpp/src/thrift/TNonCopyable.h @@ -30,7 +30,7 @@ namespace thrift { class TNonCopyable { protected: TNonCopyable() = default; - ~TNonCopyable() = default; + virtual ~TNonCopyable() = default; TNonCopyable(const TNonCopyable&) = delete; TNonCopyable& operator=(const TNonCopyable&) = delete; diff --git a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h index 0bc5eb565f5..dd9b055e87e 100644 --- a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h +++ b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h @@ -36,7 +36,7 @@ class TConcurrentClientSyncInfo; class TConcurrentSendSentry { public: explicit TConcurrentSendSentry(TConcurrentClientSyncInfo* sync); - ~TConcurrentSendSentry(); + virtual ~TConcurrentSendSentry(); void commit(); @@ -48,7 +48,7 @@ class TConcurrentSendSentry { class TConcurrentRecvSentry { public: TConcurrentRecvSentry(TConcurrentClientSyncInfo* sync, int32_t seqid); - ~TConcurrentRecvSentry(); + virtual ~TConcurrentRecvSentry(); void commit(); diff --git a/lib/cpp/src/thrift/async/TEvhttpServer.h b/lib/cpp/src/thrift/async/TEvhttpServer.h index c5bf3b6eef4..aecfadef2fb 100644 --- a/lib/cpp/src/thrift/async/TEvhttpServer.h +++ b/lib/cpp/src/thrift/async/TEvhttpServer.h @@ -50,7 +50,7 @@ class TEvhttpServer { */ TEvhttpServer(std::shared_ptr processor, int port); - ~TEvhttpServer(); + virtual ~TEvhttpServer(); static void request(struct evhttp_request* req, void* self); int serve(); diff --git a/lib/cpp/src/thrift/transport/TFileTransport.h b/lib/cpp/src/thrift/transport/TFileTransport.h index 608cff18411..902d9061df8 100644 --- a/lib/cpp/src/thrift/transport/TFileTransport.h +++ b/lib/cpp/src/thrift/transport/TFileTransport.h @@ -123,7 +123,7 @@ typedef struct readState { class TFileTransportBuffer { public: TFileTransportBuffer(uint32_t size); - ~TFileTransportBuffer(); + virtual ~TFileTransportBuffer(); bool addEvent(eventInfo* event); eventInfo* getNext(); diff --git a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h index 057f623b99a..7326a9c0e28 100644 --- a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h +++ b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h @@ -105,7 +105,7 @@ class TOverlappedSubmissionThread : apache::thrift::TNonCopyable { // thread details private: TOverlappedSubmissionThread(); - ~TOverlappedSubmissionThread(); + virtual ~TOverlappedSubmissionThread(); void run(); static unsigned __stdcall thread_proc(void* addr); @@ -122,7 +122,7 @@ class TAutoOverlapThread : apache::thrift::TNonCopyable { public: TAutoOverlapThread() : p(TOverlappedSubmissionThread::acquire_instance()) {} - ~TAutoOverlapThread() { TOverlappedSubmissionThread::release_instance(); } + virtual ~TAutoOverlapThread() { TOverlappedSubmissionThread::release_instance(); } TOverlappedSubmissionThread* operator->() { return p; } }; } diff --git a/lib/cpp/src/thrift/windows/Sync.h b/lib/cpp/src/thrift/windows/Sync.h index a5b2ac50f0d..89aaead7795 100644 --- a/lib/cpp/src/thrift/windows/Sync.h +++ b/lib/cpp/src/thrift/windows/Sync.h @@ -58,7 +58,7 @@ namespace thrift { struct TCriticalSection : apache::thrift::TNonCopyable { CRITICAL_SECTION cs; TCriticalSection() { InitializeCriticalSection(&cs); } - ~TCriticalSection() { DeleteCriticalSection(&cs); } + virtual ~TCriticalSection() { DeleteCriticalSection(&cs); } }; class TAutoCrit : apache::thrift::TNonCopyable { @@ -67,7 +67,7 @@ class TAutoCrit : apache::thrift::TNonCopyable { public: explicit TAutoCrit(TCriticalSection& cs) : cs_(&cs.cs) { EnterCriticalSection(cs_); } - ~TAutoCrit() { LeaveCriticalSection(cs_); } + virtual ~TAutoCrit() { LeaveCriticalSection(cs_); } }; struct TAutoResetEvent : apache::thrift::TNonCopyable { @@ -80,7 +80,7 @@ struct TAutoResetEvent : apache::thrift::TNonCopyable { throw apache::thrift::concurrency::SystemResourceException("CreateEvent failed"); } } - ~TAutoResetEvent() { CloseHandle(h); } + virtual ~TAutoResetEvent() { CloseHandle(h); } }; struct TManualResetEvent : apache::thrift::TNonCopyable { @@ -93,7 +93,7 @@ struct TManualResetEvent : apache::thrift::TNonCopyable { throw apache::thrift::concurrency::SystemResourceException("CreateEvent failed"); } } - ~TManualResetEvent() { CloseHandle(h); } + virtual ~TManualResetEvent() { CloseHandle(h); } }; struct TAutoHandle : apache::thrift::TNonCopyable { diff --git a/lib/cpp/src/thrift/windows/TWinsockSingleton.h b/lib/cpp/src/thrift/windows/TWinsockSingleton.h index a098d2c7144..a8e517aabb9 100644 --- a/lib/cpp/src/thrift/windows/TWinsockSingleton.h +++ b/lib/cpp/src/thrift/windows/TWinsockSingleton.h @@ -54,7 +54,7 @@ class TWinsockSingleton : private apache::thrift::TNonCopyable { TWinsockSingleton(void); public: - ~TWinsockSingleton(void); + virtual ~TWinsockSingleton(void); public: static void create(void);