From 4ca0d764546908dd31fc3794ddcead5582436097 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Jan 2018 12:19:33 +0100 Subject: [PATCH] doc: clang-qdoc must not see certain function declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The macro Q_DECLARE_INTERFACE declared some qobject_cast() functions that clang-qdoc must not see in the contexts where the macro is used. This update prevents that from happening by ensuring that Q_CLANG_QDOC is not defined when the macro is defined. This update also adds a \fn command for a declaration of qobject_cast() that was missing in the documentation. There are two versions of the function, one with a const parameter and one with a non-const parameter, and they both share one qdoc comment. Change-Id: Ic74d0aaae62767cd0391474ee95ae3f4f820b06e Reviewed-by: Topi Reiniƶ --- src/corelib/kernel/qobject.cpp | 4 +++- src/corelib/kernel/qobject.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index dc43a95675..5b37945ae0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1093,7 +1093,9 @@ QObjectPrivate::Connection::~Connection() \sa metaObject() */ -/*! \fn template T *qobject_cast(QObject *object) +/*! + \fn template T qobject_cast(QObject *object) + \fn template T qobject_cast(const QObject *object) \relates QObject Returns the given \a object cast to type T if the object is of type diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 9f38a6ef87..0e608a3208 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -517,7 +517,7 @@ inline T qobject_cast(const QObject *object) template inline const char * qobject_interface_iid() { return nullptr; } -#ifndef Q_MOC_RUN +#if !defined(Q_MOC_RUN) && !defined(Q_CLANG_QDOC) # define Q_DECLARE_INTERFACE(IFace, IId) \ template <> inline const char *qobject_interface_iid() \ { return IId; } \