From d908ba2765cc7aef05832c8c442df6c1bf921820 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 16 Dec 2016 12:51:38 -0800 Subject: [PATCH] Remove HarryF's "compiler error feature" that isn't used anymore The "qYouForgotTheQ_OBJECT_Macro" function hasn't been used in qobject_cast since commit 7d7e8ae3fa79b06c916de1a7a10eed63611c5d25 (Qt 5.2), when Olivier made the error use Q_STATIC_ASSERT instead. Change-Id: I15b62e0f9cec482fbb40fffd1490d7c050084369 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobjectdefs.h | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 5cdbef443b..f577c6d4b8 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -147,34 +147,8 @@ class QString; # define QT_TR_FUNCTIONS #endif -#if defined(QT_NO_QOBJECT_CHECK) -/* qmake ignore Q_OBJECT */ -#define Q_OBJECT_CHECK -#else - -/* This is a compile time check that ensures that any class cast with qobject_cast - actually contains a Q_OBJECT macro. Note: qobject_cast will fail if a QObject - subclass doesn't contain Q_OBJECT. - - In qt_check_for_QOBJECT_macro, we call a dummy templated function with two - parameters, the first being "this" and the other the target of the qobject - cast. If the types are not identical, we know that a Q_OBJECT macro is missing. - - If you get a compiler error here, make sure that the class you are casting - to contains a Q_OBJECT macro. -*/ - -/* qmake ignore Q_OBJECT */ -#define Q_OBJECT_CHECK \ - template inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const \ - { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } - -template -inline int qYouForgotTheQ_OBJECT_Macro(T, T) { return 0; } - -template -inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} -#endif // QT_NO_QOBJECT_CHECK +// ### Qt6: remove +#define Q_OBJECT_CHECK /* empty, unused since Qt 5.2 */ #if defined(Q_CC_INTEL) // Cannot redefine the visibility of a method in an exported class @@ -200,7 +174,6 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} /* qmake ignore Q_OBJECT */ #define Q_OBJECT \ public: \ - Q_OBJECT_CHECK \ QT_WARNING_PUSH \ Q_OBJECT_NO_OVERRIDE_WARNING \ static const QMetaObject staticMetaObject; \