summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Lemanissier <eric.lemanissier@gmail.com>2017-09-26 11:45:56 +0200
committerEric Lemanissier <eric.lemanissier@gmail.com>2017-09-27 07:04:02 +0000
commit3d0fa4d4fb870450f6e77d7248db91984ddf8b50 (patch)
tree8445cd4b65e33b9b5bb79cf6d3e469b355dcbc29 /src
parent33693473d4bf6b28bee2d5fe740633d6867c26af (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/tools/moc/generator.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 6795e3b2cf..7e1ec3522f 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -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;
}