Skip to content

Commit

Permalink
QESDP: deprecate QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST
Browse files Browse the repository at this point in the history
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
Pick-to: 6.8
Reviewed-by: Volker Hilsheimer <[email protected]>
  • Loading branch information
dangelog committed Jun 11, 2024
1 parent 0cd32e1 commit 0ed039f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/corelib/tools/qshareddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion src/corelib/tools/qshareddata.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class QExplicitlySharedDataPointer
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
Expand Down Expand Up @@ -213,6 +213,11 @@ class QExplicitlySharedDataPointer
private:
void detach_helper();

#ifdef QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST
[[deprecated("Usage of QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST is deprecated.")]]
constexpr void warnIfQExplicitlySharedDataPointerStaticCastMacroDefined() {}
#endif

T *d;
};

Expand Down

0 comments on commit 0ed039f

Please sign in to comment.