summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/bootstrap/bootstrap.pro6
-rw-r--r--src/tools/moc/generator.cpp50
-rw-r--r--src/tools/moc/main.cpp2
-rw-r--r--src/tools/moc/moc.cpp29
-rw-r--r--src/tools/moc/mwerks_mac.cpp227
-rw-r--r--src/tools/moc/mwerks_mac.h54
-rw-r--r--src/tools/moc/preprocessor.cpp45
-rw-r--r--src/tools/moc/preprocessor.h1
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp19
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp4
-rw-r--r--src/tools/qfloat16-tables/gen_qfloat16_tables.cpp161
-rw-r--r--src/tools/qfloat16-tables/qfloat16-tables.pro9
-rw-r--r--src/tools/rcc/main.cpp15
-rw-r--r--src/tools/rcc/rcc.cpp5
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.cpp24
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.h4
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp29
-rw-r--r--src/tools/uic/main.cpp6
-rw-r--r--src/tools/uic/uic.pro2
19 files changed, 315 insertions, 377 deletions
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 2acc3fc77c..507b5260cd 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -28,6 +28,7 @@ SOURCES += \
../../corelib/global/qlogging.cpp \
../../corelib/global/qmalloc.cpp \
../../corelib/global/qnumeric.cpp \
+ ../../corelib/global/qoperatingsystemversion.cpp \
../../corelib/io/qabstractfileengine.cpp \
../../corelib/io/qbuffer.cpp \
../../corelib/io/qdatastream.cpp \
@@ -45,6 +46,7 @@ SOURCES += \
../../corelib/io/qresource.cpp \
../../corelib/io/qtemporaryfile.cpp \
../../corelib/io/qtextstream.cpp \
+ ../../corelib/io/qsavefile.cpp \
../../corelib/io/qstandardpaths.cpp \
../../corelib/io/qloggingcategory.cpp \
../../corelib/io/qloggingregistry.cpp \
@@ -95,7 +97,8 @@ unix:SOURCES += ../../corelib/io/qfilesystemengine_unix.cpp \
../../corelib/io/qfilesystemiterator_unix.cpp \
../../corelib/io/qfsfileengine_unix.cpp
-win32:SOURCES += ../../corelib/io/qfilesystemengine_win.cpp \
+win32:SOURCES += ../../corelib/global/qoperatingsystemversion_win.cpp \
+ ../../corelib/io/qfilesystemengine_win.cpp \
../../corelib/io/qfilesystemiterator_win.cpp \
../../corelib/io/qfsfileengine_win.cpp \
../../corelib/kernel/qcoreapplication_win.cpp \
@@ -106,6 +109,7 @@ mac {
../../corelib/kernel/qcoreapplication_mac.cpp \
../../corelib/kernel/qcore_mac.cpp
OBJECTIVE_SOURCES += \
+ ../../corelib/global/qoperatingsystemversion_darwin.mm \
../../corelib/kernel/qcore_mac_objc.mm \
../../corelib/kernel/qcore_foundation.mm
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index ccc6d795d7..c4184929ef 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -515,7 +515,7 @@ void Generator::generateCode()
for (int i = 0; i < extraList.count(); ++i) {
fprintf(out, " &%s::staticMetaObject,\n", extraList.at(i).constData());
}
- fprintf(out, " Q_NULLPTR\n};\n\n");
+ fprintf(out, " nullptr\n};\n\n");
}
//
@@ -527,24 +527,24 @@ void Generator::generateCode()
fprintf(out, "const QMetaObject %s::staticMetaObject = {\n", cdef->qualified.constData());
if (isQObject)
- fprintf(out, " { Q_NULLPTR, ");
+ fprintf(out, " { nullptr, ");
else if (cdef->superclassList.size() && (!cdef->hasQGadget || knownGadgets.contains(purestSuperClass)))
fprintf(out, " { &%s::staticMetaObject, ", purestSuperClass.constData());
else
- fprintf(out, " { Q_NULLPTR, ");
+ fprintf(out, " { nullptr, ");
fprintf(out, "qt_meta_stringdata_%s.data,\n"
" qt_meta_data_%s, ", qualifiedClassNameIdentifier.constData(),
qualifiedClassNameIdentifier.constData());
if (hasStaticMetaCall)
fprintf(out, " qt_static_metacall, ");
else
- fprintf(out, " Q_NULLPTR, ");
+ fprintf(out, " nullptr, ");
if (extraList.isEmpty())
- fprintf(out, "Q_NULLPTR, ");
+ fprintf(out, "nullptr, ");
else
fprintf(out, "qt_meta_extradata_%s, ", qualifiedClassNameIdentifier.constData());
- fprintf(out, "Q_NULLPTR}\n};\n\n");
+ fprintf(out, "nullptr}\n};\n\n");
if(isQt)
return;
@@ -559,7 +559,7 @@ void Generator::generateCode()
// Generate smart cast function
//
fprintf(out, "\nvoid *%s::qt_metacast(const char *_clname)\n{\n", cdef->qualified.constData());
- fprintf(out, " if (!_clname) return Q_NULLPTR;\n");
+ fprintf(out, " if (!_clname) return nullptr;\n");
fprintf(out, " if (!strcmp(_clname, qt_meta_stringdata_%s.stringdata0))\n"
" return static_cast<void*>(const_cast< %s*>(this));\n",
qualifiedClassNameIdentifier.constData(), cdef->classname.constData());
@@ -584,7 +584,7 @@ void Generator::generateCode()
QByteArray superClass = purestSuperClass;
fprintf(out, " return %s::qt_metacast(_clname);\n", superClass.constData());
} else {
- fprintf(out, " return Q_NULLPTR;\n");
+ fprintf(out, " return nullptr;\n");
}
fprintf(out, "}\n");
@@ -918,8 +918,6 @@ void Generator::generateMetacall()
fprintf(out, " _id = %s::qt_metacall(_c, _id, _a);\n", superClass.constData());
}
- fprintf(out, " if (_id < 0)\n return _id;\n");
- fprintf(out, " ");
bool needElse = false;
QVector<FunctionDef> methodList;
@@ -927,6 +925,15 @@ void Generator::generateMetacall()
methodList += cdef->slotList;
methodList += cdef->methodList;
+ // If there are no methods or properties, we will return _id anyway, so
+ // don't emit this comparison -- it is unnecessary, and it makes coverity
+ // unhappy.
+ if (methodList.size() || cdef->propertyList.size()) {
+ fprintf(out, " if (_id < 0)\n return _id;\n");
+ }
+
+ fprintf(out, " ");
+
if (methodList.size()) {
needElse = true;
fprintf(out, "if (_c == QMetaObject::InvokeMetaMethod) {\n");
@@ -1067,7 +1074,7 @@ void Generator::generateMetacall()
fprintf(out, "\n#endif // QT_NO_PROPERTIES");
}
- if (methodList.size() || cdef->signalList.size() || cdef->propertyList.size())
+ if (methodList.size() || cdef->propertyList.size())
fprintf(out, "\n ");
fprintf(out,"return _id;\n}\n");
}
@@ -1186,7 +1193,7 @@ void Generator::generateStaticMetacall()
}
fprintf(out, ");");
if (f.normalizedType != "void") {
- fprintf(out, "\n if (_a[0]) *reinterpret_cast< %s*>(_a[0]) = _r; } ",
+ fprintf(out, "\n if (_a[0]) *reinterpret_cast< %s*>(_a[0]) = std::move(_r); } ",
noRef(f.normalizedType).constData());
isUsed_a = true;
}
@@ -1476,12 +1483,9 @@ void Generator::generateSignal(FunctionDef *def,int index)
}
Q_ASSERT(!def->normalizedType.isEmpty());
- if (def->arguments.isEmpty() && def->normalizedType == "void") {
- if (def->isPrivateSignal)
- fprintf(out, "QPrivateSignal");
-
+ if (def->arguments.isEmpty() && def->normalizedType == "void" && !def->isPrivateSignal) {
fprintf(out, ")%s\n{\n"
- " QMetaObject::activate(%s, &staticMetaObject, %d, Q_NULLPTR);\n"
+ " QMetaObject::activate(%s, &staticMetaObject, %d, nullptr);\n"
"}\n", constQualifier, thisPtr.constData(), index);
return;
}
@@ -1496,22 +1500,18 @@ void Generator::generateSignal(FunctionDef *def,int index)
if (def->isPrivateSignal) {
if (!def->arguments.isEmpty())
fprintf(out, ", ");
- fprintf(out, "QPrivateSignal");
+ fprintf(out, "QPrivateSignal _t%d", offset++);
}
fprintf(out, ")%s\n{\n", constQualifier);
if (def->type.name.size() && def->normalizedType != "void") {
QByteArray returnType = noRef(def->normalizedType);
- if (returnType.endsWith('*')) {
- fprintf(out, " %s _t0 = 0;\n", returnType.constData());
- } else {
- fprintf(out, " %s _t0 = %s();\n", returnType.constData(), returnType.constData());
- }
+ fprintf(out, " %s _t0{};\n", returnType.constData());
}
fprintf(out, " void *_a[] = { ");
if (def->normalizedType == "void") {
- fprintf(out, "Q_NULLPTR");
+ fprintf(out, "nullptr");
} else {
if (def->returnTypeIsVolatile)
fprintf(out, "const_cast<void*>(reinterpret_cast<const volatile void*>(&_t0))");
@@ -1520,7 +1520,7 @@ void Generator::generateSignal(FunctionDef *def,int index)
}
int i;
for (i = 1; i < offset; ++i)
- if (def->arguments.at(i - 1).type.isVolatile)
+ if (i <= def->arguments.count() && def->arguments.at(i - 1).type.isVolatile)
fprintf(out, ", const_cast<void*>(reinterpret_cast<const volatile void*>(&_t%d))", i);
else
fprintf(out, ", const_cast<void*>(reinterpret_cast<const void*>(&_t%d))", i);
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 6128d5490b..b30de66258 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -305,7 +305,7 @@ int runMoc(int argc, char **argv)
const QStringList files = parser.positionalArguments();
if (files.count() > 1) {
- error(qPrintable(QStringLiteral("Too many input files specified: '") + files.join(QStringLiteral("' '")) + QLatin1Char('\'')));
+ error(qPrintable(QLatin1String("Too many input files specified: '") + files.join(QLatin1String("' '")) + QLatin1Char('\'')));
parser.showHelp(1);
} else if (!files.isEmpty()) {
filename = files.first();
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 03f022da69..36d84a61d8 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -549,12 +549,20 @@ void Moc::parse()
case NAMESPACE: {
int rewind = index;
if (test(IDENTIFIER)) {
+ QByteArray nsName = lexem();
+ QByteArrayList nested;
+ while (test(SCOPE)) {
+ next(IDENTIFIER);
+ nested.append(nsName);
+ nsName = lexem();
+ }
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
} else if (!test(SEMIC)) {
NamespaceDef def;
- def.classname = lexem();
+ def.classname = nsName;
+
next(LBRACE);
def.begin = index - 1;
until(RBRACE);
@@ -568,11 +576,23 @@ void Moc::parse()
def.qualified.prepend(namespaceList.at(i).classname + "::");
}
}
+ for (const QByteArray &ns : nested) {
+ NamespaceDef parentNs;
+ parentNs.classname = ns;
+ parentNs.qualified = def.qualified;
+ def.qualified += ns + "::";
+ parentNs.begin = def.begin;
+ parentNs.end = def.end;
+ namespaceList += parentNs;
+ }
}
+
while (parseNamespace && inNamespace(&def) && hasNext()) {
switch (next()) {
case NAMESPACE:
if (test(IDENTIFIER)) {
+ while (test(SCOPE))
+ next(IDENTIFIER);
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
@@ -1294,7 +1314,12 @@ void Moc::parsePluginData(ClassDef *def)
return;
}
QFile file(fi.canonicalFilePath());
- file.open(QFile::ReadOnly);
+ if (!file.open(QFile::ReadOnly)) {
+ QByteArray msg = "Plugin Metadata file " + lexem() + " could not be opened: "
+ + file.errorString().toUtf8();
+ error(msg.constData());
+ return;
+ }
metaData = file.readAll();
}
}
diff --git a/src/tools/moc/mwerks_mac.cpp b/src/tools/moc/mwerks_mac.cpp
deleted file mode 100644
index fe8bf680fb..0000000000
--- a/src/tools/moc/mwerks_mac.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifdef MOC_MWERKS_PLUGIN
-
-#include "mwerks_mac.h"
-#include "qt_mac.h"
-
-/* compiler headers */
-#include "DropInCompilerLinker.h"
-#include "CompilerMapping.h"
-#include "CWPluginErrors.h"
-
-/* standard headers */
-#include <stdio.h>
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-//qglobal.cpp
-const unsigned char * p_str(const char * c);
-QCString pstring2qstring(const unsigned char *c);
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export on
-#endif
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
-{
- static const DropInFlags sFlags = {
- kCurrentDropInFlagsVersion,
- CWDROPINCOMPILERTYPE,
- DROPINCOMPILERLINKERAPIVERSION_7,
- kCompAlwaysReload|kCompRequiresProjectBuildStartedMsg,
- Lang_C_CPP,
- DROPINCOMPILERLINKERAPIVERSION
- };
- *flags = &sFlags;
- *flagsSize = sizeof(sFlags);
- return cwNoErr;
-}
-
-
-
-CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
-{
- static const char sDropInName[] = "McMoc";
- *dropinName = sDropInName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
-{
- static const char sDisplayName[] = "McMoc";
- *displayName = sDisplayName;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
-{
- static CWDataType sCPU = targetCPUAny;
- static CWDataType sOS = targetOSMacintosh;
- static CWTargetList sTargetList = {kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS};
- *targetList = &sTargetList;
- return cwNoErr;
-}
-
-CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
-{
- static CWExtensionMapping sExtension[] = { {'TEXT', ".mocs", kPrecompile } };
- static CWExtMapList sExtensionMapList = {kCurrentCWExtMapListVersion, 3, sExtension};
- *defaultMappingList = &sExtensionMapList;
- return cwNoErr;
-}
-
-#if CW_USE_PRAGMA_EXPORT
-#pragma export off
-#endif
-typedef short CWFileRef;
-
-static int line_count = 0;
-moc_status do_moc(CWPluginContext, const QCString &, const QCString &, CWFileSpec *, bool);
-
-static CWResult mocify(CWPluginContext context, const QCString &source)
-{
- CWDisplayLines(context, line_count++);
-
- source.stripWhiteSpace();
-
- CWResult err;
- bool dotmoc=false;
- QCString stem = source, ext;
- int dotpos = stem.findRev('.');
- if(dotpos != -1) {
- ext = stem.right(stem.length() - (dotpos+1));
- stem = stem.left(dotpos);
- if(ext == "cpp")
- dotmoc = true;
- } else {
- //whoa!
- }
- QCString dest;
- if(dotmoc)
- dest = stem + ".moc";
- else
- dest = "moc_" + stem + ".cpp";
-
- //moc it
- CWFileSpec destSpec;
- moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc);
-
-#if 0
- QCString derr = "Weird";
- switch(mocd) {
- case moc_success: derr = "Success"; break;
- case moc_parse_error: derr = "Parser Error"; break;
- case moc_no_qobject:derr = "No QOBJECT"; break;
- case moc_not_time: derr = "Not Time"; break;
- case moc_no_source: derr = "No Source"; break;
- case moc_general_error: derr = "General Error"; break;
- }
- char dmsg[200];
- sprintf(dmsg, "\"%s\" %s", source.data(), derr.data());
- CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0);
-#endif
-
- //handle project
- if(mocd == moc_no_qobject) {
- char msg[400];
- sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- } else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc)
- {
- long whichFile;
- CWNewProjectEntryInfo ei;
- memset(&ei, '\0', sizeof(ei));
- ei.groupPath = "QtGenerated";
- err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile);
- if (!CWSUCCESS(err))
- {
- char msg[200];
- sprintf(msg, "\"%s\" not added", dest.data());
- CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
- }
- if(mocd == moc_success)
- CWSetModDate(context, &destSpec, NULL, true);
- }
- return cwNoErr;
-}
-
-pascal short main(CWPluginContext context)
-{
- short result;
- long request;
-
- if (CWGetPluginRequest(context, &request) != cwNoErr)
- return cwErrRequestFailed;
- result = cwErrInvalidParameter;
-
- /* dispatch on compiler request */
- switch (request)
- {
- case reqInitCompiler:
- case reqTermCompiler:
- result = cwNoErr;
- break;
-
- case reqCompile:
- {
- line_count = 0;
- const char *files = NULL;
- long filelen;
- CWGetMainFileText(context, &files, &filelen);
- const char *beg = files;
- for(int x = 0; x < filelen; x++) {
- if(*(files++) == '\r') {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)-1] = '\0';
- mocify(context, file);
- beg = files;
- }
- }
- if(beg != files) {
- char file[1024];
- memcpy(file, beg, files - beg);
- file[(files-beg)] = '\0';
- mocify(context, file);
- }
-
- result = cwNoErr;
- break;
- }
- }
-
- /* return result code */
- return result;
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/tools/moc/mwerks_mac.h b/src/tools/moc/mwerks_mac.h
deleted file mode 100644
index 9f6f074036..0000000000
--- a/src/tools/moc/mwerks_mac.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MWERKS_MAC_H
-#define MWERKS_MAC_H
-
-#include <qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_OS_MAC
-
-#define macintosh
-
-/*make moc a plugin*/
-enum moc_status {
- moc_success = 1,
- moc_parse_error = 2,
- moc_no_qobject = 3,
- moc_not_time = 4,
- moc_no_source = 5,
- moc_general_error = 6
-};
-
-#endif
-
-QT_END_NAMESPACE
-
-#endif // MWERKS_MAC_H
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 11bf8d7937..32c94639ab 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -236,7 +236,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
data -= 2;
break;
case DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = INTEGER_LITERAL;
@@ -244,7 +244,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -253,13 +253,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
@@ -413,7 +413,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
token = PP_CHARACTER_LITERAL;
break;
case PP_DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = PP_INTEGER_LITERAL;
@@ -421,7 +421,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -430,13 +430,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case PP_FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
@@ -1005,22 +1005,20 @@ static void mergeStringLiterals(Symbols *_symbols)
}
}
-QByteArray Preprocessor::resolveInclude(const QByteArray &include, const QByteArray &relativeTo)
+static QByteArray searchIncludePaths(const QList<Parser::IncludePath> &includepaths,
+ const QByteArray &include)
{
- // #### stringery
QFileInfo fi;
- if (!relativeTo.isEmpty())
- fi.setFile(QFileInfo(QString::fromLocal8Bit(relativeTo.constData())).dir(), QString::fromLocal8Bit(include.constData()));
- for (int j = 0; j < Preprocessor::includes.size() && !fi.exists(); ++j) {
- const IncludePath &p = Preprocessor::includes.at(j);
+ for (int j = 0; j < includepaths.size() && !fi.exists(); ++j) {
+ const Parser::IncludePath &p = includepaths.at(j);
if (p.isFrameworkPath) {
const int slashPos = include.indexOf('/');
if (slashPos == -1)
continue;
fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"),
- QString::fromLocal8Bit(include.mid(slashPos + 1).constData()));
+ QString::fromLocal8Bit(include.mid(slashPos + 1)));
} else {
- fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData()));
+ fi.setFile(QString::fromLocal8Bit(p.path), QString::fromLocal8Bit(include));
}
// try again, maybe there's a file later in the include paths with the same name
// (186067)
@@ -1035,6 +1033,21 @@ QByteArray Preprocessor::resolveInclude(const QByteArray &include, const QByteAr
return fi.canonicalFilePath().toLocal8Bit();
}
+QByteArray Preprocessor::resolveInclude(const QByteArray &include, const QByteArray &relativeTo)
+{
+ if (!relativeTo.isEmpty()) {
+ QFileInfo fi;
+ fi.setFile(QFileInfo(QString::fromLocal8Bit(relativeTo)).dir(), QString::fromLocal8Bit(include));
+ if (fi.exists() && !fi.isDir())
+ return fi.canonicalFilePath().toLocal8Bit();
+ }
+
+ auto it = nonlocalIncludePathResolutionCache.find(include);
+ if (it == nonlocalIncludePathResolutionCache.end())
+ it = nonlocalIncludePathResolutionCache.insert(include, searchIncludePaths(includes, include));
+ return it.value();
+}
+
void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
{
currentFilenames.push(filename);
diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h
index a7eb1a19e1..39f56d6e92 100644
--- a/src/tools/moc/preprocessor.h
+++ b/src/tools/moc/preprocessor.h
@@ -61,6 +61,7 @@ public:
static bool preprocessOnly;
QList<QByteArray> frameworks;
QSet<QByteArray> preprocessedIncludes;
+ QHash<QByteArray, QByteArray> nonlocalIncludePathResolutionCache;
Macros macros;
QByteArray resolveInclude(const QByteArray &filename, const QByteArray &relativeTo);
Symbols preprocessed(const QByteArray &filename, QFile *device);
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
index 26e7b086d9..7ddd0fcf5d 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
@@ -103,9 +103,8 @@ static inline QString typeNameToXml(const char *typeName)
static QString addFunction(const FunctionDef &mm, bool isSignal = false) {
- QString xml = QString::fromLatin1(" <%1 name=\"%2\">\n")
- .arg(isSignal ? QLatin1String("signal") : QLatin1String("method"))
- .arg(QLatin1String(mm.name));
+ QString xml = QString::asprintf(" <%s name=\"%s\">\n",
+ isSignal ? "signal" : "method", mm.name.constData());
// check the return type first
int typeId = QMetaType::type(mm.normalizedType.constData());
@@ -156,9 +155,9 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) {
const char *signature = QDBusMetaType::typeToSignature(types.at(j));
xml += QString::fromLatin1(" <arg %1type=\"%2\" direction=\"%3\"/>\n")
- .arg(name)
- .arg(QLatin1String(signature))
- .arg(isOutput ? QLatin1String("out") : QLatin1String("in"));
+ .arg(name,
+ QLatin1String(signature),
+ isOutput ? QLatin1String("out") : QLatin1String("in"));
// do we need to describe this argument?
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
@@ -220,9 +219,9 @@ static QString generateInterfaceXml(const ClassDef *mo)
continue;
retval += QString::fromLatin1(" <property name=\"%1\" type=\"%2\" access=\"%3\"")
- .arg(QLatin1String(mp.name))
- .arg(QLatin1String(signature))
- .arg(QLatin1String(accessvalues[access]));
+ .arg(QLatin1String(mp.name),
+ QLatin1String(signature),
+ QLatin1String(accessvalues[access]));
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
retval += QString::fromLatin1(">\n <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"%3\"/>\n </property>\n")
@@ -448,7 +447,7 @@ int main(int argc, char **argv)
output.write("<node>\n");
for (const ClassDef &cdef : qAsConst(classes)) {
QString xml = qDBusGenerateClassDefXml(&cdef);
- output.write(xml.toLocal8Bit());
+ output.write(std::move(xml).toLocal8Bit());
}
output.write("</node>\n");
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index cdf3ad3310..9ccf8be73a 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -217,7 +217,7 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
annotationName += QString::fromLatin1(".%1%2").arg(QLatin1String(direction)).arg(paramId);
QString qttype = annotations.value(annotationName);
if (!qttype.isEmpty())
- return qttype.toLatin1();
+ return std::move(qttype).toLatin1();
QString oldAnnotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName");
if (paramId >= 0)
@@ -242,7 +242,7 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
"suggest updating to '%s'\n",
PROGRAMNAME, qPrintable(oldAnnotationName), qPrintable(inputFile),
qPrintable(annotationName));
- return qttype.toLatin1();
+ return std::move(qttype).toLatin1();
}
return QVariant::typeToName(QVariant::Type(type));
diff --git a/src/tools/qfloat16-tables/gen_qfloat16_tables.cpp b/src/tools/qfloat16-tables/gen_qfloat16_tables.cpp
new file mode 100644
index 0000000000..f5051e25fc
--- /dev/null
+++ b/src/tools/qfloat16-tables/gen_qfloat16_tables.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 by Southwest Research Institute (R)
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qfile.h>
+#include <qdebug.h>
+
+quint32 convertmantissa(qint32 i)
+{
+ quint32 m = i << 13; // Zero pad mantissa bits
+ quint32 e = 0; // Zero exponent
+
+ while (!(m & 0x00800000)) { // While not normalized
+ e -= 0x00800000; // Decrement exponent (1<<23)
+ m <<= 1; // Shift mantissa
+ }
+ m &= ~0x00800000; // Clear leading 1 bit
+ e += 0x38800000; // Adjust bias ((127-14)<<23)
+ return m | e; // Return combined number
+}
+
+// we first build these tables up and then print them out as a separate step in order
+// to more closely map the implementation given in the paper.
+quint32 basetable[512];
+quint32 shifttable[512];
+
+#define PRINTHEX(a) "0x" + QByteArray::number(a,16).toUpper() + "U,\n"
+
+qint32 main(qint32 argc, char **argv)
+{
+ if (argc < 2) {
+ qWarning() << "Must provide output filename as argument.";
+ return -1;
+ }
+
+ QFile fid(argv[1]);
+ if (!fid.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ qWarning() << "Abort: Failed to open/create file" << fid.fileName();
+ return -1;
+ }
+ quint32 i;
+
+ fid.write("/* This file was generated by gen_qfloat16_tables.cpp */\n\n");
+ fid.write("#include <QtCore/qfloat16.h>\n\n");
+
+ fid.write("QT_BEGIN_NAMESPACE\n\n");
+
+ fid.write("const quint32 qfloat16::mantissatable[2048] = {\n");
+ fid.write("0,\n");
+ for (i = 1; i < 1024; i++)
+ fid.write(PRINTHEX(convertmantissa(i)));
+ for (i = 1024; i < 2048; i++)
+ fid.write(PRINTHEX(0x38000000U + ((i - 1024) << 13)));
+ fid.write("};\n\n");
+
+ fid.write("const quint32 qfloat16::exponenttable[64] = {\n");
+ fid.write("0,\n");
+ for (i = 1; i < 31; i++)
+ fid.write(PRINTHEX(i << 23));
+ fid.write("0x47800000U,\n"); // 31
+ fid.write("0x80000000U,\n"); // 32
+ for (i = 33; i < 63; i++)
+ fid.write(PRINTHEX(0x80000000U + ((i - 32) << 23)));
+ fid.write("0xC7800000U,\n"); // 63
+ fid.write("};\n\n");
+
+ fid.write("const quint32 qfloat16::offsettable[64] = {\n");
+ fid.write("0,\n");
+ for (i = 1; i < 32; i++)
+ fid.write("1024U,\n");
+ fid.write("0,\n");
+ for (i = 33; i < 64; i++)
+ fid.write("1024U,\n");
+ fid.write("};\n\n");
+
+ qint32 e;
+ for (i = 0; i < 256; ++i) {
+ e = i - 127;
+ if (e < -24) { // Very small numbers map to zero
+ basetable[i | 0x000] = 0x0000;
+ basetable[i | 0x100] = 0x8000;
+ shifttable[i | 0x000] = 24;
+ shifttable[i | 0x100] = 24;
+
+ } else if (e < -14) { // Small numbers map to denorms
+ basetable[i | 0x000] = (0x0400 >> (-e - 14));
+ basetable[i | 0x100] = (0x0400 >> (-e - 14)) | 0x8000;
+ shifttable[i | 0x000] = -e - 1;
+ shifttable[i | 0x100] = -e - 1;
+
+ } else if (e <= 15) { // Normal numbers just lose precision
+ basetable[i | 0x000] = ((e + 15) << 10);
+ basetable[i | 0x100] = ((e + 15) << 10) | 0x8000;
+ shifttable[i | 0x000] = 13;
+ shifttable[i | 0x100] = 13;
+
+ } else if (e < 128) { // Large numbers map to Infinity
+ basetable[i | 0x000] = 0x7C00;
+ basetable[i | 0x100] = 0xFC00;
+ shifttable[i | 0x000] = 24;
+ shifttable[i | 0x100] = 24;
+
+ } else { // Infinity and NaN's stay Infinity and NaN's
+ basetable[i | 0x000] = 0x7C00;
+ basetable[i | 0x100] = 0xFC00;
+ shifttable[i | 0x000] = 13;
+ shifttable[i | 0x100] = 13;
+ }
+ }
+
+ fid.write("const quint32 qfloat16::basetable[512] = {\n");
+ for (i = 0; i < 512; i++)
+ fid.write(PRINTHEX(basetable[i]));
+
+ fid.write("};\n\n");
+
+ fid.write("const quint32 qfloat16::shifttable[512] = {\n");
+ for (i = 0; i < 512; i++)
+ fid.write(PRINTHEX(shifttable[i]));
+
+ fid.write("};\n\n");
+
+ fid.write("QT_END_NAMESPACE\n");
+ fid.close();
+ return 0;
+}
diff --git a/src/tools/qfloat16-tables/qfloat16-tables.pro b/src/tools/qfloat16-tables/qfloat16-tables.pro
new file mode 100644
index 0000000000..a7d10ac197
--- /dev/null
+++ b/src/tools/qfloat16-tables/qfloat16-tables.pro
@@ -0,0 +1,9 @@
+option(host_build)
+
+CONFIG += force_bootstrap
+SOURCES += gen_qfloat16_tables.cpp
+
+load(qt_tool)
+
+lib.CONFIG = dummy_install
+INSTALLS = lib
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index d09d36c659..fba47b74c3 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -32,6 +32,7 @@
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
+#include <qhashfunctions.h>
#include <qtextstream.h>
#include <qatomic.h>
#include <qglobal.h>
@@ -276,7 +277,8 @@ int runRcc(int argc, char *argv[])
} else {
out.setFileName(outFilename);
if (!out.open(mode)) {
- const QString msg = QString::fromLatin1("Unable to open %1 for writing: %2\n").arg(outFilename).arg(out.errorString());
+ const QString msg = QString::fromLatin1("Unable to open %1 for writing: %2\n")
+ .arg(outFilename, out.errorString());
errorDevice.write(msg.toUtf8());
return 1;
}
@@ -297,7 +299,7 @@ int runRcc(int argc, char *argv[])
temp.setFileName(tempFilename);
if (!temp.open(QIODevice::ReadOnly)) {
const QString msg = QString::fromUtf8("Unable to open temporary file %1 for reading: %2\n")
- .arg(outFilename).arg(out.errorString());
+ .arg(outFilename, out.errorString());
errorDevice.write(msg.toUtf8());
return 1;
}
@@ -311,16 +313,17 @@ int runRcc(int argc, char *argv[])
return 0;
}
-Q_CORE_EXPORT extern QBasicAtomicInt qt_qhash_seed; // from qhash.cpp
-
QT_END_NAMESPACE
int main(int argc, char *argv[])
{
// rcc uses a QHash to store files in the resource system.
// we must force a certain hash order when testing or tst_rcc will fail, see QTBUG-25078
- if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_RCC_TEST") && !qt_qhash_seed.testAndSetRelaxed(-1, 0)))
- qFatal("Cannot force QHash seed for testing as requested");
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_RCC_TEST"))) {
+ qSetGlobalQHashSeed(0);
+ if (qGlobalQHashSeed() != 0)
+ qFatal("Cannot force QHash seed for testing as requested");
+ }
return QT_PREPEND_NAMESPACE(runRcc)(argc, argv);
}
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 26dacc48ec..84fe6ef5c7 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -73,7 +73,7 @@ void RCCResourceLibrary::writeByteArray(const QByteArray &other)
static inline QString msgOpenReadFailed(const QString &fname, const QString &why)
{
- return QString::fromLatin1("Unable to open %1 for reading: %2\n").arg(fname).arg(why);
+ return QString::fromLatin1("Unable to open %1 for reading: %2\n").arg(fname, why);
}
@@ -502,7 +502,8 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
QFileInfo file(absFileName);
if (!file.exists()) {
m_failedResources.push_back(absFileName);
- const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n").arg(fname).arg(fileName);
+ const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n")
+ .arg(fname, fileName);
m_errorDevice->write(msg.toUtf8());
if (ignoreErrors)
continue;
diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp
index a99d6adf07..dcbe400224 100644
--- a/src/tools/uic/cpp/cppwriteincludes.cpp
+++ b/src/tools/uic/cpp/cppwriteincludes.cpp
@@ -114,8 +114,9 @@ void WriteIncludes::acceptUI(DomUI *node)
TreeWalker::acceptUI(node);
- if (!m_uic->option().includeFile.isEmpty())
- m_globalIncludes.insert(m_uic->option().includeFile, true);
+ const auto includeFile = m_uic->option().includeFile;
+ if (!includeFile.isEmpty())
+ m_globalIncludes.insert(includeFile);
writeHeaders(m_globalIncludes, true);
writeHeaders(m_localIncludes, false);
@@ -272,10 +273,11 @@ void WriteIncludes::insertInclude(const QString &header, bool global)
fprintf(stderr, "%s %s %d\n", Q_FUNC_INFO, qPrintable(header), global);
OrderedSet &includes = global ? m_globalIncludes : m_localIncludes;
- if (includes.contains(header))
+ // Insert (if not already done).
+ const bool isNewHeader = includes.insert(header).second;
+ if (!isNewHeader)
return;
- // Insert. Also remember base name for quick check of suspicious custom plugins
- includes.insert(header, false);
+ // Also remember base name for quick check of suspicious custom plugins
const QString lowerBaseName = QFileInfo(header).completeBaseName ().toLower();
m_includeBaseNames.insert(lowerBaseName);
}
@@ -286,13 +288,11 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global)
const QChar closingQuote = global ? QLatin1Char('>') : QLatin1Char('"');
// Check for the old headers 'qslider.h' and replace by 'QtGui/QSlider'
- const OrderedSet::const_iterator cend = headers.constEnd();
- for (OrderedSet::const_iterator sit = headers.constBegin(); sit != cend; ++sit) {
- const StringMap::const_iterator hit = m_oldHeaderToNewHeader.constFind(sit.key());
- const bool mapped = hit != m_oldHeaderToNewHeader.constEnd();
- const QString header = mapped ? hit.value() : sit.key();
- if (!QStringRef(&header).trimmed().isEmpty())
- m_output << "#include " << openingQuote << header << closingQuote << QLatin1Char('\n');
+ for (const QString &header : headers) {
+ const QString value = m_oldHeaderToNewHeader.value(header, header);
+ const auto trimmed = QStringRef(&value).trimmed();
+ if (!trimmed.isEmpty())
+ m_output << "#include " << openingQuote << trimmed << closingQuote << QLatin1Char('\n');
}
}
diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h
index 397c6a26e1..7a6a499536 100644
--- a/src/tools/uic/cpp/cppwriteincludes.h
+++ b/src/tools/uic/cpp/cppwriteincludes.h
@@ -35,6 +35,8 @@
#include <qset.h>
#include <qstring.h>
+#include <set>
+
QT_BEGIN_NAMESPACE
class QTextStream;
@@ -72,7 +74,7 @@ private:
void add(const QString &className, bool determineHeader = true, const QString &header = QString(), bool global = false);
private:
- typedef QMap<QString, bool> OrderedSet;
+ typedef std::set<QString> OrderedSet;
void insertIncludeForClass(const QString &className, QString header = QString(), bool global = false);
void insertInclude(const QString &header, bool global);
void writeHeaders(const OrderedSet &headers, bool global);
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 2fc6f20782..bbef010a9c 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -48,10 +48,11 @@ namespace {
// Fixup an enumeration name from class Qt.
// They are currently stored as "BottomToolBarArea" instead of "Qt::BottomToolBarArea".
// due to MO issues. This might be fixed in the future.
- void fixQtEnumerationName(QString& name) {
+ QLatin1String qtEnumerationPrefix(const QString &name) {
static const QLatin1String prefix("Qt::");
if (name.indexOf(prefix) != 0)
- name.prepend(prefix);
+ return prefix;
+ return QLatin1String();
}
// figure out the toolbar area of a DOM attrib list.
// By legacy, it is stored as an integer. As of 4.3.0, it is the enumeration value.
@@ -62,16 +63,12 @@ namespace {
switch (pstyle->kind()) {
case DomProperty::Number: {
- QString area = QLatin1String("static_cast<Qt::ToolBarArea>(");
- area += QString::number(pstyle->elementNumber());
- area += QLatin1String("), ");
- return area;
+ return QLatin1String("static_cast<Qt::ToolBarArea>(")
+ + QString::number(pstyle->elementNumber()) + QLatin1String("), ");
}
case DomProperty::Enum: {
- QString area = pstyle->elementEnum();
- fixQtEnumerationName(area);
- area += QLatin1String(", ");
- return area;
+ const QString area = pstyle->elementEnum();
+ return qtEnumerationPrefix(area) + area + QLatin1String(", ");
}
default:
break;
@@ -152,7 +149,8 @@ namespace {
if (const DomResourceIcon *dri = p->elementIconSet()) {
if (!isIconFormat44(dri)) {
if (dri->text().isEmpty()) {
- const QString msg = QString::fromUtf8("%1: Warning: An invalid icon property '%2' was encountered.").arg(fileName).arg(p->attributeName());
+ const QString msg = QString::fromLatin1("%1: Warning: An invalid icon property '%2' was encountered.")
+ .arg(fileName, p->attributeName());
qWarning("%s", qPrintable(msg));
return false;
}
@@ -162,7 +160,8 @@ namespace {
case DomProperty::Pixmap:
if (const DomResourcePixmap *drp = p->elementPixmap())
if (drp->text().isEmpty()) {
- const QString msg = QString::fromUtf8("%1: Warning: An invalid pixmap property '%2' was encountered.").arg(fileName).arg(p->attributeName());
+ const QString msg = QString::fromUtf8("%1: Warning: An invalid pixmap property '%2' was encountered.")
+ .arg(fileName, p->attributeName());
qWarning("%s", qPrintable(msg));
return false;
}
@@ -1029,7 +1028,7 @@ void WriteInitialization::acceptLayoutItem(DomLayoutItem *node)
const int row = node->attributeRow();
const int colSpan = node->hasAttributeColSpan() ? node->attributeColSpan() : 1;
const QString role = formLayoutRole(node->attributeColumn(), colSpan);
- addArgs = QString::fromLatin1("%1, %2, %3").arg(row).arg(role).arg(itemName);
+ addArgs = QString::fromLatin1("%1, %2, %3").arg(row).arg(role, itemName);
} else {
addArgs = itemName;
if (layout->attributeClass().contains(QLatin1String("Box")) && !node->attributeAlignment().isEmpty())
@@ -1365,7 +1364,7 @@ void WriteInitialization::writeProperties(const QString &varName,
case DomProperty::Locale: {
const DomLocale *locale = p->elementLocale();
propertyValue = QString::fromLatin1("QLocale(QLocale::%1, QLocale::%2)")
- .arg(locale->attributeLanguage()).arg(locale->attributeCountry());
+ .arg(locale->attributeLanguage(), locale->attributeCountry());
break;
}
case DomProperty::SizePolicy: {
@@ -1482,6 +1481,8 @@ void WriteInitialization::writeProperties(const QString &varName,
defineC = whatsThisDefineC;
else if (propertyName == QLatin1String("statusTip"))
defineC = statusTipDefineC;
+ else if (propertyName == QLatin1String("shortcut"))
+ defineC = shortcutDefineC;
else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription"))
defineC = accessibilityDefineC;
diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp
index e2399cd1fd..3599470403 100644
--- a/src/tools/uic/main.cpp
+++ b/src/tools/uic/main.cpp
@@ -32,6 +32,7 @@
#include <qfile.h>
#include <qdir.h>
+#include <qhashfunctions.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qcoreapplication.h>
@@ -39,11 +40,10 @@
#include <qcommandlineparser.h>
QT_BEGIN_NAMESPACE
-extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
int runUic(int argc, char *argv[])
{
- qt_qhash_seed.testAndSetRelaxed(-1, 0); // set the hash seed to 0 if it wasn't set yet
+ qSetGlobalQHashSeed(0); // set the hash seed to 0
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationVersion(QString::fromLatin1(QT_VERSION_STR));
@@ -115,7 +115,7 @@ int runUic(int argc, char *argv[])
QString inputFile;
if (!parser.positionalArguments().isEmpty())
- inputFile = parser.positionalArguments().first();
+ inputFile = parser.positionalArguments().at(0);
else // reading from stdin
driver.option().headerProtection = false;
diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro
index 9afb2d847f..02469cdd1b 100644
--- a/src/tools/uic/uic.pro
+++ b/src/tools/uic/uic.pro
@@ -1,5 +1,5 @@
option(host_build)
-!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)): \
+!force_bootstrap:if(!qtConfig(commandlineparser)|!qtConfig(textcodec)|!qtConfig(xmlstreamreader)|!qtConfig(xmlstreamwriter)): \
CONFIG += force_bootstrap
DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH