From a133aaf3a841f451a277587cccf578fc624a6054 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 5 May 2019 05:12:16 +0000 Subject: [PATCH] apply upstream commits https://github.com/qt/qtbase/commit/c619fc278d7e5acd8f0ae8f9e2013f351c50c355 and https://github.com/qt/qtbase/commit/4dcd9145e74dfb8c59016cf0011987cdeb6b3576 Signed-off-by: Ivailo Monev --- src/tools/moc/generator.cpp | 7 +++---- src/tools/moc/moc.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index ebfe4fa27..8556207f9 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -375,8 +375,8 @@ void Generator::generateCode() if (cdef->superclassList.at(i).second == FunctionDef::Private) continue; const char *cname = cdef->superclassList.at(i).first.constData(); - fprintf(out, " if (!strcmp(_clname, \"%s\"))\n return static_cast< %s*>(const_cast< %s*>(this));\n", - cname, cname, cdef->classname.constData()); + fprintf(out, " if (!strcmp(_clname, \"%s\"))\n return static_cast< %s*>(this);\n", + cname, cdef->classname.constData()); } for (int i = 0; i < cdef->interfaceList.size(); ++i) { const QList &iface = cdef->interfaceList.at(i); @@ -384,8 +384,7 @@ void Generator::generateCode() fprintf(out, " if (!strcmp(_clname, %s))\n return ", iface.at(j).interfaceId.constData()); for (int k = j; k >= 0; --k) fprintf(out, "static_cast< %s*>(", iface.at(k).className.constData()); - fprintf(out, "const_cast< %s*>(this)%s;\n", - cdef->classname.constData(), QByteArray(j+1, ')').constData()); + fprintf(out, "this%s;\n", QByteArray(j+1, ')').constData()); } } if (!purestSuperClass.isEmpty() && !isQObject) { diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 1fa300808..d809dbd6f 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -364,8 +364,8 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) def->isVirtual = false; def->isStatic = false; //skip modifiers and attributes - while (test(INLINE) || (test(STATIC) && (def->isStatic = true)) || - (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual + while (test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) || + (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual || testFunctionAttribute(def) || testFunctionRevision(def)) {} bool templateFunction = (lookup() == TEMPLATE); def->type = parseType(); @@ -456,8 +456,8 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def) def->isVirtual = false; def->isStatic = false; //skip modifiers and attributes - while (test(EXPLICIT) || test(INLINE) || (test(STATIC) && (def->isStatic = true)) || - (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual + while (test(EXPLICIT) || test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) || + (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual || testFunctionAttribute(def) || testFunctionRevision(def)) {} bool tilde = test(TILDE); def->type = parseType(); -- 2.11.0