diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-02-02 11:16:42 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-02-13 11:39:49 +0000 |
commit | a2c7d7737c10fd88f1ab757e1fff741ab496da96 (patch) | |
tree | a80035b875f0743334e38e0ace5a4f1804b6431f /tools | |
parent | 7cab7ea23bd64487739088ce2d69de4337bb5cc8 (diff) |
Update moc copy from qtbase
Pick-to: 6.5
Fixes: QTBUG-110352
Change-Id: I6ca9b1412d8206413a8ec1137413132e37bccaa9
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qscxmlc/generator.cpp | 494 | ||||
-rw-r--r-- | tools/qscxmlc/moc.h | 6 | ||||
-rw-r--r-- | tools/qscxmlc/moc_patches/generator.cpp.patch | 154 | ||||
-rw-r--r-- | tools/qscxmlc/moc_patches/generator.h.patch | 17 | ||||
-rw-r--r-- | tools/qscxmlc/moc_patches/moc.h.patch | 32 | ||||
-rw-r--r-- | tools/qscxmlc/moc_patches/outputrevision.h.patch | 15 |
6 files changed, 370 insertions, 348 deletions
diff --git a/tools/qscxmlc/generator.cpp b/tools/qscxmlc/generator.cpp index bbc4c64..2d6865e 100644 --- a/tools/qscxmlc/generator.cpp +++ b/tools/qscxmlc/generator.cpp @@ -121,6 +121,40 @@ static inline int lengthOfEscapeSequence(const QByteArray &s, int i) return i - startPos; } +static inline uint lengthOfEscapedString(const QByteArray &str) +{ + int extra = 0; + for (int j = 0; j < str.size(); ++j) { + if (str.at(j) == '\\') { + int cnt = lengthOfEscapeSequence(str, j) - 1; + extra += cnt; + j += cnt; + } + } + return str.size() - extra; +} + +// Prints \a s to \a out, breaking it into lines of at most ColumnWidth. The +// opening and closing quotes are NOT included (it's up to the caller). +static void printStringWithIndentation(QIODevice &out, const QByteArray &s) // -- QtScxml +{ + static constexpr int ColumnWidth = 72; + int len = s.size(); + int idx = 0; + + do { + int spanLen = qMin(ColumnWidth - 2, len - idx); + // don't cut escape sequences at the end of a line + int backSlashPos = s.lastIndexOf('\\', idx + spanLen - 1); + if (backSlashPos >= idx) { + int escapeLen = lengthOfEscapeSequence(s, backSlashPos); + spanLen = qBound(spanLen, backSlashPos + escapeLen - idx, len - idx); + } + fprintf(out, "\n \"%.*s\"", spanLen, s.constData() + idx); + idx += spanLen; + } while (idx < len); +} + void Generator::strreg(const QByteArray &s) { if (!strings.contains(s)) @@ -204,6 +238,22 @@ static bool qualifiedNameEquals(const QByteArray &qualifiedName, const QByteArra return qualifiedNameEquals(qualifiedName.mid(index+2), name); } +static QByteArray generateQualifiedClassNameIdentifier(const QByteArray &identifier) +{ + QByteArray qualifiedClassNameIdentifier = identifier; + + // Remove ':'s in the name, but be sure not to create any illegal + // identifiers in the process. (Don't replace with '_', because + // that will create problems with things like NS_::_class.) + qualifiedClassNameIdentifier.replace("::", "SCOPE"); + + // Also, avoid any leading/trailing underscores (we'll concatenate + // the generated name with other prefixes/suffixes, and these latter + // may already include an underscore, leading to two underscores) + qualifiedClassNameIdentifier = "CLASS" + qualifiedClassNameIdentifier + "ENDCLASS"; + return qualifiedClassNameIdentifier; +} + void Generator::generateCode() { bool isQObject = (cdef->classname == "QObject"); @@ -240,92 +290,107 @@ void Generator::generateCode() registerPropertyStrings(); registerEnumStrings(); - QByteArray qualifiedClassNameIdentifier = cdef->qualified; - qualifiedClassNameIdentifier.replace(':', '_'); + const bool hasStaticMetaCall = + (cdef->hasQObject || !cdef->methodList.isEmpty() + || !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty()); + + const QByteArray qualifiedClassNameIdentifier = generateQualifiedClassNameIdentifier(cdef->qualified); + + // ensure the qt_meta_stringdata_XXXX_t type is local + fprintf(out, "namespace {\n"); // -// Build stringdata struct +// Build the strings using QtMocHelpers::StringData // - const int constCharArraySizeLimit = 65535; - fprintf(out, "struct qt_meta_stringdata_%s_t {\n", qualifiedClassNameIdentifier.constData()); - fprintf(out, " const uint offsetsAndSize[%d];\n", int(strings.size()*2)); + + fprintf(out, "\n#ifdef QT_MOC_HAS_STRINGDATA\n" + "struct qt_meta_stringdata_%s_t {};\n" + "static constexpr auto qt_meta_stringdata_%s = QtMocHelpers::stringData(", + qualifiedClassNameIdentifier.constData(), qualifiedClassNameIdentifier.constData()); { - int stringDataLength = 0; - int stringDataCounter = 0; - for (int i = 0; i < strings.size(); ++i) { - int thisLength = strings.at(i).size() + 1; - stringDataLength += thisLength; - if (stringDataLength / constCharArraySizeLimit) { - // save previous stringdata and start computing the next one. -// -- QtScxml - fprintf(out, " unsigned char stringdata%d[%d];\n", stringDataCounter++, - stringDataLength - thisLength); -// -- QtScxml - stringDataLength = thisLength; - } + char comma = 0; + for (const QByteArray &str : strings) { + if (comma) + fputc(comma, out); + printStringWithIndentation(out, str); + comma = ','; } + } + fprintf(out, "\n);\n" + "#else // !QT_MOC_HAS_STRING_DATA\n"); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) + fprintf(out, "#error \"qtmochelpers.h not found or too old.\"\n"); +#else +// +// Build stringdata struct +// + + fprintf(out, "struct qt_meta_stringdata_%s_t {\n", qualifiedClassNameIdentifier.constData()); + fprintf(out, " uint offsetsAndSizes[%d];\n", int(strings.size() * 2)); + for (int i = 0; i < strings.size(); ++i) { + int thisLength = lengthOfEscapedString(strings.at(i)) + 1; // -- QtScxml - fprintf(out, " unsigned char stringdata%d[%d];\n", stringDataCounter, stringDataLength); + fprintf(out, " unsigned char stringdata%d[%d];\n", i, thisLength); // -- QtScxml } fprintf(out, "};\n"); - // Macro that expands into a QByteArrayData. The offset member is - // calculated from 1) the offset of the actual characters in the - // stringdata.stringdata member, and 2) the stringdata.data index of the - // QByteArrayData being defined. This calculation relies on the - // QByteArrayData::data() implementation returning simply "this + offset". + // Macro that simplifies the string data listing. The offset is calculated + // from the top of the stringdata object (i.e., past the uints). fprintf(out, "#define QT_MOC_LITERAL(ofs, len) \\\n" - " uint(offsetof(qt_meta_stringdata_%s_t, stringdata0) + ofs), len \n", + " uint(sizeof(qt_meta_stringdata_%s_t::offsetsAndSizes) + ofs), len \n", qualifiedClassNameIdentifier.constData()); - fprintf(out, "static const qt_meta_stringdata_%s_t qt_meta_stringdata_%s = {\n", + fprintf(out, "Q_CONSTINIT static const qt_meta_stringdata_%s_t qt_meta_stringdata_%s = {\n", qualifiedClassNameIdentifier.constData(), qualifiedClassNameIdentifier.constData()); - fprintf(out, " {\n"); + fprintf(out, " {"); { int idx = 0; for (int i = 0; i < strings.size(); ++i) { const QByteArray &str = strings.at(i); - fprintf(out, "QT_MOC_LITERAL(%d, %d)", idx, int(str.size())); - if (i != strings.size() - 1) - fputc(',', out); const QByteArray comment = str.size() > 32 ? str.left(29) + "..." : str; - fprintf(out, " // \"%s\"\n", comment.size() ? comment.constData() : ""); - idx += str.size() + 1; - for (int j = 0; j < str.size(); ++j) { - if (str.at(j) == '\\') { - int cnt = lengthOfEscapeSequence(str, j) - 1; - idx -= cnt; - j += cnt; - } - } + const char *comma = (i != strings.size() - 1 ? "," : " "); + int len = lengthOfEscapedString(str); + fprintf(out, "\n QT_MOC_LITERAL(%d, %d)%s // \"%s\"", idx, len, comma, + comment.constData()); + + idx += len + 1; } - fprintf(out, " },{\n"); // -- QtScxml + fprintf(out, "\n }"); } // -// Build stringdata array +// Build stringdata arrays // // -- QtScxml - for (int i = 0; i < strings.size(); ++i) { - QByteArray s = strings.at(i); - int len = s.size(); - for (int charPos = 0; charPos < len; ++charPos) + for (qsizetype i = 0, end = strings.size(); i < end; ++i) { + if (i == 0) + fprintf(out, ","); + fprintf(out, "\n {"); + const QByteArray s = strings.at(i); + const qsizetype len = s.size(); + for (qsizetype charPos = 0; charPos < len; ++charPos) fprintf(out, "0x%.2x,", static_cast<quint8>(s.at(charPos))); - fprintf(out, "0%s // %d: %s\n", i < strings.size() - 1 ? "," : "", i, s.constData()); + const bool isLast = (i == end - 1); + fprintf(out, "0%s // %d: %s", isLast ? "}" : "},", i, s.constData()); } // -- QtScxml // Terminate stringdata struct - fprintf(out, " }};\n"); // -- QtScxml - fprintf(out, "#undef QT_MOC_LITERAL\n\n"); + fprintf(out, "\n};\n"); + fprintf(out, "#undef QT_MOC_LITERAL\n"); +#endif // Qt 6.9 + + fprintf(out, "#endif // !QT_MOC_HAS_STRING_DATA\n"); + fprintf(out, "} // unnamed namespace\n\n"); // // build the data array // int index = MetaObjectPrivateFieldCount; - fprintf(out, "static const uint qt_meta_data_%s[] = {\n", qualifiedClassNameIdentifier.constData()); + fprintf(out, "Q_CONSTINIT static const uint qt_meta_data_%s[] = {\n", qualifiedClassNameIdentifier.constData()); fprintf(out, "\n // content:\n"); fprintf(out, " %4d, // revision\n", int(QMetaObjectPrivate::OutputRevision)); fprintf(out, " %4d, // classname\n", stridx(cdef->qualified)); @@ -371,7 +436,8 @@ void Generator::generateCode() // generateClassInfos(); - int initialMetaTypeOffset = cdef->propertyList.size(); + // all property metatypes, + 1 for the type of the current class itself + int initialMetaTypeOffset = cdef->propertyList.size() + 1; // // Build signals array first, otherwise the signal indices would be wrong @@ -428,15 +494,6 @@ void Generator::generateCode() fprintf(out, "\n 0 // eod\n};\n\n"); // -// Generate internal qt_static_metacall() function -// - const bool hasStaticMetaCall = - (cdef->hasQObject || !cdef->methodList.isEmpty() - || !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty()); - if (hasStaticMetaCall) - generateStaticMetacall(); - -// // Build extra array // QList<QByteArray> extraList; @@ -501,7 +558,7 @@ void Generator::generateCode() // if (!extraList.isEmpty()) { - fprintf(out, "static const QMetaObject::SuperData qt_meta_extradata_%s[] = {\n", + fprintf(out, "Q_CONSTINIT static const QMetaObject::SuperData qt_meta_extradata_%s[] = {\n", qualifiedClassNameIdentifier.constData()); for (int i = 0; i < extraList.size(); ++i) { fprintf(out, " QMetaObject::SuperData::link<%s::staticMetaObject>(),\n", extraList.at(i).constData()); @@ -512,17 +569,18 @@ void Generator::generateCode() // // Finally create and initialize the static meta object // - fprintf(out, "const QMetaObject %s::staticMetaObject = { {\n", cdef->qualified.constData()); + fprintf(out, "Q_CONSTINIT const QMetaObject %s::staticMetaObject = { {\n", + cdef->qualified.constData()); if (isQObject) fprintf(out, " nullptr,\n"); else if (cdef->superclassList.size() && !cdef->hasQGadget && !cdef->hasQNamespace) // for qobject, we know the super class must have a static metaobject fprintf(out, " QMetaObject::SuperData::link<%s::staticMetaObject>(),\n", purestSuperClass.constData()); else if (cdef->superclassList.size()) // for gadgets we need to query at compile time for it - fprintf(out, " QtPrivate::MetaObjectForType<%s>::value(),\n", purestSuperClass.constData()); + fprintf(out, " QtPrivate::MetaObjectForType<%s>::value,\n", purestSuperClass.constData()); else fprintf(out, " nullptr,\n"); - fprintf(out, " qt_meta_stringdata_%s.offsetsAndSize,\n" + fprintf(out, " qt_meta_stringdata_%s.offsetsAndSizes,\n" " qt_meta_data_%s,\n", qualifiedClassNameIdentifier.constData(), qualifiedClassNameIdentifier.constData()); if (hasStaticMetaCall) @@ -535,67 +593,71 @@ void Generator::generateCode() else fprintf(out, " qt_meta_extradata_%s,\n", qualifiedClassNameIdentifier.constData()); - bool constructorListContainsArgument = false; - for (int i = 0; i< cdef->constructorList.size(); ++i) { - const FunctionDef& fdef = cdef->constructorList.at(i); - if (fdef.arguments.size()) { - constructorListContainsArgument = true; - break; - } - } - if (cdef->propertyList.isEmpty() && cdef->signalList.isEmpty() && cdef->slotList.isEmpty() && cdef->methodList.isEmpty() && !constructorListContainsArgument) { - fprintf(out, " nullptr,\n"); + const char *comma = ""; + const bool requireCompleteness = requireCompleteTypes || cdef->requireCompleteMethodTypes; + auto stringForType = [requireCompleteness](const QByteArray &type, bool forceComplete) -> QByteArray { + const char *forceCompleteType = forceComplete ? ", std::true_type>" : ", std::false_type>"; + if (requireCompleteness) + return type; + return "QtPrivate::TypeAndForceComplete<" % type % forceCompleteType; + }; + if (!requireCompleteness) { + fprintf(out, " qt_incomplete_metaTypeArray<qt_meta_stringdata_%s_t", qualifiedClassNameIdentifier.constData()); + comma = ","; } else { - bool needsComma = false; - const bool requireCompleteness = requireCompleteTypes || cdef->requireCompleteMethodTypes; - if (!requireCompleteness) { - fprintf(out, "qt_incomplete_metaTypeArray<qt_meta_stringdata_%s_t\n", qualifiedClassNameIdentifier.constData()); - needsComma = true; - } else { - fprintf(out, "qt_metaTypeArray<\n"); - } - for (int i = 0; i < cdef->propertyList.size(); ++i) { - const PropertyDef &p = cdef->propertyList.at(i); - if (requireCompleteness) - fprintf(out, "%s%s", needsComma ? ", " : "", p.type.data()); - else - fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::true_type>", needsComma ? ", " : "", p.type.data()); - needsComma = true; - } - for (const QList<FunctionDef> &methodContainer : - { cdef->signalList, cdef->slotList, cdef->methodList }) { - for (int i = 0; i< methodContainer.size(); ++i) { - const FunctionDef& fdef = methodContainer.at(i); - if (requireCompleteness) - fprintf(out, "%s%s", needsComma ? ", " : "", fdef.type.name.data()); - else - fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::false_type>", needsComma ? ", " : "", fdef.type.name.data()); - needsComma = true; - for (const auto &argument: fdef.arguments) { - if (requireCompleteness) - fprintf(out, ", %s", argument.type.name.data()); - else - fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); - } - } - fprintf(out, "\n"); + fprintf(out, " qt_metaTypeArray<"); + } + // metatypes for properties + for (int i = 0; i < cdef->propertyList.size(); ++i) { + const PropertyDef &p = cdef->propertyList.at(i); + fprintf(out, "%s\n // property '%s'\n %s", + comma, p.name.constData(), stringForType(p.type, true).constData()); + comma = ","; + } + + // type name for the Q_OJBECT/GADGET itself, void for namespaces + auto ownType = !cdef->hasQNamespace ? cdef->classname.data() : "void"; + fprintf(out, "%s\n // Q_OBJECT / Q_GADGET\n %s", + comma, stringForType(ownType, true).constData()); + comma = ","; + + // metatypes for all exposed methods + // because we definitely printed something above, this section doesn't need comma control + for (const QList<FunctionDef> &methodContainer : + { cdef->signalList, cdef->slotList, cdef->methodList }) { + for (int i = 0; i< methodContainer.size(); ++i) { + const FunctionDef& fdef = methodContainer.at(i); + fprintf(out, ",\n // method '%s'\n %s", + fdef.name.constData(), stringForType(fdef.type.name, false).constData()); + for (const auto &argument: fdef.arguments) + fprintf(out, ",\n %s", stringForType(argument.type.name, false).constData()); } - for (int i = 0; i< cdef->constructorList.size(); ++i) { - const FunctionDef& fdef = cdef->constructorList.at(i); - for (const auto &argument: fdef.arguments) { - if (requireCompleteness) - fprintf(out, "%s%s", needsComma ? ", " : "", argument.type.name.data()); - else - fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::false_type>", needsComma ? ", " : "", argument.type.name.data()); - needsComma = true; - } + } + + // but constructors have no return types, so this needs comma control again + for (int i = 0; i< cdef->constructorList.size(); ++i) { + const FunctionDef& fdef = cdef->constructorList.at(i); + if (fdef.arguments.isEmpty()) + continue; + + fprintf(out, "%s\n // constructor '%s'", comma, fdef.name.constData()); + comma = ""; + for (const auto &argument: fdef.arguments) { + fprintf(out, "%s\n %s", comma, + stringForType(argument.type.name, false).constData()); + comma = ","; } - fprintf(out, "\n"); - fprintf(out, ">,\n"); } + fprintf(out, "\n >,\n"); fprintf(out, " nullptr\n} };\n\n"); +// +// Generate internal qt_static_metacall() function +// + if (hasStaticMetaCall) + generateStaticMetacall(); + if (!cdef->hasQObject) return; @@ -612,7 +674,7 @@ void Generator::generateCode() fprintf(out, " if (!strcmp(_clname, reinterpret_cast<const char *>(\n" " qt_meta_stringdata_%s.stringdata0)))\n" " return static_cast<void*>(const_cast< %s*>(this));\n", - qualifiedClassNameIdentifier.constData(), qualifiedClassNameIdentifier.constData()); + qualifiedClassNameIdentifier.constData(), cdef->qualified.constData()); // -- QtScxml for (int i = 1; i < cdef->superclassList.size(); ++i) { // for all superclasses but the first one if (cdef->superclassList.at(i).second == FunctionDef::Private) @@ -730,7 +792,7 @@ void Generator::generateFunctions(const QList<FunctionDef> &list, const char *fu const FunctionDef &f = list.at(i); QByteArray comment; - unsigned char flags = type; + uint flags = type; if (f.access == FunctionDef::Private) { flags |= AccessPrivate; comment.append("Private"); @@ -758,6 +820,11 @@ void Generator::generateFunctions(const QList<FunctionDef> &list, const char *fu comment.append(" | MethodRevisioned"); } + if (f.isConst) { + flags |= MethodIsConst; + comment.append(" | MethodIsConst "); + } + int argc = f.arguments.size(); fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x, %4d /* %s */,\n", stridx(f.name), argc, paramsIndex, stridx(f.tag), flags, initialMetatypeOffset, comment.constData()); @@ -1000,8 +1067,6 @@ void Generator::generateMetacall() } if (cdef->propertyList.size()) { - - fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n "); if (needElse) fprintf(out, "else "); fprintf(out, @@ -1010,7 +1075,6 @@ void Generator::generateMetacall() " || _c == QMetaObject::RegisterPropertyMetaType) {\n" " qt_static_metacall(this, _c, _id, _a);\n" " _id -= %d;\n }", int(cdef->propertyList.size())); - fprintf(out, "\n#endif // QT_NO_PROPERTIES"); } if (methodList.size() || cdef->propertyList.size()) fprintf(out, "\n "); @@ -1018,6 +1082,7 @@ void Generator::generateMetacall() } +// ### Qt 7 (6.x?): remove QMultiMap<QByteArray, int> Generator::automaticPropertyMetaTypesHelper() { QMultiMap<QByteArray, int> automaticPropertyMetaTypes; @@ -1052,33 +1117,45 @@ void Generator::generateStaticMetacall() bool needElse = false; bool isUsed_a = false; + const auto generateCtorArguments = [&](int ctorindex) { + const FunctionDef &f = cdef->constructorList.at(ctorindex); + Q_ASSERT(!f.isPrivateSignal); // That would be a strange ctor indeed + int offset = 1; + + int argsCount = f.arguments.size(); + for (int j = 0; j < argsCount; ++j) { + const ArgumentDef &a = f.arguments.at(j); + if (j) + fprintf(out, ","); + fprintf(out, "(*reinterpret_cast<%s>(_a[%d]))", + a.typeNameForCast.constData(), offset++); + } + }; + if (!cdef->constructorList.isEmpty()) { fprintf(out, " if (_c == QMetaObject::CreateInstance) {\n"); fprintf(out, " switch (_id) {\n"); - for (int ctorindex = 0; ctorindex < cdef->constructorList.size(); ++ctorindex) { + const int ctorend = cdef->constructorList.size(); + for (int ctorindex = 0; ctorindex < ctorend; ++ctorindex) { fprintf(out, " case %d: { %s *_r = new %s(", ctorindex, cdef->classname.constData(), cdef->classname.constData()); - const FunctionDef &f = cdef->constructorList.at(ctorindex); - int offset = 1; - - int argsCount = f.arguments.size(); - for (int j = 0; j < argsCount; ++j) { - const ArgumentDef &a = f.arguments.at(j); - if (j) - fprintf(out, ","); - fprintf(out, "(*reinterpret_cast< %s>(_a[%d]))", a.typeNameForCast.constData(), offset++); - } - if (f.isPrivateSignal) { - if (argsCount > 0) - fprintf(out, ", "); - fprintf(out, "%s", QByteArray("QPrivateSignal()").constData()); - } + generateCtorArguments(ctorindex); fprintf(out, ");\n"); fprintf(out, " if (_a[0]) *reinterpret_cast<%s**>(_a[0]) = _r; } break;\n", (cdef->hasQGadget || cdef->hasQNamespace) ? "void" : "QObject"); } fprintf(out, " default: break;\n"); fprintf(out, " }\n"); + fprintf(out, " } else if (_c == QMetaObject::ConstructInPlace) {\n"); + fprintf(out, " switch (_id) {\n"); + for (int ctorindex = 0; ctorindex < ctorend; ++ctorindex) { + fprintf(out, " case %d: { new (_a[0]) %s(", + ctorindex, cdef->classname.constData()); + generateCtorArguments(ctorindex); + fprintf(out, "); } break;\n"); + } + fprintf(out, " default: break;\n"); + fprintf(out, " }\n"); fprintf(out, " }"); needElse = true; isUsed_a = true; @@ -1217,9 +1294,8 @@ void Generator::generateStaticMetacall() fprintf(out, ") const;\n"); else fprintf(out, ");\n"); - fprintf(out, " if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&%s::%s)) {\n", - cdef->classname.constData(), - f.mangledName.constData()); // -- QtScxml + fprintf(out, " if (_t _q_method = &%s::%s; *reinterpret_cast<_t *>(_a[1]) == _q_method) {\n", + cdef->classname.constData(), f.mangledName.constData()); // -- QtScxml fprintf(out, " *result = %d;\n", methodindex); fprintf(out, " return;\n"); fprintf(out, " }\n }\n"); @@ -1250,7 +1326,7 @@ void Generator::generateStaticMetacall() fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", lastKey.constData()); } fprintf(out, " }\n"); - fprintf(out, " }\n"); + fprintf(out, " } "); isUsed_a = true; needElse = true; } @@ -1272,10 +1348,8 @@ void Generator::generateStaticMetacall() needReset |= !p.reset.isEmpty(); hasBindableProperties |= !p.bind.isEmpty(); } - fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n "); - if (needElse) - fprintf(out, "else "); + fprintf(out, " else "); fprintf(out, "if (_c == QMetaObject::ReadProperty) {\n"); auto setupMemberAccess = [this]() { @@ -1313,6 +1387,9 @@ void Generator::generateStaticMetacall() else if (cdef->enumDeclarations.value(p.type, false)) fprintf(out, " case %d: *reinterpret_cast<int*>(_v) = QFlag(%s%s()); break;\n", propindex, prefix.constData(), p.read.constData()); + else if (p.read == "default") + fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s%s().value(); break;\n", + propindex, p.type.constData(), prefix.constData(), p.bind.constData()); else if (!p.read.isEmpty()) // -- QtScxml fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s%s%s; break;\n", @@ -1349,6 +1426,12 @@ void Generator::generateStaticMetacall() if (cdef->enumDeclarations.value(p.type, false)) { fprintf(out, " case %d: %s%s(QFlag(*reinterpret_cast<int*>(_v))); break;\n", propindex, prefix.constData(), p.write.constData()); + } else if (p.write == "default") { + fprintf(out, " case %d: {\n", propindex); + fprintf(out, " %s%s().setValue(*reinterpret_cast< %s*>(_v));\n", + prefix.constData(), p.bind.constData(), p.type.constData()); + fprintf(out, " break;\n"); + fprintf(out, " }\n"); } else if (!p.write.isEmpty()) { fprintf(out, " case %d: %s%s(*reinterpret_cast< %s*>(_v)); break;\n", propindex, prefix.constData(), p.write.constData(), p.type.constData()); @@ -1385,13 +1468,13 @@ void Generator::generateStaticMetacall() fprintf(out, " switch (_id) {\n"); for (int propindex = 0; propindex < cdef->propertyList.size(); ++propindex) { const PropertyDef &p = cdef->propertyList.at(propindex); - if (!p.reset.endsWith(')')) + if (p.reset.isEmpty()) continue; QByteArray prefix = "_t->"; if (p.inPrivateClass.size()) { prefix += p.inPrivateClass + "->"; } - fprintf(out, " case %d: %s%s; break;\n", + fprintf(out, " case %d: %s%s(); break;\n", propindex, prefix.constData(), p.reset.constData()); } fprintf(out, " default: break;\n"); @@ -1408,13 +1491,19 @@ void Generator::generateStaticMetacall() const PropertyDef &p = cdef->propertyList.at(propindex); if (p.bind.isEmpty()) continue; - fprintf(out, " case %d: *static_cast<QUntypedBindable *>(_a[0]) = _t->%s(); break;\n", propindex, p.bind.constData()); + QByteArray prefix = "_t->"; + if (p.inPrivateClass.size()) { + prefix += p.inPrivateClass + "->"; + } + fprintf(out, + " case %d: *static_cast<QUntypedBindable *>(_a[0]) = %s%s(); " + "break;\n", + propindex, prefix.constData(), p.bind.constData()); } fprintf(out, " default: break;\n"); fprintf(out, " }\n"); } fprintf(out, " }"); - fprintf(out, "\n#endif // QT_NO_PROPERTIES"); needElse = true; } @@ -1431,7 +1520,7 @@ void Generator::generateStaticMetacall() if (!isUsed_a) fprintf(out, " (void)_a;\n"); - fprintf(out, "}\n\n"); + fprintf(out, "}\n"); } void Generator::generateSignal(FunctionDef *def,int index) @@ -1582,8 +1671,7 @@ static CborError jsonValueToCbor(CborEncoder *parent, const QJsonValue &v) return cbor_encode_double(parent, d); } } - Q_UNREACHABLE(); - return CborUnknownError; + Q_UNREACHABLE_RETURN(CborUnknownError); } void Generator::generatePluginMetaData() @@ -1591,62 +1679,76 @@ void Generator::generatePluginMetaData() if (cdef->pluginData.iid.isEmpty()) return; - fprintf(out, "\nQT_PLUGIN_METADATA_SECTION\n" - "static constexpr unsigned char qt_pluginMetaData_%s[] = {\n" - " 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', '!',\n" - " // metadata version, Qt version, architectural requirements\n" - " 0, QT_VERSION_MAJOR, QT_VERSION_MINOR, qPluginArchRequirements(),", - cdef->classname.constData()); - + auto outputCborData = [this]() { + CborDevice dev(out); + CborEncoder enc; + cbor_encoder_init_writer(&enc, CborDevice::callback, &dev); - CborDevice dev(out); - CborEncoder enc; - cbor_encoder_init_writer(&enc, CborDevice::callback, &dev); - - CborEncoder map; - cbor_encoder_create_map(&enc, &map, CborIndefiniteLength); + CborEncoder map; + cbor_encoder_create_map(&enc, &map, CborIndefiniteLength); - dev.nextItem("\"IID\""); - cbor_encode_int(&map, int(QtPluginMetaDataKeys::IID)); - cbor_encode_text_string(&map, cdef->pluginData.iid.constData(), cdef->pluginData.iid.size()); + dev.nextItem("\"IID\""); + cbor_encode_int(&map, int(QtPluginMetaDataKeys::IID)); + cbor_encode_text_string(&map, cdef->pluginData.iid.constData(), cdef->pluginData.iid.size()); - dev.nextItem("\"className\""); - cbor_encode_int(&map, int(QtPluginMetaDataKeys::ClassName)); - cbor_encode_text_string(&map, cdef->classname.constData(), cdef->classname.size()); + dev.nextItem("\"className\""); + cbor_encode_int(&map, int(QtPluginMetaDataKeys::ClassName)); + cbor_encode_text_string(&map, cdef->classname.constData(), cdef->classname.size()); - QJsonObject o = cdef->pluginData.metaData.object(); - if (!o.isEmpty()) { - dev.nextItem("\"MetaData\""); - cbor_encode_int(&map, int(QtPluginMetaDataKeys::MetaData)); - jsonObjectToCbor(&map, o); - } + QJsonObject o = cdef->pluginData.metaData.object(); + if (!o.isEmpty()) { + dev.nextItem("\"MetaData\""); + cbor_encode_int(&map, int(QtPluginMetaDataKeys::MetaData)); + jsonObjectToCbor(&map, o); + } - if (!cdef->pluginData.uri.isEmpty()) { - dev.nextItem("\"URI\""); - cbor_encode_int(&map, int(QtPluginMetaDataKeys::URI)); - cbor_encode_text_string(&map, cdef->pluginData.uri.constData(), cdef->pluginData.uri.size()); - } + if (!cdef->pluginData.uri.isEmpty()) { + dev.nextItem("\"URI\""); + cbor_encode_int(&map, int(QtPluginMetaDataKeys::URI)); + cbor_encode_text_string(&map, cdef->pluginData.uri.constData(), cdef->pluginData.uri.size()); + } - // Add -M args from the command line: - for (auto it = cdef->pluginData.metaArgs.cbegin(), end = cdef->pluginData.metaArgs.cend(); it != end; ++it) { - const QJsonArray &a = it.value(); - QByteArray key = it.key().toUtf8(); - dev.nextItem(QByteArray("command-line \"" + key + "\"").constData()); - cbor_encode_text_string(&map, key.constData(), key.size()); - jsonArrayToCbor(&map, a); - } + // Add -M args from the command line: + for (auto it = cdef->pluginData.metaArgs.cbegin(), end = cdef->pluginData.metaArgs.cend(); it != end; ++it) { + const QJsonArray &a = it.value(); + QByteArray key = it.key().toUtf8(); + dev.nextItem(QByteArray("command-line \"" + key + "\"").constData()); + cbor_encode_text_string(&map, key.constData(), key.size()); + jsonArrayToCbor(&map, a); + } - // Close the CBOR map manually - dev.nextItem(); - cbor_encoder_close_container(&enc, &map); - fputs("\n};\n", out); + // Close the CBOR map manually + dev.nextItem(); + cbor_encoder_close_container(&enc, &map); + }; // 'Use' all namespaces. int pos = cdef->qualified.indexOf("::"); for ( ; pos != -1 ; pos = cdef->qualified.indexOf("::", pos + 2) ) fprintf(out, "using namespace %s;\n", cdef->qualified.left(pos).constData()); - fprintf(out, "QT_MOC_EXPORT_PLUGIN(%s, %s)\n\n", + + fputs("\n#ifdef QT_MOC_EXPORT_PLUGIN_V2", out); + + // Qt 6.3+ output + fprintf(out, "\nstatic constexpr unsigned char qt_pluginMetaDataV2_%s[] = {", + cdef->classname.constData()); + outputCborData(); + fprintf(out, "\n};\nQT_MOC_EXPORT_PLUGIN_V2(%s, %s, qt_pluginMetaDataV2_%s)\n", + cdef->qualified.constData(), cdef->classname.constData(), cdef->classname.constData()); + + // compatibility with Qt 6.0-6.2 + fprintf(out, "#else\nQT_PLUGIN_METADATA_SECTION\n" + "Q_CONSTINIT static constexpr unsigned char qt_pluginMetaData_%s[] = {\n" + " 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', '!',\n" + " // metadata version, Qt version, architectural requirements\n" + " 0, QT_VERSION_MAJOR, QT_VERSION_MINOR, qPluginArchRequirements(),", + cdef->classname.constData()); + outputCborData(); + fprintf(out, "\n};\nQT_MOC_EXPORT_PLUGIN(%s, %s)\n" + "#endif // QT_MOC_EXPORT_PLUGIN_V2\n", cdef->qualified.constData(), cdef->classname.constData()); + + fputs("\n", out); } QT_WARNING_DISABLE_GCC("-Wunused-function") diff --git a/tools/qscxmlc/moc.h b/tools/qscxmlc/moc.h index 2381a4f..dabc6c0 100644 --- a/tools/qscxmlc/moc.h +++ b/tools/qscxmlc/moc.h @@ -5,14 +5,13 @@ #define MOC_H // -- QtScxml -#include <QtCore/private/qtools_p.h> #include <QtCore/qmap.h> #include <QtCore/qpair.h> #include <QtCore/qjsondocument.h> #include <QtCore/qjsonarray.h> // -- QtScxml -#include <ctype.h> +#include <private/qtools_p.h> QT_BEGIN_NAMESPACE @@ -122,6 +121,7 @@ struct PropertyDef bool constant = false; bool final = false; bool required = false; + int relativeIndex = -1; // property index in current metaobject int location = -1; // token index, used for error reporting @@ -250,7 +250,7 @@ public: void parseSignals(ClassDef *def); void parseProperty(ClassDef *def); void parsePluginData(ClassDef *def); - void createPropertyDef(PropertyDef &def); + void createPropertyDef(PropertyDef &def, int propertyIndex); void parsePropertyAttributes(PropertyDef &propDef); void parseEnumOrFlag(BaseDef *def, bool isFlag); void parseFlag(BaseDef *def); diff --git a/tools/qscxmlc/moc_patches/generator.cpp.patch b/tools/qscxmlc/moc_patches/generator.cpp.patch index 45493ac..a9da0f7 100644 --- a/tools/qscxmlc/moc_patches/generator.cpp.patch +++ b/tools/qscxmlc/moc_patches/generator.cpp.patch @@ -1,16 +1,7 @@ ---- .upstream/generator.cpp 2021-01-20 17:08:05.000000000 +0200 -+++ generator.cpp 2021-03-19 15:52:02.000000000 +0200 -@@ -5,7 +5,7 @@ - ** Copyright (C) 2018 Intel Corporation. - ** Contact: https://www.qt.io/licensing/ - ** --** This file is part of the tools applications of the Qt Toolkit. -+** This file is part of the QtScxml module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** Commercial License Usage -@@ -29,7 +29,9 @@ - ****************************************************************************/ +--- .upstream/generator.cpp 2023-02-02 09:58:24.431073637 +0100 ++++ generator.cpp 2023-02-02 12:55:41.000517603 +0100 +@@ -4,7 +4,9 @@ + // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "generator.h" +#if 0 // -- QtScxml @@ -19,7 +10,7 @@ #include "outputrevision.h" #include "utils.h" #include <QtCore/qmetatype.h> -@@ -48,6 +50,29 @@ +@@ -23,6 +25,29 @@ QT_BEGIN_NAMESPACE @@ -49,7 +40,7 @@ uint nameToBuiltinType(const QByteArray &name) { if (name.isEmpty()) -@@ -80,20 +105,23 @@ +@@ -55,20 +80,23 @@ return nullptr; } @@ -86,92 +77,50 @@ static inline int lengthOfEscapeSequence(const QByteArray &s, int i) { -@@ -254,12 +282,16 @@ - stringDataLength += thisLength; - if (stringDataLength / constCharArraySizeLimit) { - // save previous stringdata and start computing the next one. -- fprintf(out, " char stringdata%d[%d];\n", stringDataCounter++, stringDataLength - thisLength); -+// -- QtScxml -+ fprintf(out, " unsigned char stringdata%d[%d];\n", stringDataCounter++, -+ stringDataLength - thisLength); -+// -- QtScxml - stringDataLength = thisLength; - } - } -- fprintf(out, " char stringdata%d[%d];\n", stringDataCounter, stringDataLength); -- +@@ -108,7 +136,7 @@ + + // Prints \a s to \a out, breaking it into lines of at most ColumnWidth. The + // opening and closing quotes are NOT included (it's up to the caller). +-static void printStringWithIndentation(FILE *out, const QByteArray &s) ++static void printStringWithIndentation(QIODevice &out, const QByteArray &s) // -- QtScxml + { + static constexpr int ColumnWidth = 72; + int len = s.size(); +@@ -302,7 +330,9 @@ + fprintf(out, " uint offsetsAndSizes[%d];\n", int(strings.size() * 2)); + for (int i = 0; i < strings.size(); ++i) { + int thisLength = lengthOfEscapedString(strings.at(i)) + 1; +- fprintf(out, " char stringdata%d[%d];\n", i, thisLength); +// -- QtScxml -+ fprintf(out, " unsigned char stringdata%d[%d];\n", stringDataCounter, stringDataLength); ++ fprintf(out, " unsigned char stringdata%d[%d];\n", i, thisLength); +// -- QtScxml } fprintf(out, "};\n"); -@@ -293,56 +325,24 @@ - } - } - } -- fprintf(out, "\n },\n"); -+ fprintf(out, " },{\n"); // -- QtScxml - } - +@@ -333,10 +363,19 @@ // - // Build stringdata array + // Build stringdata arrays // -- fprintf(out, " \""); -- int col = 0; -- int len = 0; -- int stringDataLength = 0; +- for (const QByteArray &s : std::as_const(strings)) { +- fputc(',', out); +- printStringWithIndentation(out, s); +// -- QtScxml - for (int i = 0; i < strings.size(); ++i) { - QByteArray s = strings.at(i); -- len = s.length(); -- stringDataLength += len + 1; -- if (stringDataLength >= constCharArraySizeLimit) { -- fprintf(out, "\",\n \""); -- stringDataLength = len + 1; -- col = 0; -- } else if (i) -- fputs("\\0", out); // add \0 at the end of each string -- -- if (col && col + len >= 72) { -- fprintf(out, "\"\n \""); -- col = 0; -- } else if (len && s.at(0) >= '0' && s.at(0) <= '9') { -- fprintf(out, "\"\""); -- len += 2; -- } -- int idx = 0; -- while (idx < s.length()) { -- if (idx > 0) { -- col = 0; -- fprintf(out, "\"\n \""); -- } -- int spanLen = qMin(70, s.length() - idx); -- // don't cut escape sequences at the end of a line -- int backSlashPos = s.lastIndexOf('\\', idx + spanLen - 1); -- if (backSlashPos >= idx) { -- int escapeLen = lengthOfEscapeSequence(s, backSlashPos); -- spanLen = qBound(spanLen, backSlashPos + escapeLen - idx, s.length() - idx); -- } -- fprintf(out, "%.*s", spanLen, s.constData() + idx); -- idx += spanLen; -- col += spanLen; -- } -- col += len + 2; -+ int len = s.length(); -+ for (int charPos = 0; charPos < len; ++charPos) ++ for (qsizetype i = 0, end = strings.size(); i < end; ++i) { ++ if (i == 0) ++ fprintf(out, ","); ++ fprintf(out, "\n {"); ++ const QByteArray s = strings.at(i); ++ const qsizetype len = s.size(); ++ for (qsizetype charPos = 0; charPos < len; ++charPos) + fprintf(out, "0x%.2x,", static_cast<quint8>(s.at(charPos))); -+ fprintf(out, "0%s // %d: %s\n", i < strings.size() - 1 ? "," : "", i, s.constData()); ++ const bool isLast = (i == end - 1); ++ fprintf(out, "0%s // %d: %s", isLast ? "}" : "},", i, s.constData()); } +// -- QtScxml // Terminate stringdata struct -- fprintf(out, "\"\n};\n"); -+ fprintf(out, " }};\n"); // -- QtScxml - fprintf(out, "#undef QT_MOC_LITERAL\n\n"); - - // -@@ -633,9 +633,12 @@ + fprintf(out, "\n};\n"); +@@ -631,9 +670,12 @@ // fprintf(out, "\nvoid *%s::qt_metacast(const char *_clname)\n{\n", cdef->qualified.constData()); fprintf(out, " if (!_clname) return nullptr;\n"); @@ -182,12 +131,12 @@ + fprintf(out, " if (!strcmp(_clname, reinterpret_cast<const char *>(\n" + " qt_meta_stringdata_%s.stringdata0)))\n" + " return static_cast<void*>(const_cast< %s*>(this));\n", -+ qualifiedClassNameIdentifier.constData(), qualifiedClassNameIdentifier.constData()); ++ qualifiedClassNameIdentifier.constData(), cdef->qualified.constData()); +// -- QtScxml for (int i = 1; i < cdef->superclassList.size(); ++i) { // for all superclasses but the first one if (cdef->superclassList.at(i).second == FunctionDef::Private) continue; -@@ -674,7 +677,9 @@ +@@ -672,7 +714,9 @@ // // Generate plugin meta data // @@ -197,7 +146,7 @@ // // Generate function to make sure the non-class signals exist in the parent classes -@@ -1129,6 +1134,13 @@ +@@ -1142,6 +1186,13 @@ const FunctionDef &f = methodList.at(methodindex); Q_ASSERT(!f.normalizedType.isEmpty()); fprintf(out, " case %d: ", methodindex); @@ -211,7 +160,7 @@ if (f.normalizedType != "void") fprintf(out, "{ %s _r = ", noRef(f.normalizedType).constData()); fprintf(out, "_t->"); -@@ -1206,6 +1218,10 @@ +@@ -1219,6 +1270,10 @@ const FunctionDef &f = cdef->signalList.at(methodindex); if (f.wasCloned || !f.inPrivateClass.isEmpty() || f.isStatic) continue; @@ -222,19 +171,18 @@ anythingUsed = true; fprintf(out, " {\n"); fprintf(out, " using _t = %s (%s::*)(",f.type.rawName.constData() , cdef->classname.constData()); -@@ -1227,7 +1243,8 @@ +@@ -1240,7 +1295,7 @@ else fprintf(out, ");\n"); - fprintf(out, " if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&%s::%s)) {\n", + fprintf(out, " if (_t _q_method = &%s::%s; *reinterpret_cast<_t *>(_a[1]) == _q_method) {\n", - cdef->classname.constData(), f.name.constData()); -+ cdef->classname.constData(), -+ f.mangledName.constData()); // -- QtScxml ++ cdef->classname.constData(), f.mangledName.constData()); // -- QtScxml fprintf(out, " *result = %d;\n", methodindex); fprintf(out, " return;\n"); fprintf(out, " }\n }\n"); -@@ -1322,8 +1339,11 @@ - fprintf(out, " case %d: *reinterpret_cast<int*>(_v) = QFlag(%s%s()); break;\n", - propindex, prefix.constData(), p.read.constData()); +@@ -1336,8 +1391,11 @@ + fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s%s().value(); break;\n", + propindex, p.type.constData(), prefix.constData(), p.bind.constData()); else if (!p.read.isEmpty()) - fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s%s(); break;\n", - propindex, p.type.constData(), prefix.constData(), p.read.constData()); @@ -246,7 +194,7 @@ else fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s%s; break;\n", propindex, p.type.constData(), prefix.constData(), p.member.constData()); -@@ -1443,6 +1463,10 @@ +@@ -1469,6 +1527,10 @@ { if (def->wasCloned || def->isAbstract) return; @@ -257,7 +205,7 @@ fprintf(out, "\n// SIGNAL %d\n%s %s::%s(", index, def->type.name.constData(), cdef->qualified.constData(), def->name.constData()); -@@ -1489,10 +1513,8 @@ +@@ -1515,10 +1577,8 @@ if (def->normalizedType == "void") { fprintf(out, "nullptr"); } else { @@ -270,7 +218,7 @@ } int i; for (i = 1; i < offset; ++i) -@@ -1507,6 +1529,36 @@ +@@ -1533,6 +1593,36 @@ fprintf(out, "}\n"); } @@ -307,7 +255,7 @@ static CborError jsonValueToCbor(CborEncoder *parent, const QJsonValue &v); static CborError jsonObjectToCbor(CborEncoder *parent, const QJsonObject &o) { -@@ -1629,7 +1681,11 @@ +@@ -1668,7 +1758,11 @@ #define CBOR_ENCODER_WRITER_CONTROL 1 #define CBOR_ENCODER_WRITE_FUNCTION CborDevice::callback diff --git a/tools/qscxmlc/moc_patches/generator.h.patch b/tools/qscxmlc/moc_patches/generator.h.patch index 8f4b5b4..fb6c117 100644 --- a/tools/qscxmlc/moc_patches/generator.h.patch +++ b/tools/qscxmlc/moc_patches/generator.h.patch @@ -1,15 +1,6 @@ ---- .upstream/generator.h 2021-01-20 17:08:05.000000000 +0200 -+++ generator.h 2021-03-19 15:52:02.000000000 +0200 -@@ -3,7 +3,7 @@ - ** 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. -+** This file is part of the QtScxml module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** Commercial License Usage -@@ -31,20 +31,33 @@ +--- .upstream/generator.h 2022-07-14 10:20:51.543950028 +0200 ++++ generator.h 2023-02-02 10:46:55.601993965 +0100 +@@ -6,20 +6,33 @@ #include "moc.h" @@ -45,7 +36,7 @@ private: bool registerableMetaType(const QByteArray &propertyType); void registerClassInfoStrings(); -@@ -63,7 +76,10 @@ +@@ -38,7 +51,10 @@ void generateMetacall(); void generateStaticMetacall(); void generateSignal(FunctionDef *def, int index); diff --git a/tools/qscxmlc/moc_patches/moc.h.patch b/tools/qscxmlc/moc_patches/moc.h.patch index 4eb3191..eda5d3e 100644 --- a/tools/qscxmlc/moc_patches/moc.h.patch +++ b/tools/qscxmlc/moc_patches/moc.h.patch @@ -1,15 +1,6 @@ ---- .upstream/moc.h 2021-03-18 12:30:56.000000000 +0200 -+++ moc.h 2021-03-19 15:59:05.000000000 +0200 -@@ -3,7 +3,7 @@ - ** 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. -+** This file is part of the QtScxml module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** Commercial License Usage -@@ -29,15 +29,13 @@ +--- .upstream/moc.h 2022-12-22 11:12:45.832773413 +0100 ++++ moc.h 2023-02-02 11:05:36.004931550 +0100 +@@ -4,15 +4,12 @@ #ifndef MOC_H #define MOC_H @@ -28,11 +19,10 @@ +#include <QtCore/qjsondocument.h> +#include <QtCore/qjsonarray.h> +// -- QtScxml -+ - #include <ctype.h> - QT_BEGIN_NAMESPACE -@@ -48,16 +46,18 @@ + #include <private/qtools_p.h> + +@@ -24,16 +21,18 @@ { enum ReferenceType { NoReference, Reference, RValueReference, Pointer }; @@ -53,7 +43,7 @@ ReferenceType referenceType; }; Q_DECLARE_TYPEINFO(Type, Q_RELOCATABLE_TYPE); -@@ -105,8 +105,9 @@ +@@ -81,8 +80,9 @@ bool inlineCode = false; bool wasCloned = false; @@ -64,7 +54,7 @@ bool isCompat = false; bool isInvokable = false; bool isScriptable = false; -@@ -120,6 +121,11 @@ +@@ -96,6 +96,11 @@ QJsonObject toJson() const; static void accessToJson(QJsonObject *obj, Access acs); @@ -76,7 +66,7 @@ }; Q_DECLARE_TYPEINFO(FunctionDef, Q_RELOCATABLE_TYPE); -@@ -144,6 +150,10 @@ +@@ -121,6 +126,10 @@ int location = -1; // token index, used for error reporting QJsonObject toJson() const; @@ -87,7 +77,7 @@ }; Q_DECLARE_TYPEINFO(PropertyDef, Q_RELOCATABLE_TYPE); -@@ -217,6 +227,7 @@ +@@ -194,6 +203,7 @@ }; Q_DECLARE_TYPEINFO(NamespaceDef, Q_RELOCATABLE_TYPE); @@ -95,7 +85,7 @@ class Moc : public Parser { public: -@@ -295,6 +306,7 @@ +@@ -272,6 +282,7 @@ void checkSuperClasses(ClassDef *def); void checkProperties(ClassDef* cdef); }; diff --git a/tools/qscxmlc/moc_patches/outputrevision.h.patch b/tools/qscxmlc/moc_patches/outputrevision.h.patch index 4defacc..6f6daff 100644 --- a/tools/qscxmlc/moc_patches/outputrevision.h.patch +++ b/tools/qscxmlc/moc_patches/outputrevision.h.patch @@ -1,15 +1,6 @@ ---- .upstream/outputrevision.h 2021-01-20 17:08:05.000000000 +0200 -+++ outputrevision.h 2021-03-19 15:52:02.000000000 +0200 -@@ -3,7 +3,7 @@ - ** 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. -+** This file is part of the QtScxml module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** Commercial License Usage -@@ -29,7 +29,13 @@ +--- .upstream/outputrevision.h 2022-07-14 10:20:51.543950028 +0200 ++++ outputrevision.h 2023-02-02 10:46:55.593994063 +0100 +@@ -4,7 +4,13 @@ #ifndef OUTPUTREVISION_H #define OUTPUTREVISION_H |