From 45b6ff19e7708a18abaea554b51b71fa40d16410 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Thu, 20 Mar 2025 19:35:21 -0400 Subject: [PATCH] chore: remove StdExcept and include stdexcept directly where needed remove _NOEXCEPT define and just use throw() --- src/lib/arch/XArch.h | 7 ++++--- src/lib/arch/unix/XArchUnix.h | 2 +- src/lib/base/XBase.cpp | 4 ++-- src/lib/base/XBase.h | 14 +++++++------- src/lib/client/Client.cpp | 2 +- src/lib/common/CMakeLists.txt | 1 - src/lib/common/StdExcept.h | 14 -------------- src/lib/deskflow/PlatformScreen.h | 3 ++- src/lib/deskflow/StreamChunker.cpp | 2 +- src/lib/deskflow/XDeskflow.h | 6 +++--- src/lib/deskflow/XScreen.cpp | 2 +- src/lib/deskflow/XScreen.h | 2 +- src/lib/net/XSocket.cpp | 7 ++++--- src/lib/net/XSocket.h | 4 ++-- src/lib/server/Config.cpp | 2 +- src/lib/server/Config.h | 2 +- src/lib/server/Server.cpp | 2 +- src/test/integtests/net/NetworkTests.cpp | 2 +- src/test/shared/TestEventQueue.cpp | 3 ++- 19 files changed, 35 insertions(+), 46 deletions(-) delete mode 100644 src/lib/common/StdExcept.h diff --git a/src/lib/arch/XArch.h b/src/lib/arch/XArch.h index 655c9bd27..5365ea0bf 100644 --- a/src/lib/arch/XArch.h +++ b/src/lib/arch/XArch.h @@ -8,7 +8,8 @@ #pragma once #include "common/Common.h" -#include "common/StdExcept.h" + +#include #include //! Generic thread exception @@ -57,7 +58,7 @@ public: XArchEval() { } - virtual ~XArchEval() _NOEXCEPT + virtual ~XArchEval() throw() { } @@ -75,7 +76,7 @@ public: XArch(const std::string &msg) : std::runtime_error(msg) { } - virtual ~XArch() _NOEXCEPT + virtual ~XArch() throw() { } }; diff --git a/src/lib/arch/unix/XArchUnix.h b/src/lib/arch/unix/XArchUnix.h index 5d9ddd716..a7a1031b1 100644 --- a/src/lib/arch/unix/XArchUnix.h +++ b/src/lib/arch/unix/XArchUnix.h @@ -16,7 +16,7 @@ public: XArchEvalUnix(int error) : m_error(error) { } - virtual ~XArchEvalUnix() _NOEXCEPT + virtual ~XArchEvalUnix() throw() { } diff --git a/src/lib/base/XBase.cpp b/src/lib/base/XBase.cpp index fca193a73..92b3ca57a 100644 --- a/src/lib/base/XBase.cpp +++ b/src/lib/base/XBase.cpp @@ -26,12 +26,12 @@ XBase::XBase(const std::string &msg) : std::runtime_error(msg) // do nothing } -XBase::~XBase() _NOEXCEPT +XBase::~XBase() throw() { // do nothing } -const char *XBase::what() const _NOEXCEPT +const char *XBase::what() const throw() { if (const char *what = std::runtime_error::what(); what != nullptr && what[0] != '\0') { return what; diff --git a/src/lib/base/XBase.h b/src/lib/base/XBase.h index 7aeae2c9a..8c5fe8af6 100644 --- a/src/lib/base/XBase.h +++ b/src/lib/base/XBase.h @@ -7,7 +7,7 @@ #pragma once -#include "common/StdExcept.h" +#include #include //! Exception base class @@ -21,10 +21,10 @@ public: XBase(); //! Use \c msg as the result of what() XBase(const std::string &msg); - virtual ~XBase() _NOEXCEPT; + virtual ~XBase() throw(); //! Reason for exception - virtual const char *what() const _NOEXCEPT; + virtual const char *what() const throw(); protected: //! Get a human readable string describing the exception @@ -61,7 +61,7 @@ declared. name_(const std::string &msg) : super_(msg) \ { \ } \ - virtual ~name_() _NOEXCEPT \ + virtual ~name_() throw() \ { \ } \ } @@ -82,7 +82,7 @@ implemented. name_(const std::string &msg) : super_(msg) \ { \ } \ - virtual ~name_() _NOEXCEPT \ + virtual ~name_() throw() \ { \ } \ \ @@ -116,11 +116,11 @@ c'tor. name_(const std::string &msg) : super_(msg), m_state(kFirst) \ { \ } \ - virtual ~name_() _NOEXCEPT \ + virtual ~name_() throw() \ { \ } \ \ - virtual const char *what() const _NOEXCEPT \ + virtual const char *what() const throw() \ { \ if (m_state == kFirst) { \ m_state = kFormat; \ diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index f74e7d393..b89a478c8 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -14,7 +14,6 @@ #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" #include "client/ServerProxy.h" -#include "common/StdExcept.h" #include "deskflow/AppUtil.h" #include "deskflow/DropHelper.h" #include "deskflow/FileChunk.h" @@ -39,6 +38,7 @@ #include #include #include +#include using namespace deskflow::client; diff --git a/src/lib/common/CMakeLists.txt b/src/lib/common/CMakeLists.txt index 4747c4e6b..a0c0d7bea 100644 --- a/src/lib/common/CMakeLists.txt +++ b/src/lib/common/CMakeLists.txt @@ -6,7 +6,6 @@ configure_file(Constants.h.in Constants.h @ONLY) add_library(common STATIC Common.h IInterface.h - StdExcept.h Settings.h Settings.cpp QSettingsProxy.cpp diff --git a/src/lib/common/StdExcept.h b/src/lib/common/StdExcept.h deleted file mode 100644 index 7c703536e..000000000 --- a/src/lib/common/StdExcept.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2014 - 2016 Symless Ltd. - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#pragma once - -#include - -// apple declares _NOEXCEPT -#ifndef _NOEXCEPT -#define _NOEXCEPT throw() -#endif diff --git a/src/lib/deskflow/PlatformScreen.h b/src/lib/deskflow/PlatformScreen.h index ff2dd89cc..be7a1c9cb 100644 --- a/src/lib/deskflow/PlatformScreen.h +++ b/src/lib/deskflow/PlatformScreen.h @@ -7,11 +7,12 @@ #pragma once -#include "common/StdExcept.h" #include "deskflow/ClientArgs.h" #include "deskflow/DragInformation.h" #include "deskflow/IPlatformScreen.h" +#include + //! Base screen implementation /*! This screen implementation is the superclass of all other screen diff --git a/src/lib/deskflow/StreamChunker.cpp b/src/lib/deskflow/StreamChunker.cpp index d5b584f4b..01178747f 100644 --- a/src/lib/deskflow/StreamChunker.cpp +++ b/src/lib/deskflow/StreamChunker.cpp @@ -12,7 +12,6 @@ #include "base/Log.h" #include "base/Stopwatch.h" #include "base/String.h" -#include "common/StdExcept.h" #include "deskflow/ClipboardChunk.h" #include "deskflow/FileChunk.h" #include "deskflow/ProtocolTypes.h" @@ -20,6 +19,7 @@ #include "mt/Mutex.h" #include +#include using namespace std; diff --git a/src/lib/deskflow/XDeskflow.h b/src/lib/deskflow/XDeskflow.h index 3577ef994..6d0c2f9db 100644 --- a/src/lib/deskflow/XDeskflow.h +++ b/src/lib/deskflow/XDeskflow.h @@ -66,7 +66,7 @@ class XDuplicateClient : public XDeskflow { public: XDuplicateClient(const std::string &name); - virtual ~XDuplicateClient() _NOEXCEPT + virtual ~XDuplicateClient() throw() { } @@ -94,7 +94,7 @@ class XUnknownClient : public XDeskflow { public: XUnknownClient(const std::string &name); - virtual ~XUnknownClient() _NOEXCEPT + virtual ~XUnknownClient() throw() { } @@ -123,7 +123,7 @@ class XExitApp : public XDeskflow { public: XExitApp(int code); - virtual ~XExitApp() _NOEXCEPT + virtual ~XExitApp() throw() { } diff --git a/src/lib/deskflow/XScreen.cpp b/src/lib/deskflow/XScreen.cpp index 8fc4aafeb..cf26609d0 100644 --- a/src/lib/deskflow/XScreen.cpp +++ b/src/lib/deskflow/XScreen.cpp @@ -34,7 +34,7 @@ XScreenUnavailable::XScreenUnavailable(double timeUntilRetry) : m_timeUntilRetry // do nothing } -XScreenUnavailable::~XScreenUnavailable() _NOEXCEPT +XScreenUnavailable::~XScreenUnavailable() throw() { // do nothing } diff --git a/src/lib/deskflow/XScreen.h b/src/lib/deskflow/XScreen.h index 5c0af6ce1..ed1c7e19f 100644 --- a/src/lib/deskflow/XScreen.h +++ b/src/lib/deskflow/XScreen.h @@ -37,7 +37,7 @@ public: trying to open the screen again. */ XScreenUnavailable(double timeUntilRetry); - virtual ~XScreenUnavailable() _NOEXCEPT; + virtual ~XScreenUnavailable() throw(); //! @name manipulators //@{ diff --git a/src/lib/net/XSocket.cpp b/src/lib/net/XSocket.cpp index 939a82235..02c9ae17d 100644 --- a/src/lib/net/XSocket.cpp +++ b/src/lib/net/XSocket.cpp @@ -12,9 +12,10 @@ // XSocketAddress // -XSocketAddress::XSocketAddress(EError error, const std::string &hostname, int port) _NOEXCEPT : m_error(error), - m_hostname(hostname), - m_port(port) +XSocketAddress::XSocketAddress(EError error, const std::string &hostname, int port) throw() + : m_error(error), + m_hostname(hostname), + m_port(port) { // do nothing } diff --git a/src/lib/net/XSocket.h b/src/lib/net/XSocket.h index d48cfb337..90ab73866 100644 --- a/src/lib/net/XSocket.h +++ b/src/lib/net/XSocket.h @@ -31,8 +31,8 @@ public: kBadPort //!< The port is invalid }; - XSocketAddress(EError, const std::string &hostname, int port) _NOEXCEPT; - virtual ~XSocketAddress() _NOEXCEPT + XSocketAddress(EError, const std::string &hostname, int port) throw(); + virtual ~XSocketAddress() throw() { } diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index 20a3b3596..ccae42399 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -2114,7 +2114,7 @@ XConfigRead::XConfigRead(const ConfigReadContext &context, const char *errorFmt, // do nothing } -XConfigRead::~XConfigRead() _NOEXCEPT +XConfigRead::~XConfigRead() throw() { // do nothing } diff --git a/src/lib/server/Config.h b/src/lib/server/Config.h index 67fa6e8ba..71ac82e93 100644 --- a/src/lib/server/Config.h +++ b/src/lib/server/Config.h @@ -563,7 +563,7 @@ class XConfigRead : public XBase public: XConfigRead(const ConfigReadContext &context, const std::string &); XConfigRead(const ConfigReadContext &context, const char *errorFmt, const std::string &arg); - virtual ~XConfigRead() _NOEXCEPT; + virtual ~XConfigRead() throw(); protected: // XBase overrides diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index 0e3bc5cda..bc2722766 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -12,7 +12,6 @@ #include "base/Log.h" #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" -#include "common/StdExcept.h" #include "deskflow/AppUtil.h" #include "deskflow/DropHelper.h" #include "deskflow/FileChunk.h" @@ -35,6 +34,7 @@ #include #include #include +#include using namespace deskflow::server; diff --git a/src/test/integtests/net/NetworkTests.cpp b/src/test/integtests/net/NetworkTests.cpp index bc83b580a..7fc5093d8 100644 --- a/src/test/integtests/net/NetworkTests.cpp +++ b/src/test/integtests/net/NetworkTests.cpp @@ -14,7 +14,6 @@ #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" #include "client/Client.h" -#include "common/StdExcept.h" #include "deskflow/FileChunk.h" #include "deskflow/StreamChunker.h" #include "mt/Thread.h" @@ -33,6 +32,7 @@ #include #include #include +#include #include using namespace std; diff --git a/src/test/shared/TestEventQueue.cpp b/src/test/shared/TestEventQueue.cpp index e25995024..f4a24a6b3 100644 --- a/src/test/shared/TestEventQueue.cpp +++ b/src/test/shared/TestEventQueue.cpp @@ -7,7 +7,8 @@ #include "test/shared/TestEventQueue.h" #include "base/TMethodEventJob.h" -#include "common/StdExcept.h" + +#include void TestEventQueue::raiseQuitEvent() {