summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-10-18 21:43:59 +0200
committerLars Knoll <lars.knoll@qt.io>2018-11-26 07:04:24 +0000
commitb98c43ea602b336813fa967e610da2be100f748d (patch)
treefd3e78ee38a1f60b49b021e31aab7401bd90b017
parentc2bf0cac957b1e7866538201433f3cd38313ab7f (diff)
Compile with QT_STRICT_ITERATORS defined
This will be the only options for Qt 6, so make sure the code compiles now. Change-Id: I23f791d1efcbd0bd33805bb4563d40460954db43 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r--qmake/generators/makefile.cpp14
-rw-r--r--qmake/generators/unix/unixmake2.cpp2
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp4
-rw-r--r--qmake/generators/win32/winmakefile.cpp4
-rw-r--r--qmake/property.cpp14
-rw-r--r--src/corelib/codecs/qtextcodec.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbeventqueue.cpp6
-rw-r--r--src/tools/qlalr/lalr.h2
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp4
9 files changed, 28 insertions, 26 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index b7e591d2ab..2fbaa00f2d 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -624,7 +624,7 @@ MakefileGenerator::init()
compiler.flags |= Compiler::CompilerNoCheckDeps;
compilers.append(compiler);
}
- for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
+ for (ProStringList::ConstIterator it = quc.cbegin(); it != quc.cend(); ++it) {
const ProStringList &inputs = v[ProKey(*it + ".input")];
for(x = 0; x < inputs.size(); ++x) {
Compiler compiler;
@@ -1878,7 +1878,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
t << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmp_out, input, QString(), NoShell)));
} else {
- for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
+ for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
t << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmp_out, (*input).toQString(), QString(), NoShell)));
}
@@ -1912,7 +1912,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
const QString del_statement("-$(DEL_FILE)");
if(!wrote_clean) {
QStringList dels;
- for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
+ for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
QString tinp = (*input).toQString();
QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell);
for (const QString &rc : qAsConst(raw_clean)) {
@@ -1940,7 +1940,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
if(!cleans.isEmpty())
t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, "");
if(!wrote_clean_cmds) {
- for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
+ for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
QString tinp = (*input).toQString();
t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, tinp,
replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell), TargetShell);
@@ -1959,7 +1959,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QStringList deps, inputs;
if(!tmp_dep.isEmpty())
deps += fileFixify(tmp_dep, FileFixifyFromOutdir);
- for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
+ for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
QString inpf = (*input).toQString();
deps += findDependencies(inpf);
inputs += Option::fixPathToTargetOS(inpf, false);
@@ -2043,7 +2043,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
t << "\n\t" << cmd << endl << endl;
continue;
}
- for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
+ for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
QString inpf = (*input).toQString();
QString in = Option::fixPathToTargetOS(inpf, false);
QStringList deps = findDependencies(inpf);
@@ -3350,7 +3350,7 @@ MakefileGenerator::writePkgConfigFile()
libs << "QMAKE_LIBS_PRIVATE";
libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
t << "Libs.private:";
- for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
+ for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
t << ' ' << fixLibFlags((*it).toKey()).join(' ');
t << endl;
}
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index d3abedb50b..4a6b5c8579 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1485,7 +1485,7 @@ UnixMakefileGenerator::writeLibtoolFile()
ProStringList libs;
libs << "LIBS" << "QMAKE_LIBS";
t << "dependency_libs='";
- for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
+ for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
t << fixLibFlags((*it).toKey()).join(' ') << ' ';
t << "'\n\n";
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 6a125ccd77..d231260886 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -477,8 +477,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
// Add all unknown libs to the deps
QStringList where = QStringList() << "LIBS" << "LIBS_PRIVATE"
<< "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE";
- for (QStringList::ConstIterator wit = where.begin();
- wit != where.end(); ++wit) {
+ for (QStringList::ConstIterator wit = where.cbegin();
+ wit != where.cend(); ++wit) {
const ProStringList &l = tmp_proj.values(ProKey(*wit));
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
const QString opt = fixLibFlag(*it).toQString();
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index e0d03ccc1c..13069be60c 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -112,8 +112,8 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
goto found;
}
QString libBase = (*dir_it).local() + '/' + lib + verovr;
- for (ProStringList::ConstIterator extit = impexts.begin();
- extit != impexts.end(); ++extit) {
+ for (ProStringList::ConstIterator extit = impexts.cbegin();
+ extit != impexts.cend(); ++extit) {
if (exists(libBase + '.' + *extit)) {
(*it) = cand + verovr + '.' + *extit;
goto found;
diff --git a/qmake/property.cpp b/qmake/property.cpp
index c0a3ec0dab..432ff55664 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -178,8 +178,8 @@ QMakeProperty::exec()
}
return true;
}
- for(QStringList::ConstIterator it = Option::prop::properties.begin();
- it != Option::prop::properties.end(); it++) {
+ for (QStringList::ConstIterator it = Option::prop::properties.cbegin();
+ it != Option::prop::properties.cend(); it++) {
if(Option::prop::properties.count() > 1)
fprintf(stdout, "%s:", (*it).toLatin1().constData());
const ProKey pkey(*it);
@@ -191,11 +191,11 @@ QMakeProperty::exec()
}
}
} else if(Option::qmake_mode == Option::QMAKE_SET_PROPERTY) {
- for(QStringList::ConstIterator it = Option::prop::properties.begin();
- it != Option::prop::properties.end(); it++) {
+ for (QStringList::ConstIterator it = Option::prop::properties.cbegin();
+ it != Option::prop::properties.cend(); it++) {
QString var = (*it);
it++;
- if(it == Option::prop::properties.end()) {
+ if (it == Option::prop::properties.cend()) {
ret = false;
break;
}
@@ -203,8 +203,8 @@ QMakeProperty::exec()
setValue(var, (*it));
}
} else if(Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) {
- for(QStringList::ConstIterator it = Option::prop::properties.begin();
- it != Option::prop::properties.end(); it++) {
+ for (QStringList::ConstIterator it = Option::prop::properties.cbegin();
+ it != Option::prop::properties.cend(); it++) {
QString var = (*it);
if(!var.startsWith("."))
remove(var);
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 466c575c3e..3fc199c0a1 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -505,9 +505,9 @@ QTextCodec::~QTextCodec()
globalData->allCodecs.removeOne(this);
- auto it = globalData->codecCache.cbegin();
+ auto it = globalData->codecCache.begin();
- while (it != globalData->codecCache.cend()) {
+ while (it != globalData->codecCache.end()) {
if (it.value() == this)
it = globalData->codecCache.erase(it);
else
diff --git a/src/plugins/platforms/xcb/qxcbeventqueue.cpp b/src/plugins/platforms/xcb/qxcbeventqueue.cpp
index 862f68764b..883268b083 100644
--- a/src/plugins/platforms/xcb/qxcbeventqueue.cpp
+++ b/src/plugins/platforms/xcb/qxcbeventqueue.cpp
@@ -257,7 +257,7 @@ qint32 QXcbEventQueue::generatePeekerId()
bool QXcbEventQueue::removePeekerId(qint32 peekerId)
{
- const auto it = m_peekerToNode.find(peekerId);
+ const auto it = m_peekerToNode.constFind(peekerId);
if (it == m_peekerToNode.constEnd()) {
qCWarning(lcQpaXcb, "failed to remove unknown peeker id: %d", peekerId);
return false;
@@ -276,7 +276,7 @@ bool QXcbEventQueue::peekEventQueue(PeekerCallback peeker, void *peekerData,
const bool peekerIdProvided = peekerId != -1;
auto peekerToNodeIt = m_peekerToNode.find(peekerId);
- if (peekerIdProvided && peekerToNodeIt == m_peekerToNode.constEnd()) {
+ if (peekerIdProvided && peekerToNodeIt == m_peekerToNode.end()) {
qCWarning(lcQpaXcb, "failed to find index for unknown peeker id: %d", peekerId);
return false;
}
@@ -336,7 +336,7 @@ bool QXcbEventQueue::peekEventQueue(PeekerCallback peeker, void *peekerData,
// Before updating, make sure that a peeker callback did not remove
// the peeker id.
peekerToNodeIt = m_peekerToNode.find(peekerId);
- if (peekerToNodeIt != m_peekerToNode.constEnd())
+ if (peekerToNodeIt != m_peekerToNode.end())
*peekerToNodeIt = node; // id still in the cache, update node
}
diff --git a/src/tools/qlalr/lalr.h b/src/tools/qlalr/lalr.h
index 6a2baaa462..8eadee400d 100644
--- a/src/tools/qlalr/lalr.h
+++ b/src/tools/qlalr/lalr.h
@@ -61,6 +61,8 @@ public:
public:
const_iterator () {}
+ const_iterator (const typename _Base::iterator &it):
+ _M_iterator (typename _Base::const_iterator(it)) {}
const_iterator (const typename _Base::const_iterator &it):
_M_iterator (it) {}
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index d06baed322..e2ef5635c2 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -360,8 +360,8 @@ void tst_QApplication::setFont_data()
int cnt = 0;
QFontDatabase fdb;
QStringList families = fdb.families();
- for (QStringList::const_iterator itr = families.begin();
- itr != families.end();
+ for (QStringList::const_iterator itr = families.cbegin();
+ itr != families.cend();
++itr) {
if (cnt < 3) {
QString family = *itr;