From 26f43dcc70a0bcc8aec96a0ca6f648c543b97b10 Mon Sep 17 00:00:00 2001 From: miniak Date: Tue, 3 Aug 2010 18:33:12 +0200 Subject: It is no longer necessary to check for QT_NO_MEMBER_TEMPLATES Merge-request: 756 Reviewed-by: Olivier Goffart --- src/corelib/concurrent/qfuture.h | 2 +- src/corelib/io/qdebug.h | 4 ---- src/corelib/kernel/qobject.h | 6 ++---- src/corelib/kernel/qobjectdefs.h | 4 ++-- src/corelib/kernel/qvariant.h | 6 ------ src/corelib/tools/qshareddata.h | 2 -- src/corelib/tools/qsharedpointer.cpp | 4 ---- src/corelib/tools/qsharedpointer.h | 3 --- src/gui/math3d/qmatrix4x4.cpp | 4 ---- src/gui/math3d/qmatrix4x4.h | 10 ++-------- src/script/api/qscriptengine.h | 8 -------- src/xmlpatterns/utils/qautoptr_p.h | 2 -- tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp | 6 ++---- tests/auto/qobject/tst_qobject.cpp | 2 -- tests/auto/qscriptengine/tst_qscriptengine.cpp | 2 -- 15 files changed, 9 insertions(+), 56 deletions(-) diff --git a/src/corelib/concurrent/qfuture.h b/src/corelib/concurrent/qfuture.h index 02ae40a..2856f5e 100644 --- a/src/corelib/concurrent/qfuture.h +++ b/src/corelib/concurrent/qfuture.h @@ -210,7 +210,7 @@ public: bool operator==(const QFuture &other) const { return (d == other.d); } bool operator!=(const QFuture &other) const { return (d != other.d); } -#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(Q_CC_XLC) +#if !defined(Q_CC_XLC) template QFuture(const QFuture &other) : d(other.d) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 093312f..0591318 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -137,10 +137,8 @@ public: inline QNoDebug &nospace() { return *this; } inline QNoDebug &maybeSpace() { return *this; } -#ifndef QT_NO_MEMBER_TEMPLATES template inline QNoDebug &operator<<(const T &) { return *this; } -#endif }; Q_CORE_EXPORT_INLINE QDebug qCritical() { return QDebug(QtCriticalMsg); } @@ -285,10 +283,8 @@ Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); } inline QNoDebug qDebug() { return QNoDebug(); } #define qDebug QT_NO_QDEBUG_MACRO -#ifdef QT_NO_MEMBER_TEMPLATES template inline QNoDebug operator<<(QNoDebug debug, const T &) { return debug; } -#endif #endif diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 7f0084c..c8aa2b5 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -156,7 +156,6 @@ public: int startTimer(int interval); void killTimer(int id); -#ifndef QT_NO_MEMBER_TEMPLATES template inline T findChild(const QString &aName = QString()) const { return qFindChild(this, aName); } @@ -170,7 +169,6 @@ public: inline QList findChildren(const QRegExp &re) const { return qFindChildren(this, re); } #endif -#endif #ifdef QT3_SUPPORT QT3_SUPPORT QObject *child(const char *objName, const char *inheritsClass = 0, @@ -369,7 +367,7 @@ inline QList qFindChildren(const QObject *o, const QRegExp &re) template inline T qobject_cast(QObject *object) { -#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK) +#if !defined(QT_NO_QOBJECT_CHECK) reinterpret_cast(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast(object)); #endif return static_cast(reinterpret_cast(0)->staticMetaObject.cast(object)); @@ -382,7 +380,7 @@ inline T qobject_cast(const QObject *object) register T ptr = static_cast(object); Q_UNUSED(ptr); -#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK) +#if !defined(QT_NO_QOBJECT_CHECK) reinterpret_cast(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast(const_cast(object))); #endif return static_cast(const_cast(reinterpret_cast(0)->staticMetaObject.cast(const_cast(object)))); diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 555a1f5..996fce2 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -117,7 +117,7 @@ class QString; # define QT_TR_FUNCTIONS #endif -#if defined(QT_NO_MEMBER_TEMPLATES) || defined(QT_NO_QOBJECT_CHECK) +#if defined(QT_NO_QOBJECT_CHECK) /* tmake ignore Q_OBJECT */ #define Q_OBJECT_CHECK #else @@ -144,7 +144,7 @@ inline int qYouForgotTheQ_OBJECT_Macro(T, T) { return 0; } template inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} -#endif // QT_NO_MEMBER_TEMPLATES +#endif // QT_NO_QOBJECT_CHECK #ifdef Q_NO_DATA_RELOCATION #define Q_OBJECT_GETSTATICMETAOBJECT static const QMetaObject &getStaticMetaObject(); diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index cb2825c..73b00e9 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -83,7 +83,6 @@ class QUrl; class QVariant; class QVariantComparisonHelper; -#ifndef QT_NO_MEMBER_TEMPLATES template inline QVariant qVariantFromValue(const T &); @@ -95,7 +94,6 @@ inline T qVariantValue(const QVariant &); template inline bool qVariantCanConvert(const QVariant &); -#endif class Q_CORE_EXPORT QVariant { @@ -327,7 +325,6 @@ class Q_CORE_EXPORT QVariant const void *constData() const; inline const void *data() const { return constData(); } -#ifndef QT_NO_MEMBER_TEMPLATES template inline void setValue(const T &value); @@ -342,7 +339,6 @@ class Q_CORE_EXPORT QVariant template bool canConvert() const { return qVariantCanConvert(*this); } -#endif public: #ifndef qdoc @@ -527,11 +523,9 @@ inline QSize &QVariant::asSize() { return *reinterpret_cast(castOrDetach(Size)); } #endif //QT3_SUPPORT -#ifndef QT_NO_MEMBER_TEMPLATES template inline void QVariant::setValue(const T &avalue) { qVariantSetValue(*this, avalue); } -#endif #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream& operator>> (QDataStream& s, QVariant& p); diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 7e9934d..80ba7b7 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -161,14 +161,12 @@ public: explicit QExplicitlySharedDataPointer(T *data); inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer &o) : d(o.d) { if (d) d->ref.ref(); } -#ifndef QT_NO_MEMBER_TEMPLATES template inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer &o) : d(static_cast(o.data())) { if(d) d->ref.ref(); } -#endif inline QExplicitlySharedDataPointer & operator=(const QExplicitlySharedDataPointer &o) { if (o.d != d) { diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 1b4b356..bad2897 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -1275,8 +1275,6 @@ QT_END_NAMESPACE -#if !defined(QT_NO_MEMBER_TEMPLATES) - //# define QT_SHARED_POINTER_BACKTRACE_SUPPORT # ifdef QT_SHARED_POINTER_BACKTRACE_SUPPORT # if defined(__GLIBC__) && (__GLIBC__ >= 2) && !defined(__UCLIBC__) && !defined(QT_LINUXBASE) @@ -1501,5 +1499,3 @@ void QtSharedPointer::internalSafetyCheckCleanCheck() } QT_END_NAMESPACE - -#endif diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h index c51ade6..e0f4dca 100644 --- a/src/corelib/tools/qsharedpointer.h +++ b/src/corelib/tools/qsharedpointer.h @@ -47,10 +47,7 @@ #include #ifndef Q_QDOC -# if !defined(QT_NO_MEMBER_TEMPLATES) -// QSharedPointer requires member template support # include -# endif #else QT_BEGIN_HEADER diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 16c7f97..04a9099 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -102,8 +102,6 @@ QMatrix4x4::QMatrix4x4(const qreal *values) \sa optimize() */ -#if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) - /*! \fn QMatrix4x4::QMatrix4x4(const QGenericMatrix& matrix) @@ -126,8 +124,6 @@ QMatrix4x4::QMatrix4x4(const qreal *values) \sa qGenericMatrixFromMatrix4x4() */ -#endif - /*! \fn QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix& matrix) \relates QMatrix4x4 diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 0671fa8..1f77d36 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -69,10 +69,10 @@ public: qreal m21, qreal m22, qreal m23, qreal m24, qreal m31, qreal m32, qreal m33, qreal m34, qreal m41, qreal m42, qreal m43, qreal m44); -#if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) + template explicit QMatrix4x4(const QGenericMatrix& matrix); -#endif + QMatrix4x4(const qreal *values, int cols, int rows); QMatrix4x4(const QTransform& transform); QMatrix4x4(const QMatrix& matrix); @@ -169,10 +169,8 @@ public: QRect mapRect(const QRect& rect) const; QRectF mapRect(const QRectF& rect) const; -#if !defined(QT_NO_MEMBER_TEMPLATES) || defined(Q_QDOC) template QGenericMatrix toGenericMatrix() const; -#endif inline qreal *data(); inline const qreal *data() const { return m[0]; } @@ -223,8 +221,6 @@ inline QMatrix4x4::QMatrix4x4 flagBits = General; } -#if !defined(QT_NO_MEMBER_TEMPLATES) - template Q_INLINE_TEMPLATE QMatrix4x4::QMatrix4x4 (const QGenericMatrix& matrix) @@ -261,8 +257,6 @@ QGenericMatrix QMatrix4x4::toGenericMatrix() const return result; } -#endif - inline const qreal& QMatrix4x4::operator()(int aRow, int aColumn) const { Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4); diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h index 1fe65db..6add6ed 100644 --- a/src/script/api/qscriptengine.h +++ b/src/script/api/qscriptengine.h @@ -65,13 +65,11 @@ inline QScriptValue qscriptQMetaObjectConstructor(QScriptContext *, QScriptEngin class QRegExp; #endif -#ifndef QT_NO_MEMBER_TEMPLATES template inline QScriptValue qScriptValueFromValue(QScriptEngine *, const T &); template inline T qScriptValueToValue(const QScriptValue &); -#endif class QScriptSyntaxCheckResultPrivate; class Q_SCRIPT_EXPORT QScriptSyntaxCheckResult @@ -196,9 +194,7 @@ public: QScriptValue newQMetaObject(const QMetaObject *metaObject, const QScriptValue &ctor = QScriptValue()); -# ifndef QT_NO_MEMBER_TEMPLATES template QScriptValue scriptValueFromQMetaObject(); -# endif // QT_NO_MEMBER_TEMPLATES #endif // QT_NO_QOBJECT @@ -213,7 +209,6 @@ public: -#ifndef QT_NO_MEMBER_TEMPLATES template inline QScriptValue toScriptValue(const T &value) { @@ -224,7 +219,6 @@ public: { return qScriptValueToValue(value); } -#endif // QT_NO_MEMBER_TEMPLATES void installTranslatorFunctions(const QScriptValue &object = QScriptValue()); @@ -311,12 +305,10 @@ template<> inline QScriptValue qscriptQMetaObjectConstructor(QScriptContext * return o; \ } -# ifndef QT_NO_MEMBER_TEMPLATES template QScriptValue QScriptEngine::scriptValueFromQMetaObject() { return qScriptValueFromQMetaObject(this); } -# endif // QT_NO_MEMBER_TEMPLATES #endif // QT_NO_QOBJECT diff --git a/src/xmlpatterns/utils/qautoptr_p.h b/src/xmlpatterns/utils/qautoptr_p.h index 060e7be..173999f 100644 --- a/src/xmlpatterns/utils/qautoptr_p.h +++ b/src/xmlpatterns/utils/qautoptr_p.h @@ -122,7 +122,6 @@ namespace QPatternist return *this; } -#ifndef QT_NO_MEMBER_TEMPLATES template operator AutoPtrRef() { @@ -139,7 +138,6 @@ namespace QPatternist inline AutoPtr(AutoPtr& other) : m_ptr(other.release()) { } -#endif inline T *release() { diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp index 5709196..22c679a 100644 --- a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp @@ -2822,10 +2822,9 @@ void tst_QMatrixNxN::convertGeneric() 9.0f, 10.0f, 11.0f, 12.0f, 0.0f, 0.0f, 0.0f, 1.0f }; -#if !defined(QT_NO_MEMBER_TEMPLATES) QMatrix4x4 m4(m1); QVERIFY(isSame(m4, unique4x4)); -#endif + QMatrix4x4 m5 = qGenericMatrixToMatrix4x4(m1); QVERIFY(isSame(m5, unique4x4)); @@ -2835,10 +2834,9 @@ void tst_QMatrixNxN::convertGeneric() 9.0f, 10.0f, 11.0f, 12.0f }; QMatrix4x4 m9(uniqueValues4); -#if !defined(QT_NO_MEMBER_TEMPLATES) + QMatrix4x3 m10 = m9.toGenericMatrix<4, 3>(); QVERIFY(isSame(m10, conv4x4)); -#endif QMatrix4x3 m11 = qGenericMatrixFromMatrix4x4<4, 3>(m9); QVERIFY(isSame(m11, conv4x4)); diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 5caac15..fc38a84 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -669,11 +669,9 @@ void tst_QObject::findChildren() l = qFindChildren(&o, "unnamed"); QCOMPARE(l.size(), 0); -#ifndef QT_NO_MEMBER_TEMPLATES tl = o.findChildren("t1"); QCOMPARE(tl.size(), 1); QCOMPARE(tl.at(0), &t1); -#endif } diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 81fb749..04b2627 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1909,7 +1909,6 @@ void tst_QScriptEngine::valueConversion() QString snum = qScriptValueToValue(num); QCOMPARE(snum, QLatin1String("123")); } -#ifndef QT_NO_MEMBER_TEMPLATES { QScriptValue num = eng.toScriptValue(123); QCOMPARE(num.isNumber(), true); @@ -1921,7 +1920,6 @@ void tst_QScriptEngine::valueConversion() QString snum = eng.fromScriptValue(num); QCOMPARE(snum, QLatin1String("123")); } -#endif { QScriptValue num(&eng, 123); QCOMPARE(qScriptValueToValue(num), char(123)); -- cgit v0.12