Generator: Fix shadowing using declaration
Generated moc files contain `using` which shadows the previous `_t` in the `qt_static_metacall` function. To fix this rename the `using _t`. Example.: In file included from /home/jonas/Projects/strawberry/build-qt6dev/src/mpris2_player.cpp:217: /home/jonas/Projects/strawberry/build-qt6dev/src/moc_mpris2_player.cpp: In static member function ‘static void Mpris2Player::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)’: /home/jonas/Projects/strawberry/build-qt6dev/src/moc_mpris2_player.cpp:266:19: warning: declaration of ‘using _t = void (class Mpris2Player::*)(qlonglong)’ shadows a previous local [-Wshadow] 266 | using _t = void (Mpris2Player::*)(qlonglong ); | ^~ /home/jonas/Projects/strawberry/build-qt6dev/src/moc_mpris2_player.cpp:247:11: note: shadowed declaration is here 247 | auto *_t = static_cast<Mpris2Player *>(_o); | ^~ Change-Id: I4a7d4e09ea599f3db97e21ae48599423f45885f5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 1a746e35ec5bef7f9ecf4d0fb7d8812523888d0c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
22a6dd8a66
commit
8688948a20
@ -1180,7 +1180,7 @@ void Generator::generateStaticMetacall()
|
||||
continue;
|
||||
anythingUsed = true;
|
||||
fprintf(out, " {\n");
|
||||
fprintf(out, " using _t = %s (%s::*)(",f.type.rawName.constData() , cdef->classname.constData());
|
||||
fprintf(out, " using _q_method_type = %s (%s::*)(",f.type.rawName.constData() , cdef->classname.constData());
|
||||
|
||||
const auto begin = f.arguments.cbegin();
|
||||
const auto end = f.arguments.cend();
|
||||
@ -1199,7 +1199,7 @@ void Generator::generateStaticMetacall()
|
||||
fprintf(out, ") const;\n");
|
||||
else
|
||||
fprintf(out, ");\n");
|
||||
fprintf(out, " if (_t _q_method = &%s::%s; *reinterpret_cast<_t *>(_a[1]) == _q_method) {\n",
|
||||
fprintf(out, " if (_q_method_type _q_method = &%s::%s; *reinterpret_cast<_q_method_type *>(_a[1]) == _q_method) {\n",
|
||||
cdef->classname.constData(), f.name.constData());
|
||||
fprintf(out, " *result = %d;\n", methodindex);
|
||||
fprintf(out, " return;\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user