diff options
author | Marc Mutz <marc.mutz@qt.io> | 2021-11-22 10:30:04 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2021-11-27 01:25:10 +0100 |
commit | a0f9aef11bd3a692f9fa9c6069ca27200ef82893 (patch) | |
tree | 9b66bf55c56edabced026fe32f9a15ec1b361cb2 /qmake | |
parent | cf2336ae6e9b0dd0db9369d0a0bfaf9ecf393cf9 (diff) | |
download | qtbase-a0f9aef11bd3a692f9fa9c6069ca27200ef82893.tar.gz |
Long live Q_GADGET_EXPORT!
Like Q_NAMESPACE_EXPORT for Q_NAMESPACE, this variant of Q_GADGET
allows passing an export macro. This is useful to avoid exporting the
whole class just to get the staticMetaObject hidden therein exported.
Before anyone asks: No, we don't need Q_OBJECT_EXPORT, because QObject
subclasses, being polymorphic, always need to have a class-level
export macro (to export their vtable), but while that technique also
works for value classes (the Q_GADGET audience), it is not desirable
for them, because it makes inline functions exported in Windows debug
builds, which is not what we want, because it needlessly restricts
what you can to with the inline functions (e.g. remove).
[ChangeLog][QtCore] Added the Q_GADGET_EXPORT macro, which is like
Q_GADGET, but allows passing an export macro (like Q_NAMESPACE_EXPORT
for Q_NAMESPACE).
Fixes: QTBUG-55458
Change-Id: I546297de1e8aa45d83381991bcd3fbca61e1eef0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/makefiledeps.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index cf17ecf0d7..81bf6ac744 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -927,6 +927,7 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) enum Keywords { Q_OBJECT_Keyword, Q_GADGET_Keyword, + Q_GADGET_EXPORT_Keyword, Q_NAMESPACE_Keyword, Q_NAMESPACE_EXPORT_Keyword, @@ -935,12 +936,14 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) static const char keywords[][19] = { "Q_OBJECT", "Q_GADGET", + "Q_GADGET_EXPORT", "Q_NAMESPACE", "Q_NAMESPACE_EXPORT", }; static_assert(std::size(keywords) == NumKeywords); bool ignore[NumKeywords] = {}; /* qmake ignore Q_GADGET */ + /* qmake ignore Q_GADGET_EXPORT */ /* qmake ignore Q_OBJECT */ /* qmake ignore Q_NAMESPACE */ /* qmake ignore Q_NAMESPACE_EXPORT */ |