tst_qmakelib: compile with QT_NO_FOREACH
proEval(), proParser(): the loop was iterating over a temporary so it couldn't have changed it. Hold the container in a const auto variable and use ranged-for. formatValue(): iterating over a const QList& parameter, and the container isn't changed at the call sites during iterating, so Q_FOREACH wasn't needed to beging with. Use ranged-for instead. Task-number: QTBUG-115839 Change-Id: Idabe0bbd84b5bcc86cef275f80497651353a4d9e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
7101dcab7a
commit
6864576577
@ -24,9 +24,6 @@ qt_internal_add_test(tst_qmakelib
|
||||
evaltest.cpp
|
||||
parsertest.cpp
|
||||
tst_qmakelib.cpp tst_qmakelib.h
|
||||
NO_PCH_SOURCES
|
||||
evaltest.cpp # undef QT_NO_FOREACH
|
||||
parsertest.cpp # undef QT_NO_FOREACH
|
||||
DEFINES
|
||||
PROEVALUATOR_FULL
|
||||
PROEVALUATOR_SETENV
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
|
||||
|
||||
#include "tst_qmakelib.h"
|
||||
|
||||
#include <proitems.h>
|
||||
@ -2748,7 +2746,7 @@ static QString formatValue(const ProStringList &vals)
|
||||
{
|
||||
QString ret;
|
||||
|
||||
foreach (const ProString &str, vals) {
|
||||
for (const ProString &str : vals) {
|
||||
ret += QLatin1Char(' ');
|
||||
ret += QMakeEvaluator::quoteValue(str);
|
||||
}
|
||||
@ -2866,9 +2864,9 @@ void tst_qmakelib::proEval()
|
||||
qWarning("Got unexpected message(s)");
|
||||
verified = false;
|
||||
}
|
||||
QStringList missingMsgs = handler.expectedMessages();
|
||||
const QStringList missingMsgs = handler.expectedMessages();
|
||||
if (!missingMsgs.isEmpty()) {
|
||||
foreach (const QString &msg, missingMsgs)
|
||||
for (const QString &msg : missingMsgs)
|
||||
qWarning("Missing message: %s", qPrintable(msg));
|
||||
verified = false;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
|
||||
|
||||
#include "tst_qmakelib.h"
|
||||
|
||||
#include <proitems.h>
|
||||
@ -2013,9 +2011,9 @@ void tst_qmakelib::proParser()
|
||||
qWarning("Got unexpected message(s)");
|
||||
verified = false;
|
||||
}
|
||||
QStringList missingMsgs = handler.expectedMessages();
|
||||
const QStringList missingMsgs = handler.expectedMessages();
|
||||
if (!missingMsgs.isEmpty()) {
|
||||
foreach (const QString &msg, missingMsgs)
|
||||
for (const QString &msg : missingMsgs)
|
||||
qWarning("Missing message: %s", qPrintable(msg));
|
||||
verified = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user