tst_QtBench: compile with QT_NO_FOREACH

The container is a member of the unittest, it's not changed by the loop
body or during iteration, so use a ranged-for and std::as_const.

Task-number: QTBUG-115839
Change-Id: I1be75d17ff305bc542cf7b058cc59d70cedc77ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Ahmad Samir 2023-08-17 03:06:46 +03:00
parent b5e4657307
commit a1a8e0bb38

View File

@ -1,8 +1,6 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include <qtest.h>
#include <QtCore/qmath.h>
@ -195,7 +193,7 @@ void tst_QtBench::qtBench_data()
benchmarks << (new DrawText(longString, DrawText::StaticTextBackendOptimizations));
benchmarks << (new DrawText(superLongString, DrawText::StaticTextBackendOptimizations));
foreach (Benchmark *benchmark, benchmarks)
for (Benchmark *benchmark : std::as_const(benchmarks))
QTest::newRow(qPrintable(benchmark->name())) << reinterpret_cast<void *>(benchmark);
}