summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/moc.cpp
diff options
context:
space:
mode:
authorMate Barany <mate.barany@qt.io>2022-06-20 14:26:38 +0200
committerMate Barany <mate.barany@qt.io>2022-06-22 00:08:34 +0200
commitb9b5734559774d7fe571b94fda7896e4806707f4 (patch)
treee92eed8d9c87c07a83999ad11ff7f5aa5d7bc65e /src/tools/moc/moc.cpp
parent0c82d6a75a19183658eeabf6eda7f2e8ad292e37 (diff)
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>
Diffstat (limited to 'src/tools/moc/moc.cpp')
-rw-r--r--src/tools/moc/moc.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 550c1ac422..dc8fcbf8db 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -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) {