From 2e4b1a8334d4de585e90637c070ba9832a0608f1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 16 Dec 2014 17:27:31 -0800 Subject: Remove Q_NO_USING_KEYWORD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's a lot of code now requiring it. Any compiler that doesn't support the keyword is too old for Qt now. The last time anyone asked about this macro was for QTBUG-27393 and we don't know which compiler that was. As a necessity, this patch contains a reversal of a0c3a57aed5cde37017733e7cf5e41cc6a1174aa [ChangeLog][Compiler Specific Changes] Qt 5.5 now unconditionally uses the "using" keyword. Compilers that do not support this keyword are deprecated and will not be able to build Qt. Previous versions of Qt may or may not compile, as no testing was done to ensure it worked. Change-Id: Ief042f34aba555a095d1f342a0ee7ee9feadf42d Reviewed-by: Lars Knoll Reviewed-by: Jędrzej Nowacki --- src/corelib/global/qcompilerdetection.h | 12 ------- src/corelib/itemmodels/qabstractitemmodel.cpp | 5 --- src/corelib/itemmodels/qabstractitemmodel.h | 16 --------- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 5 --- src/corelib/itemmodels/qsortfilterproxymodel.h | 4 --- src/corelib/tools/qhash.cpp | 42 ----------------------- src/corelib/tools/qhash.h | 2 +- src/corelib/tools/qmap.cpp | 43 ------------------------ src/corelib/tools/qmap.h | 2 +- src/corelib/tools/qstringlist.cpp | 23 ------------- src/corelib/tools/qstringlist.h | 7 ---- src/corelib/xml/qxmlstream.cpp | 9 ----- src/corelib/xml/qxmlstream.h | 5 --- 13 files changed, 2 insertions(+), 173 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e0fa45b45e..89006eea7c 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -75,7 +75,6 @@ # if defined(__SC__) && __SC__ < 0x750 # error "Compiler not supported" # endif -# define Q_NO_USING_KEYWORD #elif defined(_MSC_VER) # define Q_CC_MSVC (_MSC_VER) @@ -113,7 +112,6 @@ # if __BORLANDC__ < 0x502 # error "Compiler not supported" # endif -# define Q_NO_USING_KEYWORD #elif defined(__WATCOMC__) # define Q_CC_WAT @@ -278,7 +276,6 @@ # error "Compiler not supported" # endif /* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ -# define Q_NO_USING_KEYWORD /* Apply to all versions prior to Compaq C++ V6.0-000 - observed on DEC C++ V5.5-004. */ # if __DECCXX_VER < 60060000 @@ -323,7 +320,6 @@ compiler is using its own set of rules. Forget it. */ # elif defined(__KCC) # define Q_CC_KAI -# define Q_NO_USING_KEYWORD /* Using the `using' keyword avoids Intel C++ for Linux warnings */ # elif defined(__INTEL_COMPILER) @@ -346,23 +342,19 @@ # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) # define Q_OUTOFLINE_TEMPLATE inline # endif -# define Q_NO_USING_KEYWORD /* ### check "using" status */ /* Never tested! */ # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) # define Q_CC_OC -# define Q_NO_USING_KEYWORD /* CDS++ defines __EDG__ although this is not documented in the Reliant documentation. It also follows conventions like _BOOL and this documented */ # elif defined(sinix) # define Q_CC_CDS -# define Q_NO_USING_KEYWORD /* The MIPSpro compiler defines __EDG */ # elif defined(__sgi) # define Q_CC_MIPS -# define Q_NO_USING_KEYWORD /* ### check "using" status */ # define Q_NO_TEMPLATE_FRIENDS # if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740) # define Q_OUTOFLINE_TEMPLATE inline @@ -404,9 +396,6 @@ # if !defined(_BOOL) # error "Compiler not supported" # endif -# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) -# define Q_NO_USING_KEYWORD -# endif # define Q_C_CALLBACKS /* 4.2 compiler or older */ # else @@ -445,7 +434,6 @@ # else # error "Compiler not supported" # endif -# define Q_NO_USING_KEYWORD /* ### check "using" status */ #else # error "Qt has not been tested with this compiler - see http://www.qt-project.org/" diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 915b845c6b..88e39f9441 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1263,11 +1263,6 @@ void QAbstractItemModel::resetInternalData() \sa insertRows(), insertColumn(), removeRow() */ -/*! - \fn QObject *QAbstractItemModel::parent() const - \internal -*/ - /*! \fn QModelIndex QAbstractItemModel::parent(const QModelIndex &index) const = 0 diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index e8b6e9cf98..5761084055 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -230,11 +230,7 @@ public: virtual QHash roleNames() const; -#ifdef Q_NO_USING_KEYWORD - inline QObject *parent() const { return QObject::parent(); } -#else using QObject::parent; -#endif enum LayoutChangeHint { @@ -425,13 +421,7 @@ public: Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; -#ifdef Q_NO_USING_KEYWORD -#ifndef Q_QDOC - inline QObject *parent() const { return QAbstractItemModel::parent(); } -#endif -#else using QObject::parent; -#endif protected: QAbstractTableModel(QAbstractItemModelPrivate &dd, QObject *parent); @@ -456,13 +446,7 @@ public: Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; -#ifdef Q_NO_USING_KEYWORD -#ifndef Q_QDOC - inline QObject *parent() const { return QAbstractItemModel::parent(); } -#endif -#else using QObject::parent; -#endif protected: QAbstractListModel(QAbstractItemModelPrivate &dd, QObject *parent); diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 90dd984b83..e64d588432 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -2742,11 +2742,6 @@ QItemSelection QSortFilterProxyModel::mapSelectionFromSource(const QItemSelectio return QAbstractProxyModel::mapSelectionFromSource(sourceSelection); } -/*! - \fn QObject *QSortFilterProxyModel::parent() const - \internal -*/ - QT_END_NAMESPACE #include "moc_qsortfilterproxymodel.cpp" diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h index f2debb9bdf..9df785756c 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.h +++ b/src/corelib/itemmodels/qsortfilterproxymodel.h @@ -117,11 +117,7 @@ protected: void invalidateFilter(); public: -#ifdef Q_NO_USING_KEYWORD - inline QObject *parent() const { return QObject::parent(); } -#else using QObject::parent; -#endif QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 0f741a2f7e..6a08576f7e 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -2224,12 +2224,6 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW \sa QHash::contains() */ -/*! - \fn bool QMultiHash::contains(const Key &key) const - \overload - \sa QHash::contains() -*/ - /*! \fn int QMultiHash::remove(const Key &key, const T &value) \since 4.3 @@ -2240,12 +2234,6 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW \sa QHash::remove() */ -/*! - \fn int QMultiHash::remove(const Key &key) - \overload - \sa QHash::remove() -*/ - /*! \fn int QMultiHash::count(const Key &key, const T &value) const \since 4.3 @@ -2255,18 +2243,6 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW \sa QHash::count() */ -/*! - \fn int QMultiHash::count(const Key &key) const - \overload - \sa QHash::count() -*/ - -/*! - \fn int QMultiHash::count() const - \overload - \sa QHash::count() -*/ - /*! \fn typename QHash::iterator QMultiHash::find(const Key &key, const T &value) \since 4.3 @@ -2280,24 +2256,12 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW \sa QHash::find() */ -/*! - \fn typename QHash::iterator QMultiHash::find(const Key &key) - \overload - \sa QHash::find() -*/ - /*! \fn typename QHash::const_iterator QMultiHash::find(const Key &key, const T &value) const \since 4.3 \overload */ -/*! - \fn typename QHash::const_iterator QMultiHash::find(const Key &key) const - \overload - \sa QHash::find() -*/ - /*! \fn typename QHash::const_iterator QMultiHash::constFind(const Key &key, const T &value) const \since 4.3 @@ -2311,10 +2275,4 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW \sa QHash::constFind() */ -/*! - \fn typename QHash::const_iterator QMultiHash::constFind(const Key &key) const - \overload - \sa QHash::constFind() -*/ - QT_END_NAMESPACE diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 59a5251c50..771e81c8f4 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -977,7 +977,7 @@ public: inline QMultiHash operator+(const QMultiHash &other) const { QMultiHash result = *this; result += other; return result; } -#if !defined(Q_NO_USING_KEYWORD) && !defined(Q_CC_RVCT) +#if !defined(Q_CC_RVCT) // RVCT compiler doesn't handle using-keyword right when used functions are overloaded in child class using QHash::contains; using QHash::remove; diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 38b4c0ad7e..ef5fbac377 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -1797,12 +1797,6 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::contains() */ -/*! - \fn bool QMultiMap::contains(const Key &key) const - \overload - \sa QMap::contains() -*/ - /*! \fn int QMultiMap::remove(const Key &key, const T &value) \since 4.3 @@ -1813,12 +1807,6 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::remove() */ -/*! - \fn int QMultiMap::remove(const Key &key) - \overload - \sa QMap::remove() -*/ - /*! \fn int QMultiMap::count(const Key &key, const T &value) const \since 4.3 @@ -1828,18 +1816,6 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::count() */ -/*! - \fn int QMultiMap::count(const Key &key) const - \overload - \sa QMap::count() -*/ - -/*! - \fn int QMultiMap::count() const - \overload - \sa QMap::count() -*/ - /*! \fn typename QMap::iterator QMultiMap::find(const Key &key, const T &value) \since 4.3 @@ -1856,12 +1832,6 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::find() */ -/*! - \fn typename QMap::iterator QMultiMap::find(const Key &key) - \overload - \sa QMap::find() -*/ - /*! \fn typename QMap::const_iterator QMultiMap::find(const Key &key, const T &value) const \since 4.3 @@ -1879,13 +1849,6 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::find() */ -/*! - \fn typename QMap::const_iterator QMultiMap::find(const Key &key) const - \since 4.3 - \overload - \sa QMap::find() -*/ - /*! \fn typename QMap::const_iterator QMultiMap::constFind(const Key &key, const T &value) const \since 4.3 @@ -1899,10 +1862,4 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa QMap::constFind() */ -/*! - \fn typename QMap::const_iterator QMultiMap::constFind(const Key &key) const - \overload - \sa QMap::constFind() -*/ - QT_END_NAMESPACE diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index a776e2eb4d..ce550c540b 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -1157,7 +1157,7 @@ public: inline QMultiMap operator+(const QMultiMap &other) const { QMultiMap result = *this; result += other; return result; } -#if !defined(Q_NO_USING_KEYWORD) && !defined(Q_CC_RVCT) +#if !defined(Q_CC_RVCT) // RVCT compiler doesn't handle using-keyword right when used functions are overloaded in child class using QMap::contains; using QMap::remove; diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index 4e5393e0b0..5b2eb1de09 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -703,29 +703,6 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularEx #endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED -/*! - \fn int QStringList::indexOf(const QString &value, int from = 0) const - - Returns the index position of the first occurrence of \a value in - the list, searching forward from index position \a from. Returns - -1 if no item matched. - - \sa lastIndexOf(), contains(), QList::indexOf() -*/ - -/*! - \fn int QStringList::lastIndexOf(const QString &value, int from = -1) const - - Returns the index position of the last occurrence of \a value in - the list, searching backward from index position \a from. If \a - from is -1 (the default), the search starts at the last item. - Returns -1 if no item matched. - - By default, this function is case sensitive. - - \sa indexOf(), QList::lastIndexOf() -*/ - /*! \fn int QStringList::removeDuplicates() diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index b24a261a7c..fc86b196d7 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -108,15 +108,8 @@ public: #endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED -#if !defined(Q_NO_USING_KEYWORD) using QList::indexOf; using QList::lastIndexOf; -#else - inline int indexOf(const QString &str, int from = 0) const - { return QList::indexOf(str, from); } - inline int lastIndexOf(const QString &str, int from = -1) const - { return QList::lastIndexOf(str, from); } -#endif }; Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE); diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 94f6a8bcde..9928098a33 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -2392,15 +2392,6 @@ QXmlStreamAttribute& QXmlStreamAttribute::operator=(const QXmlStreamAttribute &o \ingroup xml-tools */ -/*! - \fn void QXmlStreamAttributes::append(const QXmlStreamAttribute &attribute) - - Appends the given \a attribute to the end of the vector. - - \sa QVector::append() -*/ - - /*! \typedef QXmlStreamNotationDeclarations \relates QXmlStreamNotationDeclaration diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h index 77f99c5d16..9a5756a431 100644 --- a/src/corelib/xml/qxmlstream.h +++ b/src/corelib/xml/qxmlstream.h @@ -125,12 +125,7 @@ public: return !value(namespaceUri, name).isNull(); } -#if !defined(Q_NO_USING_KEYWORD) using QVector::append; -#else - inline void append(const QXmlStreamAttribute &attribute) - { QVector::append(attribute); } -#endif }; class Q_CORE_EXPORT QXmlStreamNamespaceDeclaration { -- cgit v1.2.3