Mark ios plugin as free of Q_FOREACH, except where it isn't

The density of Q_FOREACH uses is high here, too high for this author
to tackle in a short amount of time. But they're concentrated in just
a few TUs, so pick a different strategy:

Mark the whole plugin 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. Since the TUs 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). I'm aware that Objective-C/C++ files are
currently probably implicitly NO_PCH_SOURCES, but don't rely on that.

Task-number: QTBUG-115839
Change-Id: If451501f3cb7cc3a182854a94bc5d27c907f6161
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Marc Mutz 2023-08-07 17:42:52 +02:00
parent 52ef958429
commit a4d968adc0
5 changed files with 15 additions and 0 deletions

View File

@ -28,6 +28,13 @@ qt_internal_add_plugin(QIOSIntegrationPlugin
quiaccessibilityelement.h quiaccessibilityelement.mm
quiview.h quiview.mm
uistrings_p.h uistrings.cpp
NO_PCH_SOURCES
qioscontext.mm # undef QT_NO_FOREACH
qiosintegration.mm # undef QT_NO_FOREACH
qiosplatformaccessibility.mm # undef QT_NO_FOREACH
qiosscreen.mm # undef QT_NO_FOREACH
DEFINES
QT_NO_FOREACH
LIBRARIES
${FWAudioToolbox}
${FWFoundation}

View File

@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qioscontext.h"
#include "qiosintegration.h"

View File

@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qiosintegration.h"
#include "qioseventdispatcher.h"
#include "qiosglobal.h"

View File

@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qiosplatformaccessibility.h"
#if QT_CONFIG(accessibility)

View File

@ -1,6 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "qiosglobal.h"
#include "qiosintegration.h"
#include "qiosscreen.h"