From 574aa256cff4f7dae7e8a86c23cc17b081f1f90b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 7 Aug 2023 17:42:52 +0200 Subject: [PATCH] Mark QNX 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). Task-number: QTBUG-115839 Change-Id: I42c26cb5d95add115e57cc484a0e1a93ed368ddd Reviewed-by: James McDonnell --- src/plugins/platforms/qnx/CMakeLists.txt | 8 ++++++++ src/plugins/platforms/qnx/qqnxclipboard.cpp | 2 ++ src/plugins/platforms/qnx/qqnxintegration.cpp | 2 ++ src/plugins/platforms/qnx/qqnxscreen.cpp | 2 ++ src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 2 ++ src/plugins/platforms/qnx/qqnxwindow.cpp | 2 ++ 6 files changed, 18 insertions(+) diff --git a/src/plugins/platforms/qnx/CMakeLists.txt b/src/plugins/platforms/qnx/CMakeLists.txt index 3dfd0063820..7c8b8c33e01 100644 --- a/src/plugins/platforms/qnx/CMakeLists.txt +++ b/src/plugins/platforms/qnx/CMakeLists.txt @@ -31,6 +31,14 @@ qt_internal_add_plugin(QQnxIntegrationPlugin qqnxscreeneventthread.cpp qqnxscreeneventthread.h qqnxservices.cpp qqnxservices.h qqnxwindow.cpp qqnxwindow.h + NO_PCH_SOURCES + qqnxclipboard.cpp # undef QT_NO_FOREACH + qqnxintegration.cpp # undef QT_NO_FOREACH + qqnxscreen.cpp # undef QT_NO_FOREACH + qqnxscreeneventhandler.cpp # undef QT_NO_FOREACH + qqnxwindow.cpp # undef QT_NO_FOREACH + DEFINES + QT_NO_FOREACH LIBRARIES Qt::Core Qt::CorePrivate diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp index 80f9d73a3ba..8e42148c122 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.cpp +++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2011 - 2012 Research In Motion // 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 + #if !defined(QT_NO_CLIPBOARD) #include "qqnxclipboard.h" diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index ff6ce05aaa4..eddc5f4051d 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2013 BlackBerry Limited. All rights reserved. // 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 "qqnxglobal.h" #include "qqnxintegration.h" diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 66f8bfae010..9d689da991f 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. // 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 "qqnxglobal.h" #include "qqnxscreen.h" diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 525b22242c0..ea32a6fd095 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2013 BlackBerry Limited. All rights reserved. // 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 "qqnxglobal.h" #include "qqnxscreeneventhandler.h" diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 5310ff3c65d..eed45227f6f 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. // 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 "qqnxglobal.h" #include "qqnxwindow.h"