Mark QtWidgets 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 library 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). Created QTBUG-115803 to keep track of this. Task-number: QTBUG-115803 Change-Id: Ib5d6192632d98bdcc6625a9a14e05d13bb7f759b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>bb10
parent
8de746a96c
commit
c63c46037d
|
|
@ -53,6 +53,7 @@ qt_internal_add_module(Widgets
|
|||
DEFINES
|
||||
QT_NO_CONTEXTLESS_CONNECT
|
||||
QT_NO_USING_NAMESPACE
|
||||
QT_NO_FOREACH # mostly...
|
||||
INCLUDE_DIRECTORIES
|
||||
dialogs
|
||||
LIBRARIES
|
||||
|
|
@ -68,6 +69,8 @@ qt_internal_add_module(Widgets
|
|||
"kernel/qt_widgets_pch.h"
|
||||
NO_PCH_SOURCES
|
||||
compat/removed_api.cpp
|
||||
kernel/qgesturemanager.cpp # undef QT_NO_FOREACH
|
||||
kernel/qwidgetrepaintmanager.cpp # undef QT_NO_FOREACH
|
||||
GENERATE_CPP_EXPORTS
|
||||
)
|
||||
|
||||
|
|
@ -470,6 +473,8 @@ qt_internal_extend_target(Widgets CONDITION QT_FEATURE_mdiarea
|
|||
SOURCES
|
||||
widgets/qmdiarea.cpp widgets/qmdiarea.h widgets/qmdiarea_p.h
|
||||
widgets/qmdisubwindow.cpp widgets/qmdisubwindow.h widgets/qmdisubwindow_p.h
|
||||
NO_PCH_SOURCES
|
||||
widgets/qmdiarea.cpp # undef QT_NO_FOREACH
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Widgets CONDITION QT_FEATURE_menu
|
||||
|
|
@ -480,6 +485,8 @@ qt_internal_extend_target(Widgets CONDITION QT_FEATURE_menu
|
|||
qt_internal_extend_target(Widgets CONDITION QT_FEATURE_menubar
|
||||
SOURCES
|
||||
widgets/qmenubar.cpp widgets/qmenubar.h widgets/qmenubar_p.h
|
||||
NO_PCH_SOURCES
|
||||
widgets/qmenubar.cpp # undef QT_NO_FOREACH
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Widgets CONDITION QT_FEATURE_progressbar
|
||||
|
|
@ -726,6 +733,8 @@ qt_internal_extend_target(Widgets CONDITION QT_FEATURE_itemviews
|
|||
itemviews/qitemeditorfactory.cpp itemviews/qitemeditorfactory.h itemviews/qitemeditorfactory_p.h
|
||||
itemviews/qstyleditemdelegate.cpp itemviews/qstyleditemdelegate.h
|
||||
itemviews/qwidgetitemdata_p.h
|
||||
NO_PCH_SOURCES
|
||||
itemviews/qabstractitemview.cpp # undef QT_NO_FOREACH
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Widgets CONDITION QT_FEATURE_columnview
|
||||
|
|
@ -752,6 +761,8 @@ qt_internal_extend_target(Widgets CONDITION QT_FEATURE_listwidget
|
|||
qt_internal_extend_target(Widgets CONDITION QT_FEATURE_tableview
|
||||
SOURCES
|
||||
itemviews/qtableview.cpp itemviews/qtableview.h itemviews/qtableview_p.h
|
||||
NO_PCH_SOURCES
|
||||
itemviews/qtableview.cpp # undef QT_NO_FOREACH
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Widgets CONDITION QT_FEATURE_tablewidget
|
||||
|
|
@ -793,6 +804,8 @@ qt_internal_extend_target(Widgets CONDITION QT_FEATURE_graphicsview
|
|||
graphicsview/qgraphicsview.cpp graphicsview/qgraphicsview.h graphicsview/qgraphicsview_p.h
|
||||
graphicsview/qgraphicswidget.cpp graphicsview/qgraphicswidget.h graphicsview/qgraphicswidget_p.cpp graphicsview/qgraphicswidget_p.h
|
||||
graphicsview/qsimplex_p.cpp graphicsview/qsimplex_p.h
|
||||
NO_PCH_SOURCES
|
||||
graphicsview/qgraphicsanchorlayout_p.cpp # undef QT_NO_FOREACH
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Widgets CONDITION QT_FEATURE_easingcurve AND QT_FEATURE_graphicsview
|
||||
|
|
|
|||
|
|
@ -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 "qgraphicsanchorlayout_p.h"
|
||||
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
|
|
|||
|
|
@ -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 "qabstractitemview.h"
|
||||
|
||||
#include <qpointer.h>
|
||||
|
|
|
|||
|
|
@ -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 "qtableview.h"
|
||||
|
||||
#include <qheaderview.h>
|
||||
|
|
|
|||
|
|
@ -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 "private/qgesturemanager_p.h"
|
||||
#include "private/qstandardgestures_p.h"
|
||||
#include "private/qwidget_p.h"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// 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 "qplatformdefs.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
/*!
|
||||
\class QMdiArea
|
||||
\brief The QMdiArea widget provides an area in which MDI windows are displayed.
|
||||
|
|
|
|||
|
|
@ -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 <qmenubar.h>
|
||||
|
||||
#include <qstyle.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue