qdbusxml2cpp: invert Q_DECL_DEPRECATED and inline in the output
Commit 93dad2bf91d414a41c6e2c7db6c75171b4917d4d (6.0) changed Q_DECL_DEPRECATED to use the [[deprecated]] attribute, which must appear before inline and other keywords. To keep it next to Q_NOREPLY, I also moved the "inline" into the next string. Added missing tests for both. Fixes: QTBUG-110979 Change-Id: I9671dee8ceb64aa9b9cafffd1741656e86f40453 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit f67b32e735cbbed6848b5d40a61329f71f54a14d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
8737086956
commit
310f666615
@ -606,13 +606,15 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
hs << " inline "
|
if (isDeprecated)
|
||||||
<< (isDeprecated ? "Q_DECL_DEPRECATED " : "");
|
hs << " Q_DECL_DEPRECATED ";
|
||||||
|
else
|
||||||
|
hs << " ";
|
||||||
|
|
||||||
if (isNoReply) {
|
if (isNoReply) {
|
||||||
hs << "Q_NOREPLY void ";
|
hs << "Q_NOREPLY inline void ";
|
||||||
} else {
|
} else {
|
||||||
hs << "QDBusPendingReply<";
|
hs << "inline QDBusPendingReply<";
|
||||||
for (qsizetype i = 0; i < method.outputArgs.size(); ++i)
|
for (qsizetype i = 0; i < method.outputArgs.size(); ++i)
|
||||||
hs << (i > 0 ? ", " : "")
|
hs << (i > 0 ? ", " : "")
|
||||||
<< templateArg(qtTypeName(method.outputArgs.at(i).name, method.outputArgs.at(i).type,
|
<< templateArg(qtTypeName(method.outputArgs.at(i).name, method.outputArgs.at(i).type,
|
||||||
@ -648,7 +650,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
|
|||||||
|
|
||||||
if (method.outputArgs.size() > 1) {
|
if (method.outputArgs.size() > 1) {
|
||||||
// generate the old-form QDBusReply methods with multiple incoming parameters
|
// generate the old-form QDBusReply methods with multiple incoming parameters
|
||||||
hs << " inline " << (isDeprecated ? "Q_DECL_DEPRECATED " : "") << "QDBusReply<"
|
hs << (isDeprecated ? " Q_DECL_DEPRECATED " : " ") << "inline QDBusReply<"
|
||||||
<< templateArg(qtTypeName(method.outputArgs.first().name, method.outputArgs.first().type,
|
<< templateArg(qtTypeName(method.outputArgs.first().name, method.outputArgs.first().type,
|
||||||
method.annotations, 0, "Out"))
|
method.annotations, 0, "Out"))
|
||||||
<< "> ";
|
<< "> ";
|
||||||
|
@ -240,6 +240,46 @@ void tst_qdbusxml2cpp::process_data()
|
|||||||
<< QRegularExpression("Q_SLOTS:.*QString Method\\(const QString &\\w*, const QString &\\w*, QString &",
|
<< QRegularExpression("Q_SLOTS:.*QString Method\\(const QString &\\w*, const QString &\\w*, QString &",
|
||||||
QRegularExpression::DotMatchesEverythingOption);
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
|
||||||
|
QTest::newRow("method-deprecated-0out")
|
||||||
|
<< "<method name=\"Method\">"
|
||||||
|
"<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>"
|
||||||
|
"</method>"
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*Q_DECL_DEPRECATED inline QDBusPendingReply<> Method\\(\\)",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption)
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*void Method\\(\\)",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
|
||||||
|
QTest::newRow("method-deprecated-2out")
|
||||||
|
<< "<method name=\"Method\">"
|
||||||
|
"<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>"
|
||||||
|
"<arg type=\"s\" direction=\"out\"/>"
|
||||||
|
"<arg type=\"s\" direction=\"out\"/>"
|
||||||
|
"</method>"
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*Q_DECL_DEPRECATED inline QDBusPendingReply<QString, QString> Method\\(\\)"
|
||||||
|
".*Q_DECL_DEPRECATED inline QDBusReply<QString> Method\\(QString &\\w*\\)",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption)
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*QString Method\\(QString &",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
|
||||||
|
QTest::newRow("method-noreply")
|
||||||
|
<< "<method name=\"Method\">"
|
||||||
|
"<annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>"
|
||||||
|
"</method>"
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*Q_NOREPLY inline void Method\\(\\).*\\bQDBus::NoBlock\\b",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption)
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*Q_NOREPLY void Method\\(",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
|
||||||
|
QTest::newRow("method-deprecated-noreply")
|
||||||
|
<< "<method name=\"Method\">"
|
||||||
|
"<annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>"
|
||||||
|
"<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>"
|
||||||
|
"</method>"
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*Q_DECL_DEPRECATED Q_NOREPLY inline void Method\\(\\).*\\bQDBus::NoBlock\\b",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption)
|
||||||
|
<< QRegularExpression("Q_SLOTS:.*Q_NOREPLY void Method\\(",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
|
||||||
// -- signals --
|
// -- signals --
|
||||||
for (int i = 0; i < basicTypeCount; ++i) {
|
for (int i = 0; i < basicTypeCount; ++i) {
|
||||||
QRegularExpression rx(QString("Q_SIGNALS:.*\\bvoid Signal\\((const )?%1\\b")
|
QRegularExpression rx(QString("Q_SIGNALS:.*\\bvoid Signal\\((const )?%1\\b")
|
||||||
@ -261,6 +301,15 @@ void tst_qdbusxml2cpp::process_data()
|
|||||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>"
|
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>"
|
||||||
</signal>)"
|
</signal>)"
|
||||||
<< rx << rx;
|
<< rx << rx;
|
||||||
|
|
||||||
|
QTest::newRow("signal-deprecated")
|
||||||
|
<< R"(<signal name="Signal">
|
||||||
|
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
|
||||||
|
</signal>)"
|
||||||
|
<< QRegularExpression(R"(Q_SIGNALS:.*\bQ_DECL_DEPRECATED void Signal\(\))",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption)
|
||||||
|
<< QRegularExpression(R"(Q_SIGNALS:.*\bvoid Signal\(\))",
|
||||||
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_qdbusxml2cpp::process()
|
void tst_qdbusxml2cpp::process()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user