Disable useless-cast warning for moc generated code
The useless-cast gcc warning is disabled in the files generated by
the moc. A typical warning is like
using_t = void(Counter::*)(int );
if (*reinterpret_cast<_t*>(_a[1]) ==
static_cast<_t>(&Counter::valueChanged)) {
*result = 0;
return;
}
Removing the static cast results in a compilation error
"address of overloaded function with no contextual type-of
information" in moc_myobject.cpp files.
Checking whether we have an overload set or a single function
might be too much effort for too little benefit and may not worth
it.
Fixes: QTBUG-71938
Change-Id: I6f67e163a3493b51fb95f54218ce6bf9a302f824
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
bb10
parent
0c82d6a75a
commit
b9b5734559
|
|
@ -1107,6 +1107,7 @@ void Moc::generate(FILE *out, FILE *jsonOutput)
|
|||
fprintf(out, "QT_BEGIN_MOC_NAMESPACE\n");
|
||||
fprintf(out, "QT_WARNING_PUSH\n");
|
||||
fprintf(out, "QT_WARNING_DISABLE_DEPRECATED\n");
|
||||
fprintf(out, "QT_WARNING_DISABLE_GCC(\"-Wuseless-cast\")\n");
|
||||
|
||||
fputs("", out);
|
||||
for (i = 0; i < classList.size(); ++i) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue