From 4fad7ae76a0ea834a35737e9b79c3ac3818a8713 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Feb 2012 11:46:33 +0100 Subject: moc: Fix loading of plugins in release mode. Generate the plugin meta data with "debug" set to false/true in two code sections #ifdefed QT_NO_DEBUG. Do not use the value of QT_NO_DEBUG set at moc compile time which does not work in release mode/Windows. Change-Id: I0252795ed063bebb2c3b3784f880e64845b5b7e7 Reviewed-by: Thiago Macieira Reviewed-by: Bradley T. Hughes --- src/tools/moc/generator.cpp | 66 +++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 26 deletions(-) (limited to 'src/tools') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 3362a1abc1..c7c7d96487 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -1057,41 +1057,55 @@ void Generator::generateSignal(FunctionDef *def,int index) fprintf(out, "}\n"); } -void Generator::generatePluginMetaData() +static void writePluginMetaData(FILE *out, const QJsonObject &data) { - if (cdef->pluginData.iid.isEmpty()) - return; + const QJsonDocument doc(data); - QJsonObject data; - data.insert(QLatin1String("IID"), QLatin1String(cdef->pluginData.iid.constData())); - data.insert(QLatin1String("className"), QLatin1String(cdef->classname.constData())); - data.insert(QLatin1String("version"), (int)QT_VERSION); - data.insert(QLatin1String("debug"), -#ifdef QT_NO_DEBUG - false -#else - true -#endif - ); - data.insert(QLatin1String("MetaData"), cdef->pluginData.metaData.object()); - QJsonDocument doc(data); - - fprintf(out, "\nQT_PLUGIN_METADATA_SECTION const uint qt_section_alignment_dummy = 42;\n"); - fprintf(out, - "\nQT_PLUGIN_METADATA_SECTION\n" - "static const unsigned char qt_pluginMetaData[] = {\n" - " 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', ' ',\n "); + fputs("\nQT_PLUGIN_METADATA_SECTION\n" + "static const unsigned char qt_pluginMetaData[] = {\n" + " 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', ' ',\n ", out); #if 0 fprintf(out, "\"%s\";\n", doc.toJson().constData()); #else - QByteArray binary = doc.toBinaryData(); - for (int i = 0; i < binary.size() - 1; ++i) { + const QByteArray binary = doc.toBinaryData(); + const int last = binary.size() - 1; + for (int i = 0; i < last; ++i) { fprintf(out, " 0x%02x,", (uchar)binary.at(i)); if (!((i + 1) % 8)) - fprintf(out, "\n "); + fputs("\n ", out); } - fprintf(out, " 0x%02x\n};\n", (uchar)binary.at(binary.size() - 1)); + fprintf(out, " 0x%02x\n};\n", (uchar)binary.at(last)); #endif +} + +void Generator::generatePluginMetaData() +{ + if (cdef->pluginData.iid.isEmpty()) + return; + + // Write plugin meta data #ifdefed QT_NO_DEBUG with debug=false, + // true, respectively. + + QJsonObject data; + const QString debugKey = QStringLiteral("debug"); + data.insert(QStringLiteral("IID"), QLatin1String(cdef->pluginData.iid.constData())); + data.insert(QStringLiteral("className"), QLatin1String(cdef->classname.constData())); + data.insert(QStringLiteral("version"), (int)QT_VERSION); + data.insert(debugKey, QJsonValue(false)); + data.insert(QStringLiteral("MetaData"), cdef->pluginData.metaData.object()); + + fputs("\nQT_PLUGIN_METADATA_SECTION const uint qt_section_alignment_dummy = 42;\n\n" + "#ifdef QT_NO_DEBUG\n", out); + writePluginMetaData(out, data); + + fputs("\n#else // QT_NO_DEBUG\n", out); + + data.remove(debugKey); + data.insert(debugKey, QJsonValue(true)); + writePluginMetaData(out, data); + + fputs("#endif // QT_NO_DEBUG\n\n", out); + // 'Use' all namespaces. int pos = cdef->qualified.indexOf("::"); for ( ; pos != -1 ; pos = cdef->qualified.indexOf("::", pos + 2) ) -- cgit v1.2.3 From 432a75604819d9ed4143036c7cafa72106c768e0 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 18 Oct 2011 16:44:54 +0200 Subject: replace 'const QChar &' with 'QChar ' where appropriate as QChar is actually an ushort and there is no point in taking its address. Merge-request: 69 Change-Id: Idcc9d621e5627514ade006aa12a789a88929d48b Reviewed-by: Olivier Goffart --- src/tools/uic/driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp index 5a9a862f14..16dc12f277 100644 --- a/src/tools/uic/driver.cpp +++ b/src/tools/uic/driver.cpp @@ -208,7 +208,7 @@ QString Driver::qtify(const QString &name) return qname; } -static bool isAnsiCCharacter(const QChar& c) +static bool isAnsiCCharacter(QChar c) { return (c.toUpper() >= QLatin1Char('A') && c.toUpper() <= QLatin1Char('Z')) || c.isDigit() || c == QLatin1Char('_'); -- cgit v1.2.3 From 7bbe79fe5f54ed7542d935600036d3c8b401505f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 17 Feb 2012 20:09:17 +0100 Subject: Drop file-engine abstraction from public API This abstraction imposed serious performance penalties and is being dropped from the public API. In particular, by allowing file names to be arbitrarily hijacked by different file engines, and requiring engines to be instantiated in order to decide, it imposed unnecessary overhead on all file operations. Another flaw in the design with direct impact on performance is how engines have no way to provide (or retain) additional information obtained when querying the filesystem. In many places this has meant repeated operations on the file system, where useful information is immediately discarded to be queried again subsequently. For Qt 4.8 a major refactoring of the code base took place to allow bypassing the file-engine abstraction in select places, with considerable performance gains observed. In Qt 5 it is expected we'll be able to take this further, reaping even more benefits, but the abstraction has to go. [Dropping this now does not preclude that virtual file systems make an appearance in Qt at a later point in Qt 5's lifecycle. Hopefully with a new and improved abstraction.] Forward declarations for QFileExtension(Result) were dropped, as the classes were never used or defined. Tests using "internalized" classes will only fully run on developer builds. QFSFileEngine was removed altogether from exception safety test, as it isn't its intent to test internal API. Change-Id: Ie910e6c2628be202ea9e05366b091d6d529b246b Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/tools/uic/qclass_lib_map.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/tools') diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h index 11be47ce64..fb181e27f7 100644 --- a/src/tools/uic/qclass_lib_map.h +++ b/src/tools/uic/qclass_lib_map.h @@ -53,9 +53,6 @@ QT_CLASS_LIB(Qt, QtCore, qnamespace.h) QT_CLASS_LIB(QInternal, QtCore, qnamespace.h) QT_CLASS_LIB(QCOORD, QtCore, qnamespace.h) QT_CLASS_LIB(QtConfig, QtCore, qconfig.h) -QT_CLASS_LIB(QAbstractFileEngine, QtCore, qabstractfileengine.h) -QT_CLASS_LIB(QAbstractFileEngineHandler, QtCore, qabstractfileengine.h) -QT_CLASS_LIB(QAbstractFileEngineIterator, QtCore, qabstractfileengine.h) QT_CLASS_LIB(QBuffer, QtCore, qbuffer.h) QT_CLASS_LIB(QDataStream, QtCore, qdatastream.h) QT_CLASS_LIB(QtDebug, QtCore, qdebug.h) @@ -68,7 +65,6 @@ QT_CLASS_LIB(QFileInfo, QtCore, qfileinfo.h) QT_CLASS_LIB(QFileInfoList, QtCore, qfileinfo.h) QT_CLASS_LIB(QFileInfoListIterator, QtCore, qfileinfo.h) QT_CLASS_LIB(QFileSystemWatcher, QtCore, qfilesystemwatcher.h) -QT_CLASS_LIB(QFSFileEngine, QtCore, qfsfileengine.h) QT_CLASS_LIB(QIODevice, QtCore, qiodevice.h) QT_CLASS_LIB(Q_PID, QtCore, qprocess.h) QT_CLASS_LIB(QProcessEnvironment, QtCore, qprocess.h) -- cgit v1.2.3 From ca028e1fe07f2fb268d1da73eeaccb0f7f264a04 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 23 Feb 2012 13:52:16 +0100 Subject: Bump the moc output revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit aee1f6cc413f56bf4962324799ee3887c3dd037f changed the values of some built-in meta-type ids. Since the ids of built-in types are directly encoded -- not as the symbolic QMetaType::Type name, but as a raw integer -- in the flags for meta-properties, the moc output prior to that change is incompatible with the current output. Change-Id: I970484825137a4f19c80726cfe2024e741e3e879 Reviewed-by: Jędrzej Nowacki Reviewed-by: Roberto Raggi Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart --- src/tools/moc/outputrevision.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/moc/outputrevision.h b/src/tools/moc/outputrevision.h index 15661a43aa..2ce5b9b765 100644 --- a/src/tools/moc/outputrevision.h +++ b/src/tools/moc/outputrevision.h @@ -43,6 +43,6 @@ #define OUTPUTREVISION_H // if the output revision changes, you MUST change it in qobjectdefs.h too -enum { mocOutputRevision = 63 }; // moc format output revision +enum { mocOutputRevision = 64 }; // moc format output revision #endif // OUTPUTREVISION_H -- cgit v1.2.3 From d91cf1e53b450483d92c50965fd3c33ab1da4300 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 21 Feb 2012 16:09:30 +0100 Subject: clean up qmake-generated projects remove "header" and assignmets which are defaults or bogus, reorder some assignments. Change-Id: I67403872168c890ca3b696753ceb01c605d19be7 Reviewed-by: Rohan McGovern --- src/tools/moc/util/generate_keywords.pro | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/tools') diff --git a/src/tools/moc/util/generate_keywords.pro b/src/tools/moc/util/generate_keywords.pro index eb04409922..88e5553f54 100644 --- a/src/tools/moc/util/generate_keywords.pro +++ b/src/tools/moc/util/generate_keywords.pro @@ -1,12 +1,4 @@ -###################################################################### -# Automatically generated by qmake (1.08a) Mon Feb 23 13:08:28 2004 -###################################################################### - -TEMPLATE = app CONFIG -= moc mac:CONFIG -= app_bundle -INCLUDEPATH += . -# Input SOURCES += generate_keywords.cpp -CONFIG += qt create_prl link_prl -- cgit v1.2.3 From b1995f2c96f90b20feb54a3368c2b8c2cfc1fa84 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 22 Feb 2012 16:40:58 +0100 Subject: rcc: micro-optimization Declare a char array instead of a pointer variable. Change-Id: I2beff815d05b6dc9c35bb0a55d7294189afbf17e Reviewed-by: Marius Storm-Olsen Reviewed-by: Olivier Goffart --- src/tools/rcc/rcc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 5fbda35fc6..b31c47e7ad 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -687,7 +687,7 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice) void RCCResourceLibrary::writeHex(quint8 tmp) { - const char * const digits = "0123456789abcdef"; + const char digits[] = "0123456789abcdef"; writeChar('0'); writeChar('x'); if (tmp < 16) { -- cgit v1.2.3 From 47525e689694df0eec0a2f03e8bf67eed91da295 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 26 Feb 2012 03:11:19 +0000 Subject: uic: remove unused QRegExp #includes QRegExp is not used, so they're unnecessary. Change-Id: I3480bcbe013a0bf15e2ee4fa30862fe035820eea Reviewed-by: Thiago Macieira --- src/tools/uic/driver.cpp | 1 - src/tools/uic/uic.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp index 16dc12f277..ea1d4f21f3 100644 --- a/src/tools/uic/driver.cpp +++ b/src/tools/uic/driver.cpp @@ -43,7 +43,6 @@ #include "uic.h" #include "ui4.h" -#include #include #include diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index 2de3352cfc..4ae04149e8 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -58,7 +58,6 @@ #include #include -#include #include #include -- cgit v1.2.3 From 5bbfe4d6d8752067e51983b34169a99f563088f8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 21 Feb 2012 21:41:28 +0100 Subject: remove over-uses of $$list() not sure why anyone would do *that* ... Change-Id: Id91e9e8bd602a9d9275ade2ca86aaa4f4698ff72 Reviewed-by: Joerg Bornemann --- src/tools/tools.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/tools.pro b/src/tools/tools.pro index e6b9eefc69..cf10163539 100644 --- a/src/tools/tools.pro +++ b/src/tools/tools.pro @@ -32,8 +32,8 @@ for(subname, TOOLS_SUBDIRS) { subdir = $$replace(subdir, $$reg_src, $$QT_BUILD_TREE) subdir = $$replace(subdir, /, $$QMAKE_DIR_SEP) subdir = $$replace(subdir, \\\\, $$QMAKE_DIR_SEP) - SUB_TEMPLATE = $$list($$fromfile($$subpro, TEMPLATE)) - !isEqual(subname, src_tools_bootstrap):if(isEqual($$SUB_TEMPLATE, lib) | isEqual($$SUB_TEMPLATE, subdirs)):!separate_debug_info { + SUB_TEMPLATE = $$fromfile($$subpro, TEMPLATE) + !isEqual(subname, src_tools_bootstrap):if(isEqual(SUB_TEMPLATE, lib) | isEqual(SUB_TEMPLATE, subdirs)):!separate_debug_info { #debug debug-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) debug) -- cgit v1.2.3 From 0d9714f44549bf2e3a39d5c9833a4744cc3e6410 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 25 Feb 2012 20:48:56 +0100 Subject: moc: Only generate IndexOfMethod for signals. moc is currently generating code to convert from a pointer to member function of a slot or signal to its index. The idea was that it could be usefull for slots to have the new syntax do the same as the old one (connecting signal index to slot index). But in practice, the new syntax do not use the IndexOfMethod for slots. Also, it does not work for all the slots (no Q_PRIVATE_SLOT, no static slots) So since it is not used, and that it would take room in the binaries to generate all the code to get the index of slots, we remove it. If ever we need it, we can still add it later. Change-Id: Ia417e3e524d7915ca86433ea86c66ac2b299c81a Reviewed-by: Kent Hansen --- src/tools/moc/generator.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/tools') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index c7c7d96487..ac602fd6e8 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -951,13 +951,17 @@ void Generator::generateStaticMetacall() } fprintf(out, " default: ;\n"); fprintf(out, " }\n"); - - fprintf(out, " } else if (_c == QMetaObject::IndexOfMethod) {\n"); + fprintf(out, " }"); + needElse = true; + } + if (!cdef->signalList.isEmpty()) { + Q_ASSERT(needElse); // if there is signal, there was method. + fprintf(out, " else if (_c == QMetaObject::IndexOfMethod) {\n"); fprintf(out, " int *result = reinterpret_cast(_a[0]);\n"); fprintf(out, " void **func = reinterpret_cast(_a[1]);\n"); bool anythingUsed = false; - for (int methodindex = 0; methodindex < methodList.size(); ++methodindex) { - const FunctionDef &f = methodList.at(methodindex); + for (int methodindex = 0; methodindex < cdef->signalList.size(); ++methodindex) { + const FunctionDef &f = cdef->signalList.at(methodindex); if (f.wasCloned || !f.inPrivateClass.isEmpty() || f.isStatic) continue; anythingUsed = true; -- cgit v1.2.3