qmake/tools: port the last remaining Q_FOREACH loops and add QT_NO_FOREACH

Port the last four remaining Q_FOREACH users in qmake
and uic to C++11 range-for and mark all qtbase tools
(incl. qmake) as Q_FOREACH-free, using QT_NO_FOREACH.

Change-Id: Ief4e5877269e7a853e4cf05e58861a448e822d3d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
bb10
Marc Mutz 2016-05-11 11:53:02 +02:00
parent 81793b8b58
commit f0d7080e9e
13 changed files with 24 additions and 11 deletions

View File

@ -106,6 +106,7 @@ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DQT_NO_FOREACH \
-DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS
CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS)

View File

@ -49,6 +49,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DQT_NO_FOREACH \
-DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS
CFLAGS = $(CFLAGS_PCH) $(CFLAGS_BARE) $(CFLAGS)

View File

@ -1316,7 +1316,7 @@ void VcprojGenerator::initDeploymentTool()
if (foundGuid || dllName.contains(QLatin1String("Gui"))) {
QFileInfo info2;
foreach (const ProString &dllPath, dllPaths) {
for (const ProString &dllPath : dllPaths) {
QString absoluteDllFilePath = dllPath.toQString();
if (!absoluteDllFilePath.endsWith(QLatin1Char('/')))
absoluteDllFilePath += QLatin1Char('/');

View File

@ -7,6 +7,7 @@ CONFIG += console bootstrap
CONFIG -= qt
DEFINES += \
QT_BUILD_QMAKE \
QT_NO_FOREACH \
PROEVALUATOR_FULL
VPATH += \

View File

@ -5,6 +5,7 @@ TARGET = QtBootstrapDBus
CONFIG += minimal_syncqt internal_module force_bootstrap
DEFINES += \
QT_NO_FOREACH \
QT_NO_CAST_FROM_ASCII
MODULE_INCNAME = QtDBus

View File

@ -23,6 +23,7 @@ MODULE_DEFINES = \
DEFINES += \
$$MODULE_DEFINES \
QT_CRYPTOGRAPHICHASH_ONLY_SHA1 \
QT_NO_FOREACH \
QT_NO_CAST_FROM_ASCII
DEFINES -= QT_EVAL

View File

@ -1,7 +1,12 @@
option(host_build)
CONFIG += force_bootstrap
DEFINES += QT_MOC QT_NO_CAST_FROM_ASCII QT_NO_CAST_FROM_BYTEARRAY QT_NO_COMPRESS
DEFINES += \
QT_MOC \
QT_NO_CAST_FROM_ASCII \
QT_NO_CAST_FROM_BYTEARRAY \
QT_NO_COMPRESS \
QT_NO_FOREACH
include(moc.pri)
HEADERS += qdatetime_p.h

View File

@ -2,7 +2,7 @@ option(host_build)
QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
DEFINES += QT_NO_CAST_FROM_ASCII
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
include(../moc/moc.pri)

View File

@ -2,7 +2,7 @@ option(host_build)
QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
DEFINES += QT_NO_CAST_FROM_ASCII
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
SOURCES = qdbusxml2cpp.cpp

View File

@ -22,4 +22,7 @@ HEADERS += \
OTHER_FILES += \
lalr.g
DEFINES += \
QT_NO_FOREACH
load(qt_tool)

View File

@ -1,7 +1,7 @@
option(host_build)
CONFIG += force_bootstrap
DEFINES += QT_RCC QT_NO_CAST_FROM_ASCII
DEFINES += QT_RCC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
include(rcc.pri)
SOURCES += main.cpp

View File

@ -770,7 +770,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
//
// Special handling for qtableview/qtreeview fake header attributes
//
static QStringList realPropertyNames =
static const QStringList realPropertyNames =
(QStringList() << QLatin1String("visible")
<< QLatin1String("cascadingSectionResizes")
<< QLatin1String("defaultSectionSize")
@ -782,7 +782,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeView"))
|| m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeWidget"))) {
DomPropertyList headerProperties;
foreach (const QString &realPropertyName, realPropertyNames) {
for (const QString &realPropertyName : realPropertyNames) {
const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ realPropertyName.mid(1);
const QString fakePropertyName = QLatin1String("header") + upperPropertyName;
@ -797,13 +797,13 @@ void WriteInitialization::acceptWidget(DomWidget *node)
} else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableView"))
|| m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableWidget"))) {
static QStringList headerPrefixes =
static const QStringList headerPrefixes =
(QStringList() << QLatin1String("horizontalHeader")
<< QLatin1String("verticalHeader"));
foreach (const QString &headerPrefix, headerPrefixes) {
for (const QString &headerPrefix : headerPrefixes) {
DomPropertyList headerProperties;
foreach (const QString &realPropertyName, realPropertyNames) {
for (const QString &realPropertyName : realPropertyNames) {
const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ realPropertyName.mid(1);
const QString fakePropertyName = headerPrefix + upperPropertyName;

View File

@ -1,6 +1,6 @@
option(host_build)
DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII
DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
include(uic.pri)
include(cpp/cpp.pri)