qdbusxml2cpp: don't emit Q_DECL_DEPRECATED for the adaptor

The adaptor is a server-side implementation that must exist anyway and
is called by the QtDBus runtime. We don't want warning on the server
side because it must call those methods to implement the client API.

Since we have the XML introspection saved in a class property anyway,
the runtime won't be inspecting the method tags to see if
Q_DECL_DEPRECATED is there, to add to the XML (which it isn't
generating).

Pick-to: 6.5
Change-Id: I9671dee8ceb64aa9b9cafffd17416596135d26ca
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Thiago Macieira 2023-02-06 17:10:31 -08:00
parent f67b32e735
commit b41c44d966
2 changed files with 4 additions and 11 deletions

View File

@ -947,9 +947,6 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
}
hs << " ";
if (method.annotations.value("org.freedesktop.DBus.Deprecated"_L1) == "true"_L1)
hs << "Q_DECL_DEPRECATED ";
QByteArray returnType;
if (isNoReply) {
hs << "Q_NOREPLY void ";
@ -1043,11 +1040,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
hs << "Q_SIGNALS: // SIGNALS" << Qt::endl;
for (const QDBusIntrospection::Signal &signal : interface->signals_) {
hs << " ";
if (signal.annotations.value("org.freedesktop.DBus.Deprecated"_L1) == "true"_L1)
hs << "Q_DECL_DEPRECATED ";
hs << "void " << signal.name << "(";
hs << " void " << signal.name << "(";
QStringList argNames = makeArgNames(signal.outputArgs);
writeSignalArgList(hs, argNames, signal.annotations, signal.outputArgs);

View File

@ -246,7 +246,7 @@ void tst_qdbusxml2cpp::process_data()
"</method>"
<< QRegularExpression("Q_SLOTS:.*Q_DECL_DEPRECATED inline QDBusPendingReply<> Method\\(\\)",
QRegularExpression::DotMatchesEverythingOption)
<< QRegularExpression("Q_SLOTS:.*void Method\\(\\)",
<< QRegularExpression("Q_SLOTS:.*\n\\s*void Method\\(\\)", // no Q_DECL_DEPRECATED
QRegularExpression::DotMatchesEverythingOption);
QTest::newRow("method-deprecated-2out")
@ -258,7 +258,7 @@ void tst_qdbusxml2cpp::process_data()
<< 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("Q_SLOTS:.*\n\\s*QString Method\\(QString &", // no Q_DECL_DEPRECATED
QRegularExpression::DotMatchesEverythingOption);
QTest::newRow("method-noreply")
@ -308,7 +308,7 @@ void tst_qdbusxml2cpp::process_data()
</signal>)"
<< QRegularExpression(R"(Q_SIGNALS:.*\bQ_DECL_DEPRECATED void Signal\(\))",
QRegularExpression::DotMatchesEverythingOption)
<< QRegularExpression(R"(Q_SIGNALS:.*\bvoid Signal\(\))",
<< QRegularExpression(R"(Q_SIGNALS:.*\n\s*void Signal\(\))", // no Q_DECL_DEPRECATED
QRegularExpression::DotMatchesEverythingOption);
}