From 81f128c5f09a7cae9e549458bcf23943b0b9a351 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Feb 2019 15:22:11 +0100 Subject: Replace the deprecated Qt algorithms by their std:: equivalents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warnings occurring in 5.13: sources/shiboken2/ApiExtractor/abstractmetalang.cpp:1431:66: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(AbstractMetaFunction*, AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:358:43: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:1683:55: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = QList::iterator]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5500:53: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1585:65: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(const AbstractMetaFunction*, const AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1681:24: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:2054:25: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations] Change-Id: If6940941ac31327597ce362a31b27773f4d5b94c Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/abstractmetalang.cpp | 6 +++++- sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp | 6 +++--- sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 10 +++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp index c65d7e0bd..c3063aaa1 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp @@ -42,6 +42,10 @@ #include #include +#include + +#include + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const AbstractMetaAttributes *aa) { @@ -1428,7 +1432,7 @@ bool AbstractMetaClass::hasLogicalOperatorOverload() const void AbstractMetaClass::sortFunctions() { - qSort(m_functions.begin(), m_functions.end(), function_sorter); + std::sort(m_functions.begin(), m_functions.end(), function_sorter); } void AbstractMetaClass::setFunctions(const AbstractMetaFunctionList &functions) diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index ea971287a..b8ef2b052 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -1582,7 +1582,7 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex //Function list AbstractMetaFunctionList functionList = metaClass->functions(); - qSort(functionList.begin(), functionList.end(), functionSort); + std::sort(functionList.begin(), functionList.end(), functionSort); s << endl << "Detailed Description\n" @@ -1678,7 +1678,7 @@ void QtDocGenerator::writeFunctionBlock(QTextStream& s, const QString& title, QS s << title << endl << QString(title.size(), QLatin1Char('^')) << endl; - qSort(functions); + std::sort(functions.begin(), functions.end()); s << ".. container:: function_list" << endl << endl; Indentation indentation(INDENT); @@ -2051,7 +2051,7 @@ static void writeFancyToc(QTextStream& s, const QStringList& items, int cols = 4 QMutableMapIterator it(tocMap); while (it.hasNext()) { it.next(); - qSort(it.value()); + std::sort(it.value().begin(), it.value().end()); if (i) ss << endl; diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 56f53f304..0ca0b8d04 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -43,6 +43,10 @@ #include #include +#include + +#include + static const char CPP_ARG0[] = "cppArg0"; QHash CppGenerator::m_nbFuncs = QHash(); @@ -355,7 +359,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext) QVector includes = metaClass->typeEntry()->extraIncludes(); for (AbstractMetaEnum *cppEnum : qAsConst(classEnums)) includes.append(cppEnum->typeEntry()->extraIncludes()); - qSort(includes.begin(), includes.end()); + std::sort(includes.begin(), includes.end()); for (const Include &inc : qAsConst(includes)) s << inc.toString() << endl; s << endl; @@ -1680,7 +1684,7 @@ void CppGenerator::writeConstructorWrapper(QTextStream &s, const AbstractMetaFun } } QStringList argNamesList = argNamesSet.toList(); - qSort(argNamesList.begin(), argNamesList.end()); + std::sort(argNamesList.begin(), argNamesList.end()); if (argNamesList.isEmpty()) { s << INDENT << "const char** argNames{};" << endl; } else { @@ -5503,7 +5507,7 @@ bool CppGenerator::finishGeneration() QVector extraIncludes = moduleEntry->extraIncludes(); for (AbstractMetaEnum *cppEnum : qAsConst(globalEnums)) extraIncludes.append(cppEnum->typeEntry()->extraIncludes()); - qSort(extraIncludes.begin(), extraIncludes.end()); + std::sort(extraIncludes.begin(), extraIncludes.end()); for (const Include &inc : qAsConst(extraIncludes)) s << inc; s << endl; -- cgit v1.2.3