qt.cfg: Add some missing macro definitions (#2175)

Found by daca@home
This commit is contained in:
Sebastian 2019-09-16 15:58:35 +02:00 committed by GitHub
parent 2b846461c8
commit fbbaea3cd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -4618,9 +4618,11 @@
<define name="Q_DECL_IMPORT" value=""/>
<define name="QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context)" value="static inline QString trUtf8(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) { return QCoreApplication::translate(#context, sourceText, disambiguation, n); }"/>
<define name="Q_DECLARE_FLAGS(x,y)" value=""/>
<define name="Q_DECLARE_LOGGING_CATEGORY(name)" value="extern const QLoggingCategory &amp;name();"/>
<define name="Q_DECLARE_OPERATORS_FOR_FLAGS(x)" value=""/>
<define name="Q_DECLARE_METATYPE(x)" value=""/>
<define name="Q_DECLARE_PRIVATE(Class)" value="inline Class##Private* d_func() { return reinterpret_cast&lt;Class##Private*&gt;(qGetPtrHelper(d_ptr)); } inline const Class##Private d_func() const { return reinterpret_cast&lt;const Class##Private *&gt;(qGetPtrHelper(d_ptr)); } friend class Class##Private;"/>
<define name="Q_DECLARE_PRIVATE_D(Dptr, Class)" value="inline Class##Private* d_func() { return reinterpret_cast&lt;Class##Private *&gt;(qGetPtrHelper(Dptr)); } inline const Class##Private* d_func() const { return reinterpret_cast&lt;const Class##Private *&gt;(qGetPtrHelper(Dptr)); } friend class Class##Private;"/>
<define name="Q_DECLARE_PUBLIC(Class)" value="inline Class##Public* d_func() { return reinterpret_cast&lt;Class##Public*&gt;(qGetPtrHelper(d_ptr)); } inline const Class##Public d_func() const { return reinterpret_cast&lt;const Class##Public *&gt;(qGetPtrHelper(d_ptr)); } friend class Class##Public;"/>
<define name="Q_DECLARE_TR_FUNCTIONS(context)" value="public: static inline QString tr(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) private:"/>
<define name="Q_DISABLE_COPY(C)" value="C(C&amp;);C&amp; operator=(const C&amp;);"/>
@ -4632,6 +4634,7 @@
<define name="Q_LIKELY(expr)" value="expr"/>
<define name="Q_NULLPTR" value="NULL"/>
<define name="Q_OBJECT" value=""/>
<define name="Q_PRIVATE_SLOT(d, signature)" value=""/>
<define name="Q_PROPERTY(X)" value=""/>
<define name="Q_Q(Class)" value="Class * const q = q_func()"/>
<define name="Q_RETURN_ARG(type, data)" value="QReturnArgument&lt;type &gt;(#type, data)"/>
@ -4673,6 +4676,8 @@
<define name="QTC_CHECK(cond)" value="if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); } do {} while (0)"/>
<define name="QTC_GUARD(cond)" value="((Q_LIKELY(cond)) ? true : (QTC_ASSERT_STRING(#cond), false))"/>
<define name="Q_LOGGING_CATEGORY(name,...)" value=""/>
<define name="QT_FORWARD_DECLARE_CLASS(name)" value="class name;"/>
<define name="QT_FORWARD_DECLARE_STRUCT(name)" value="struct name;"/>
<!-- https://doc.qt.io/qt-5/qstring.html#QStringLiteral -->
<define name="QStringLiteral(str)" value="QString::fromUtf8(str, sizeof(str) - 1)"/>
<!-- https://doc.qt.io/qt-5/qtglobal.html#qreal-typedef -->

View File

@ -18,6 +18,7 @@
#include <QFile>
#include <cstdio>
#include <QCoreApplication>
#include <QLoggingCategory>
void QString1(QString s)
@ -399,6 +400,10 @@ void validCode(int * pIntPtr)
if (Q_UNLIKELY(!pIntPtr)) {}
printf(QT_TR_NOOP("Hi"));
Q_DECLARE_LOGGING_CATEGORY(logging_category_test);
QT_FORWARD_DECLARE_CLASS(forwardDeclaredClass);
QT_FORWARD_DECLARE_STRUCT(forwardDeclaredStruct);
}
void ignoredReturnValue()