QESDP: deprecate QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST

We've had this workaround since Qt 5.4. It's due time we get
rid of it. This commit deprecates it, in preparation for removal.

[ChangeLog][QtCore][QExplicitlySharedDataPointer] Support for
QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST has been
deprecated, and will get removed in a future version of Qt.

Change-Id: I3000ea606b37714542916e105ebd50871dc42935
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0ed039fd134fb8025236847295681f13f1775847)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Giuseppe D'Angelo 2024-06-11 18:14:33 +02:00 committed by Qt Cherry-pick Bot
parent a53473052b
commit 70dcbb4f17
2 changed files with 10 additions and 1 deletions

View File

@ -589,6 +589,10 @@ QT_BEGIN_NAMESPACE
\c{QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST} macro, and
therefore to allow old code (that relied on this feature) to
compile without modifications.
\note Usage of the
\c{QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST} macro is
deprecated. The macro will be removed in a future version of Qt.
*/
/*! \fn template <class T> QExplicitlySharedDataPointer<T>& QExplicitlySharedDataPointer<T>::operator=(const QExplicitlySharedDataPointer<T>& o)

View File

@ -162,7 +162,7 @@ public:
Q_NODISCARD_CTOR
QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<X> &o) noexcept
#ifdef QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST
: d(static_cast<T *>(o.data()))
: d(warnIfQExplicitlySharedDataPointerStaticCastMacroDefined(), static_cast<T *>(o.data()))
#else
: d(o.data())
#endif
@ -213,6 +213,11 @@ protected:
private:
void detach_helper();
#ifdef QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST
[[deprecated("Usage of QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST is deprecated.")]]
constexpr void warnIfQExplicitlySharedDataPointerStaticCastMacroDefined() {}
#endif
T *d;
};