QMetaType: port the BC fix for id() to new QT_REMOVED_SINCE
The allows qmetatype.cpp compilation to enjoy PCH again. Change-Id: I47c5af33a5dbc930ee4c120b254e732c52bc2369 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
d3646d2b05
commit
d5c605b148
@ -279,7 +279,6 @@ qt_internal_add_module(Core
|
|||||||
|
|
||||||
set(corelib_no_pch_sources
|
set(corelib_no_pch_sources
|
||||||
compat/removed_api.cpp
|
compat/removed_api.cpp
|
||||||
kernel/qmetatype.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(src ${corelib_no_pch_sources})
|
foreach(src ${corelib_no_pch_sources})
|
||||||
|
@ -43,6 +43,23 @@
|
|||||||
|
|
||||||
QT_USE_NAMESPACE
|
QT_USE_NAMESPACE
|
||||||
|
|
||||||
|
#if QT_REMOVED_SINCE(6, 1)
|
||||||
|
|
||||||
|
#include "qmetatype.h"
|
||||||
|
|
||||||
|
// keep in sync with version in header
|
||||||
|
int QMetaType::id() const
|
||||||
|
{
|
||||||
|
if (d_ptr) {
|
||||||
|
if (int id = d_ptr->typeId.loadRelaxed())
|
||||||
|
return id;
|
||||||
|
return idHelper();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // QT_REMOVED_SINCE(6, 1)
|
||||||
|
|
||||||
#if QT_REMOVED_SINCE(6, 3)
|
#if QT_REMOVED_SINCE(6, 3)
|
||||||
|
|
||||||
#include "tools/qcryptographichash.h"
|
#include "tools/qcryptographichash.h"
|
||||||
|
@ -37,9 +37,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define QT_QMETATYPE_BC_COMPAT 1
|
|
||||||
#include "qmetatype.h"
|
#include "qmetatype.h"
|
||||||
#undef QT_QMETATYPE_BC_COMPAT
|
|
||||||
#include "qmetatype_p.h"
|
#include "qmetatype_p.h"
|
||||||
#include "qobjectdefs.h"
|
#include "qobjectdefs.h"
|
||||||
#include "qdatetime.h"
|
#include "qdatetime.h"
|
||||||
@ -491,18 +489,6 @@ bool QMetaType::isRegistered() const
|
|||||||
Returns id type hold by this QMetatype instance.
|
Returns id type hold by this QMetatype instance.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// keep in sync with version in header
|
|
||||||
// ### Qt 7::remove BC helper
|
|
||||||
int QMetaType::id() const
|
|
||||||
{
|
|
||||||
if (d_ptr) {
|
|
||||||
if (int id = d_ptr->typeId.loadRelaxed())
|
|
||||||
return id;
|
|
||||||
return idHelper();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
The slowpath of id(). Precondition: d_ptr != nullptr
|
The slowpath of id(). Precondition: d_ptr != nullptr
|
||||||
|
@ -445,13 +445,14 @@ public:
|
|||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
bool isRegistered() const;
|
bool isRegistered() const;
|
||||||
#if defined(QT_QMETATYPE_BC_COMPAT) || defined(Q_QDOC)
|
#if QT_REMOVED_SINCE(6, 1) || defined(Q_QDOC)
|
||||||
int id() const;
|
int id() const;
|
||||||
#else
|
#else
|
||||||
// ### Qt 7: Remove traces of out of line version
|
// ### Qt 7: Remove traces of out of line version
|
||||||
// unused int parameter is used to avoid ODR violation
|
// unused int parameter is used to avoid ODR violation
|
||||||
int id(int = 0) const
|
int id(int = 0) const
|
||||||
{
|
{
|
||||||
|
// keep in sync with the version in removed_api.cpp
|
||||||
if (d_ptr) {
|
if (d_ptr) {
|
||||||
if (int id = d_ptr->typeId.loadRelaxed())
|
if (int id = d_ptr->typeId.loadRelaxed())
|
||||||
return id;
|
return id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user