QMetaType: suppress non-conversion content in convert()

Many of the conversions are implemented by macros and may include
conversion from a type to itself. We never call the convert() function
with those parameters, so that code can be safely suppressed.

Change-Id: I31904243ae8f750a3002fffd85f944305f0eee6b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 3e1d147986cfbce0da7cd0623aad5c1351642bc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2025-03-17 11:17:24 -07:00 committed by Qt Cherry-pick Bot
parent a833d93f59
commit 2d34d2ae9b

View File

@ -22,6 +22,8 @@ QT_BEGIN_NAMESPACE
#define QMETATYPE_CONVERTER(To, From, assign_and_return) \ #define QMETATYPE_CONVERTER(To, From, assign_and_return) \
case makePair(QMetaType::To, QMetaType::From): \ case makePair(QMetaType::To, QMetaType::From): \
if constexpr (QMetaType::To == QMetaType::From) \
Q_UNREACHABLE(); /* can never get here */ \
if (onlyCheck) \ if (onlyCheck) \
return true; \ return true; \
{ \ { \