From e6f661d3139b7b9847baa482ff1a95307e01519c Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Thu, 11 Sep 2025 09:25:01 +0200 Subject: [PATCH] chore(deprecated): Describe deprecation reasons and alternatives. --- Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h | 2 +- Data/ODBC/src/SessionImpl.cpp | 6 ------ Data/include/Poco/Data/SQLChannel.h | 2 +- Foundation/include/Poco/Dynamic/Var.h | 1 - Foundation/include/Poco/DynamicAny.h | 7 ++++++- Foundation/include/Poco/DynamicAnyHolder.h | 7 ++++++- Foundation/include/Poco/DynamicStruct.h | 6 +++++- Foundation/include/Poco/HashStatistic.h | 2 +- Net/include/Poco/Net/HTTPResponse.h | 6 +++--- Net/include/Poco/Net/NetworkInterface.h | 2 +- Net/include/Poco/Net/PollSet.h | 1 - 11 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h b/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h index 754b5a004..8555f95d5 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h +++ b/Data/ODBC/include/Poco/Data/ODBC/SessionImpl.h @@ -67,7 +67,7 @@ public: /// Creates the SessionImpl. Opens a connection to the database. /// Throws NotConnectedException if connection was not succesful. - POCO_DEPRECATED("") SessionImpl(const std::string& connect, + POCO_DEPRECATED("Use other constructors.") SessionImpl(const std::string& connect, Poco::Any maxFieldSize = ODBC_MAX_FIELD_SIZE, bool enforceCapability=false, bool autoBind = true, diff --git a/Data/ODBC/src/SessionImpl.cpp b/Data/ODBC/src/SessionImpl.cpp index 90fab0a47..4217004d1 100644 --- a/Data/ODBC/src/SessionImpl.cpp +++ b/Data/ODBC/src/SessionImpl.cpp @@ -198,9 +198,6 @@ bool SessionImpl::isConnected() const inline void SessionImpl::setCursorUse(const std::string&, const Poco::Any& value) { -#if POCO_OS == POCO_OS_WINDOWS_NT -#pragma warning (disable : 4995) // ignore marked as deprecated -#endif int cursorUse = static_cast(Poco::AnyCast(value)); int rc = 0; switch (cursorUse) @@ -217,9 +214,6 @@ inline void SessionImpl::setCursorUse(const std::string&, const Poco::Any& value default: throw Poco::InvalidArgumentException(Poco::format("SessionImpl::setCursorUse(%d)", cursorUse)); } -#if POCO_OS == POCO_OS_WINDOWS_NT -#pragma warning (default : 4995) -#endif if (Utility::isError(rc)) { throw Poco::Data::ODBC::HandleException(_db, Poco::format("SessionImpl::setCursorUse(%d)", cursorUse)); diff --git a/Data/include/Poco/Data/SQLChannel.h b/Data/include/Poco/Data/SQLChannel.h index ef3c68abf..6df1f166f 100644 --- a/Data/include/Poco/Data/SQLChannel.h +++ b/Data/include/Poco/Data/SQLChannel.h @@ -217,7 +217,7 @@ public: static const std::string PROP_TABLE; static const std::string PROP_ARCHIVE_TABLE; static const std::string PROP_MAX_AGE; - POCO_DEPRECATED("") static const std::string PROP_ASYNC; + POCO_DEPRECATED("Not used, pending removal.") static const std::string PROP_ASYNC; static const std::string PROP_TIMEOUT; static const std::string PROP_MIN_BATCH; static const std::string PROP_MAX_BATCH; diff --git a/Foundation/include/Poco/Dynamic/Var.h b/Foundation/include/Poco/Dynamic/Var.h index f4089647e..775aeb63c 100644 --- a/Foundation/include/Poco/Dynamic/Var.h +++ b/Foundation/include/Poco/Dynamic/Var.h @@ -482,7 +482,6 @@ public: POCO_DEPRECATED("Use clear() instead") void empty(); /// Empties Var. - /// This function is deprecated and will be removed. /// Please use clear(). void clear(); diff --git a/Foundation/include/Poco/DynamicAny.h b/Foundation/include/Poco/DynamicAny.h index 214a29679..3af05399f 100644 --- a/Foundation/include/Poco/DynamicAny.h +++ b/Foundation/include/Poco/DynamicAny.h @@ -17,8 +17,13 @@ #ifndef Foundation_DynamicAny_INCLUDED #define Foundation_DynamicAny_INCLUDED -//@ deprecated #include "Poco/Dynamic/Var.h" +namespace { + POCO_DEPRECATED("Deprecated header: include Poco/Dynamic/Var.h instead") + constexpr static int dynamicany_hpp_is_deprecated {0xBAD}; + constexpr static int please_dont_use_badheader_hpp = dynamicany_hpp_is_deprecated; +} + #endif // Foundation_DynamicAny_INCLUDED diff --git a/Foundation/include/Poco/DynamicAnyHolder.h b/Foundation/include/Poco/DynamicAnyHolder.h index 4400af3ec..ae73cf885 100644 --- a/Foundation/include/Poco/DynamicAnyHolder.h +++ b/Foundation/include/Poco/DynamicAnyHolder.h @@ -17,8 +17,13 @@ #ifndef Foundation_DynamicAnyHolder_INCLUDED #define Foundation_DynamicAnyHolder_INCLUDED -//@ deprecated #include "Poco/Dynamic/VarHolder.h" +namespace { + POCO_DEPRECATED("Deprecated header: include Poco/Dynamic/VarHolder.h instead") + constexpr static int dynamicanyholder_hpp_is_deprecated {0xBAD}; + constexpr static int please_dont_use_badheader_hpp = dynamicanyholder_hpp_is_deprecated; +} + #endif // Foundation_DynamicAnyHolder_INCLUDED diff --git a/Foundation/include/Poco/DynamicStruct.h b/Foundation/include/Poco/DynamicStruct.h index 1f0fb56b7..765ae912a 100644 --- a/Foundation/include/Poco/DynamicStruct.h +++ b/Foundation/include/Poco/DynamicStruct.h @@ -17,8 +17,12 @@ #ifndef Foundation_DynamicStruct_INCLUDED #define Foundation_DynamicStruct_INCLUDED -//@ deprecated #include "Poco/Dynamic/Struct.h" +namespace { + POCO_DEPRECATED("Deprecated header: include Poco/Dynamic/Struct.h instead") + constexpr static int dynamicstruct_hpp_is_deprecated {0xBAD}; + constexpr static int please_dont_use_badheader_hpp = dynamicstruct_hpp_is_deprecated; +} #endif // Foundation_DynamicStruct_INCLUDED diff --git a/Foundation/include/Poco/HashStatistic.h b/Foundation/include/Poco/HashStatistic.h index 4d1a2fa2a..4c7ae1b3c 100644 --- a/Foundation/include/Poco/HashStatistic.h +++ b/Foundation/include/Poco/HashStatistic.h @@ -24,7 +24,7 @@ namespace Poco { -class POCO_DEPRECATED("") HashStatistic; +class POCO_DEPRECATED("Not supported since 2006, use Hash.") HashStatistic; class Foundation_API HashStatistic /// HashStatistic class bundles statistical information on the current state of a HashTable diff --git a/Net/include/Poco/Net/HTTPResponse.h b/Net/include/Poco/Net/HTTPResponse.h index 224ad9588..f448801a6 100644 --- a/Net/include/Poco/Net/HTTPResponse.h +++ b/Net/include/Poco/Net/HTTPResponse.h @@ -80,11 +80,11 @@ public: HTTP_LENGTH_REQUIRED = 411, HTTP_PRECONDITION_FAILED = 412, HTTP_REQUEST_ENTITY_TOO_LARGE = 413, - HTTP_REQUESTENTITYTOOLARGE POCO_DEPRECATED("") = 413, + HTTP_REQUESTENTITYTOOLARGE POCO_DEPRECATED("Use HTTP_REQUEST_ENTITY_TOO_LARGE") = 413, HTTP_REQUEST_URI_TOO_LONG = 414, - HTTP_REQUESTURITOOLONG POCO_DEPRECATED("") = 414, + HTTP_REQUESTURITOOLONG POCO_DEPRECATED("Use HTTP_REQUEST_URI_TOO_LONG") = 414, HTTP_UNSUPPORTED_MEDIA_TYPE = 415, - HTTP_UNSUPPORTEDMEDIATYPE POCO_DEPRECATED("") = 415, + HTTP_UNSUPPORTEDMEDIATYPE POCO_DEPRECATED("Use HTTP_UNSUPPORTED_MEDIA_TYPE") = 415, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416, HTTP_EXPECTATION_FAILED = 417, HTTP_IM_A_TEAPOT = 418, diff --git a/Net/include/Poco/Net/NetworkInterface.h b/Net/include/Poco/Net/NetworkInterface.h index b45e73354..f5471e03a 100644 --- a/Net/include/Poco/Net/NetworkInterface.h +++ b/Net/include/Poco/Net/NetworkInterface.h @@ -61,7 +61,7 @@ class Net_API NetworkInterface { public: using List = std::vector; - using NetworkInterfaceList POCO_DEPRECATED("") = List; + using NetworkInterfaceList POCO_DEPRECATED("Use NetworkInterface::List") = List; using Map = std::map; using AddressTuple = Poco::Tuple; using AddressList = std::vector; diff --git a/Net/include/Poco/Net/PollSet.h b/Net/include/Poco/Net/PollSet.h index 9f1dc7e1f..0be12738a 100644 --- a/Net/include/Poco/Net/PollSet.h +++ b/Net/include/Poco/Net/PollSet.h @@ -96,7 +96,6 @@ public: std::size_t size() const; /// Returns the number of sockets monitored. - //@ deprecated POCO_DEPRECATED("Use size() instead") int count() const; /// Returns the number of sockets monitored. /// This method is deprecated. Use size() instead.