summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobjectdefs.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-12-17 18:59:17 -0800
committerThiago Macieira <thiago.macieira@intel.com>2014-12-20 07:38:21 +0100
commit3092bd56c394f22e027be59368789546afb5ca98 (patch)
tree2fa6824f25630efe3004a6226641e2307ce0f1d2 /src/corelib/kernel/qobjectdefs.h
parent2e4b1a8334d4de585e90637c070ba9832a0608f1 (diff)
Fix Clang warning about inconsistent use of C++11 override
We cannot use override in the Q_OBJECT macro, so tell Clang not to warn about our lack of use of the keyword in the three virtuals that Q_OBJECT overrides when the user uses Q_DECL_OVERRIDE in their own functions. We can't use Q_DECL_OVERRIDE for two reasons: 1) because that would trigger the warning in any and all virtual overrides the user may have in their own class (and most of Qt) 2) because when Q_OBJECT is used in QObject, it's not overriding anything -- it's the base declaration For #2, we could add a different macro exclusively for QObject that moc would expand, but it's unnecessary work. Change-Id: Ic9cb7896f93f06f4e86b6a42dc08f96d257f7550 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qobjectdefs.h')
-rw-r--r--src/corelib/kernel/qobjectdefs.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index a495bce7ec..84e7a65a54 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -138,15 +138,24 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
# define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN
#endif
+#if defined(Q_CC_CLANG) && Q_CC_CLANG >= 306
+# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override")
+#else
+# define Q_OBJECT_NO_OVERRIDE_WARNING
+#endif
+
/* qmake ignore Q_OBJECT */
#define Q_OBJECT \
public: \
Q_OBJECT_CHECK \
+ QT_WARNING_PUSH \
+ Q_OBJECT_NO_OVERRIDE_WARNING \
static const QMetaObject staticMetaObject; \
virtual const QMetaObject *metaObject() const; \
virtual void *qt_metacast(const char *); \
- QT_TR_FUNCTIONS \
virtual int qt_metacall(QMetaObject::Call, int, void **); \
+ QT_WARNING_POP \
+ QT_TR_FUNCTIONS \
private: \
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
struct QPrivateSignal {};