summaryrefslogtreecommitdiffstats
path: root/tests/manual/dialogs
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/manual/dialogs
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/manual/dialogs')
-rw-r--r--tests/manual/dialogs/CMakeLists.txt5
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp2
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp2
-rw-r--r--tests/manual/dialogs/utils.cpp2
4 files changed, 11 insertions, 0 deletions
diff --git a/tests/manual/dialogs/CMakeLists.txt b/tests/manual/dialogs/CMakeLists.txt
index b64043bf20..1900b68540 100644
--- a/tests/manual/dialogs/CMakeLists.txt
+++ b/tests/manual/dialogs/CMakeLists.txt
@@ -15,6 +15,9 @@ qt_internal_add_manual_test(dialogs
messageboxpanel.cpp messageboxpanel.h
utils.cpp utils.h
wizardpanel.cpp wizardpanel.h
+ NO_PCH_SOURCES
+ filedialogpanel.cpp # undef QT_NO_FOREACH
+ utils.cpp # undef QT_NO_FOREACH
LIBRARIES
Qt::Gui
Qt::Widgets
@@ -31,6 +34,8 @@ qt_internal_extend_target(dialogs CONDITION TARGET Qt::PrintSupport
qt_internal_extend_target(dialogs CONDITION NOT (QT_FEATURE_printer EQUAL FALSE)
SOURCES
printdialogpanel.cpp printdialogpanel.h printdialogpanel.ui
+ NO_PCH_SOURCES
+ printdialogpanel.cpp # undef QT_NO_FOREACH
ENABLE_AUTOGEN_TOOLS
uic
)
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index f7e2cfa638..6f807d9280 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -1,6 +1,8 @@
// Copyright (C) 2021 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 "filedialogpanel.h"
#include "utils.h"
diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp
index 6fe2eeab14..6395475399 100644
--- a/tests/manual/dialogs/printdialogpanel.cpp
+++ b/tests/manual/dialogs/printdialogpanel.cpp
@@ -1,6 +1,8 @@
// 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
+
#ifndef QT_NO_PRINTER
#include "printdialogpanel.h"
diff --git a/tests/manual/dialogs/utils.cpp b/tests/manual/dialogs/utils.cpp
index 9ac5f66a85..03e85d0191 100644
--- a/tests/manual/dialogs/utils.cpp
+++ b/tests/manual/dialogs/utils.cpp
@@ -1,6 +1,8 @@
// 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 "utils.h"
#include <QCheckBox>