QMutex: remove QMutexPrivate from the public-ish API

Pass the pointer as a void* to avoid having "QMutexPrivate" in the ABI
that user content calls. To have such a private type in ABI used by
inlines in user code required an ELFIGNORE in qmutex_p.h. This change
removes that need for Qt 7.

We can't add an #ifdef for the comment block because "ignore-next" would
then apply to the #endif line. Therefore, a ### Qt7 comment will have to
suffice. It's harmless if we forget to do it.

Change-Id: I83e6ddaf775e71eacb42fffd5cd6b87527b9c08b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Thiago Macieira 2024-12-04 13:58:39 -08:00
parent c3de090569
commit bc080a909b
4 changed files with 15 additions and 1 deletions

View File

@ -1274,6 +1274,15 @@ QByteArray QMetaEnum::valueToKeys(int value) const
}
#include "qmutex.h"
#if QT_CONFIG(thread)
void QBasicMutex::destroyInternal(QMutexPrivate *d)
{
return destroyInternal(static_cast<void *>(d));
}
#endif
#include "qstring.h"
QString QString::arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const

View File

@ -101,8 +101,9 @@ static inline QMutexPrivate *dummyFutexValue()
\warning Destroying a locked mutex may result in undefined behavior.
*/
void QBasicMutex::destroyInternal(QMutexPrivate *d)
void QBasicMutex::destroyInternal(void *ptr)
{
auto d = static_cast<QMutexPrivate *>(ptr);
if (!d)
return;
if (!futexAvailable()) {

View File

@ -88,7 +88,10 @@ private:
bool lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT;
#endif
void unlockInternal() noexcept;
#if QT_CORE_REMOVED_SINCE(6, 9)
void destroyInternal(QMutexPrivate *d);
#endif
void destroyInternal(void *d);
QBasicAtomicPointer<QMutexPrivate> d_ptr;
static inline QMutexPrivate *dummyLocked() {

View File

@ -35,6 +35,7 @@ struct timespec;
QT_BEGIN_NAMESPACE
// ### Qt7 remove this comment block
// We manipulate the pointer to this class in inline, atomic code,
// so syncqt mustn't mark them as private, so ELFVERSION:ignore-next
class QMutexPrivate