moc: remove useless cast in qt_static_metacall generated code
_a[1] was reinterpret_casted twice in a row, which triggers clang's warning undefined-reinterpret-cast: "dereference of type '_t *' (aka ...) that was reinterpret_cast from type 'void **' has undefined behavior " only the last reinterpret_cast is kept Change-Id: I71d52c5ff08c674003aec29f8a907c90905c0d4c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
33693473d4
commit
3d0fa4d4fb
@ -1237,7 +1237,6 @@ void Generator::generateStaticMetacall()
|
||||
Q_ASSERT(needElse); // if there is signal, there was method.
|
||||
fprintf(out, " else if (_c == QMetaObject::IndexOfMethod) {\n");
|
||||
fprintf(out, " int *result = reinterpret_cast<int *>(_a[0]);\n");
|
||||
fprintf(out, " void **func = reinterpret_cast<void **>(_a[1]);\n");
|
||||
bool anythingUsed = false;
|
||||
for (int methodindex = 0; methodindex < cdef->signalList.size(); ++methodindex) {
|
||||
const FunctionDef &f = cdef->signalList.at(methodindex);
|
||||
@ -1263,14 +1262,14 @@ void Generator::generateStaticMetacall()
|
||||
fprintf(out, ") const;\n");
|
||||
else
|
||||
fprintf(out, ");\n");
|
||||
fprintf(out, " if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&%s::%s)) {\n",
|
||||
fprintf(out, " if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&%s::%s)) {\n",
|
||||
cdef->classname.constData(), f.name.constData());
|
||||
fprintf(out, " *result = %d;\n", methodindex);
|
||||
fprintf(out, " return;\n");
|
||||
fprintf(out, " }\n }\n");
|
||||
}
|
||||
if (!anythingUsed)
|
||||
fprintf(out, " Q_UNUSED(result);\n Q_UNUSED(func);\n");
|
||||
fprintf(out, " Q_UNUSED(result);\n");
|
||||
fprintf(out, " }");
|
||||
needElse = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user