summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib/tools
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-08-07 17:59:46 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2023-08-19 05:19:42 +0000
commit11d69325605071a32d10ed4392c67e9a07445ada (patch)
tree5027d993690bbd165bd4a90bc6c2789b596fe6d0 /tests/benchmarks/corelib/tools
parent1a3f573bd9fd7463e1def4c1fe655bcf0e2e6baa (diff)
Mark all of Qt as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses in this and some other modules is still extremely high, too high for anyone to tackle in a short amount of time. Even if they're not concentrated in just a few TUs, we need to make progress on a global QT_NO_FOREACH default, so grab the nettle and stick to our strategy: Mark the whole of Qt with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). In tst_qglobal.cpp and tst_qcollections.cpp change the comment on the #undef QT_NO_FOREACH to indicate that these actually test the macro. Task-number: QTBUG-115839 Change-Id: Iecc444eb7d43d7e4d037f6e155abe0e14a00a5d6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/benchmarks/corelib/tools')
-rw-r--r--tests/benchmarks/corelib/tools/qhash/CMakeLists.txt2
-rw-r--r--tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp2
-rw-r--r--tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp2
3 files changed, 6 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt b/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt
index 1958f86dd5..9002cc0723 100644
--- a/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt
@@ -9,6 +9,8 @@ qt_internal_add_benchmark(tst_bench_qhash
SOURCES
tst_bench_qhash.cpp
outofline.cpp
+ NO_PCH_SOURCES
+ tst_bench_qhash.cpp # undef QT_NO_FOREACH
INCLUDE_DIRECTORIES
.
LIBRARIES
diff --git a/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp
index fd0a74b52a..9d9703dc0c 100644
--- a/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp
@@ -2,6 +2,8 @@
// Copyright (C) 2016 Intel Corporation.
// 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_bench_qhash.h"
#include <QFile>
diff --git a/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp b/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp
index dbf4c2db6c..3f5f86b2cf 100644
--- a/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp
+++ b/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp
@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// This file contains benchmarks for QRect/QRectF functions.
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
#include <QDebug>
#include <qtest.h>