diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2016-03-08 11:07:53 +0100 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2016-04-06 14:36:48 +0000 |
commit | 6c54e10144e7af02f4c35e20e5f375a0cf280b8b (patch) | |
tree | 7f3e0fb6958e7e5ae85f377650b306522d73b92a /src/corelib/global | |
parent | 58c23ae1619fb4afaae9c8eb2527c0906baef97b (diff) |
Qt Meta macros: Allow tools to define annotations
This might be useful for IDE or other tools to be made aware of Qt macros.
This is inspired to what QtCreator[1] and moc-ng[2] does. But they are forced
to redefine or inject code at precise location which might be difficult.
This is going to make it easier to use libclang in qdoc.
With this change, the tooling can just predefine the macro QT_ANNOTATE_FUNCTION
and QT_ANNOTATE_CLASS to get what they need.
Example with libclang:
"-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__),#type);"
"-DQT_ANNOTATE_CLASS2(type,a1,a2)=static_assert(sizeof(#a1,#a2),#type);"
"-DQT_ANNOTATE_FUNCTION(a)=__attribute__((annotate(#a)))"
"-DQT_ANNOTATE_ACCESS_SPECIFIER(a)=__attribute__((annotate(#a)))"
"-DQ_CLASSINFO(name,value)=static_assert(sizeof(name,value),\"qt_classinfo\");"
"-DQ_REVISION(v)=__attribute__((annotate(\"qt_revision:\" QT_STRINGIFY2(v))))"
[1] qt-creator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h
[2] https://code.woboq.org/mocng/src/qobjectdefs-injected.h.html
Change-Id: I88fcb28f1dbb3d26ea82f10e9948e68a18c795e9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qglobal.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 2551dcb5d3..98c9902674 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1050,8 +1050,6 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); #endif // QT_NO_TRANSLATION -#define QDOC_PROPERTY(text) - /* When RTTI is not available, define this macro to force any uses of dynamic_cast to cause a compile failure. |