QtCore: Disambiguate static variables

They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: I5f1fbee07872a742a78adc9864fe00c710ca24d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d3f8d7fd4140b269532e2daca8eb5cbfe28ed465)
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Friedemann Kleint 2023-01-26 13:46:21 +01:00
parent 0e834f6cd7
commit abd0301c7e
6 changed files with 13 additions and 9 deletions

View File

@ -458,6 +458,8 @@ Q_CORE_EXPORT quint64 qFloatDistance(double a, double b)
Returns true if the absolute value of \a f is within 0.00001f of 0.0.
*/
namespace QtNumericTests {
template <typename T> static constexpr T max = std::numeric_limits<T>::max();
template <typename T> static constexpr T min = std::numeric_limits<T>::min();
@ -489,4 +491,6 @@ static_assert(qt_saturate<int>(min<qint64>) == min<int>);
static_assert(qt_saturate<unsigned>(min<qint64>) == 0);
static_assert(qt_saturate<quint64>(min<qint64>) == 0);
} // namespace QtNumericTests
QT_END_NAMESPACE

View File

@ -53,7 +53,7 @@ Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type)
} // namespace QtPrivate
// copied from qmetaobject.cpp
[[maybe_unused]] static inline const QMetaObjectPrivate *priv(const uint* data)
[[maybe_unused]] static inline const QMetaObjectPrivate *qmobPriv(const uint* data)
{ return reinterpret_cast<const QMetaObjectPrivate*>(data); }
class QMetaMethodBuilderPrivate
@ -704,7 +704,7 @@ void QMetaObjectBuilder::addMetaObject(const QMetaObject *prototype,
}
if ((members & RelatedMetaObjects) != 0) {
Q_ASSERT(priv(prototype->d.data)->revision >= 2);
Q_ASSERT(qmobPriv(prototype->d.data)->revision >= 2);
const auto *objects = prototype->d.relatedMetaObjects;
if (objects) {
while (*objects != nullptr) {
@ -715,7 +715,7 @@ void QMetaObjectBuilder::addMetaObject(const QMetaObject *prototype,
}
if ((members & StaticMetacall) != 0) {
Q_ASSERT(priv(prototype->d.data)->revision >= 6);
Q_ASSERT(qmobPriv(prototype->d.data)->revision >= 6);
if (prototype->d.static_metacall)
setStaticMetacallFunction(prototype->d.static_metacall);
}

View File

@ -2312,7 +2312,7 @@ static QPartialOrdering numericCompare(const QVariant::Private *d1, const QVaria
}
#ifndef QT_BOOTSTRAPPED
static bool canConvertMetaObject(QMetaType fromType, QMetaType toType)
static bool qvCanConvertMetaObject(QMetaType fromType, QMetaType toType)
{
if ((fromType.flags() & QMetaType::PointerToQObject)
&& (toType.flags() & QMetaType::PointerToQObject)) {
@ -2342,7 +2342,7 @@ bool QVariant::equals(const QVariant &v) const
return numericCompare(&d, &v.d) == QPartialOrdering::Equivalent;
#ifndef QT_BOOTSTRAPPED
// if both types are related pointers to QObjects, check if they point to the same object
if (canConvertMetaObject(metatype, v.metaType()))
if (qvCanConvertMetaObject(metatype, v.metaType()))
return pointerCompare(&d, &v.d) == QPartialOrdering::Equivalent;
#endif
return false;
@ -2385,7 +2385,7 @@ QPartialOrdering QVariant::compare(const QVariant &lhs, const QVariant &rhs)
if (canBeNumericallyCompared(lhs.d.type().iface(), rhs.d.type().iface()))
return numericCompare(&lhs.d, &rhs.d);
#ifndef QT_BOOTSTRAPPED
if (canConvertMetaObject(lhs.metaType(), rhs.metaType()))
if (qvCanConvertMetaObject(lhs.metaType(), rhs.metaType()))
return pointerCompare(&lhs.d, &rhs.d);
#endif
return QPartialOrdering::Unordered;

View File

@ -1853,7 +1853,7 @@ void QXmlStreamReaderPrivate::parseError()
int ers = state_stack[tos];
int nexpected = 0;
int expected[nmax];
if (token != ERROR)
if (token != XML_ERROR)
for (int tk = 0; tk < TERMINAL_COUNT; ++tk) {
int k = t_action(ers, tk);
if (k <= 0)

View File

@ -44,7 +44,7 @@ public:
ENTITY = 32,
ENTITY_DONE = 45,
EQ = 14,
ERROR = 43,
XML_ERROR = 43,
FIXED = 39,
HASH = 6,
ID = 48,

View File

@ -140,7 +140,7 @@ bool QXmlStreamReaderPrivate::parse()
} else switch (token_char) {
case 0xfffe:
case 0xffff:
token = ERROR;
token = XML_ERROR;
break;
case '\r':
token = SPACE;