QtNetwork: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERN [1/2]: public API

It's one of our best tools to improve compile times.

Can't backport to Qt 6.3 or 6.2 because this change introduces new
exported symbols.

Task-number: QTBUG-102206
Change-Id: I6bfa532be34ca847d3b9034d16c94efed3d602c3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-04-01 09:39:11 +02:00
parent bfd2d30169
commit d2d202c648
28 changed files with 57 additions and 18 deletions

View File

@ -55,6 +55,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QNetworkCookie)
/*!
\class QNetworkCookie
\since 4.4

View File

@ -127,6 +127,6 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &);
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QNetworkCookie)
QT_DECL_METATYPE_EXTERN(QNetworkCookie, Q_NETWORK_EXPORT)
#endif

View File

@ -45,6 +45,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN_TAGGED(QNetworkReply::NetworkError, QNetworkReply__NetworkError)
const int QNetworkReplyPrivate::progressSignalInterval = 100;
QNetworkReplyPrivate::QNetworkReplyPrivate()

View File

@ -196,6 +196,7 @@ private:
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QNetworkReply::NetworkError)
QT_DECL_METATYPE_EXTERN_TAGGED(QNetworkReply::NetworkError,
QNetworkReply__NetworkError, Q_NETWORK_EXPORT)
#endif

View File

@ -59,6 +59,9 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QNetworkRequest)
QT_IMPL_METATYPE_EXTERN_TAGGED(QNetworkRequest::RedirectPolicy, QNetworkRequest__RedirectPolicy)
/*!
\class QNetworkRequest
\since 4.4

View File

@ -199,7 +199,8 @@ Q_DECLARE_SHARED(QNetworkRequest)
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QNetworkRequest)
Q_DECLARE_METATYPE(QNetworkRequest::RedirectPolicy)
QT_DECL_METATYPE_EXTERN(QNetworkRequest, Q_NETWORK_EXPORT)
QT_DECL_METATYPE_EXTERN_TAGGED(QNetworkRequest::RedirectPolicy,
QNetworkRequest__RedirectPolicy, Q_NETWORK_EXPORT)
#endif

View File

@ -72,6 +72,8 @@ QT_BEGIN_NAMESPACE
//#define QHOSTINFO_DEBUG
QT_IMPL_METATYPE_EXTERN(QHostInfo)
namespace {
struct ToBeLookedUpEquals {
typedef bool result_type;

View File

@ -164,6 +164,6 @@ Q_DECLARE_SHARED(QHostInfo)
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QHostInfo)
QT_DECL_METATYPE_EXTERN(QHostInfo, Q_NETWORK_EXPORT)
#endif // QHOSTINFO_H

View File

@ -44,6 +44,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QNetworkDatagram)
/*!
\class QNetworkDatagram
\brief The QNetworkDatagram class provides the data and metadata of a UDP datagram.

View File

@ -116,7 +116,7 @@ Q_DECLARE_SHARED(QNetworkDatagram)
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QNetworkDatagram)
QT_DECL_METATYPE_EXTERN(QNetworkDatagram, Q_NETWORK_EXPORT)
#endif // QT_NO_UDPSOCKET

View File

@ -49,6 +49,9 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QNetworkAddressEntry)
QT_IMPL_METATYPE_EXTERN(QNetworkInterface)
static_assert(QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
&& sizeof(QScopedPointer<QNetworkAddressEntryPrivate>) == sizeof(std::unique_ptr<QNetworkAddressEntryPrivate>));

View File

@ -182,8 +182,8 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkInterface &networ
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QNetworkAddressEntry)
Q_DECLARE_METATYPE(QNetworkInterface)
QT_DECL_METATYPE_EXTERN(QNetworkAddressEntry, Q_NETWORK_EXPORT)
QT_DECL_METATYPE_EXTERN(QNetworkInterface, Q_NETWORK_EXPORT)
#endif // QT_NO_NETWORKINTERFACE

View File

@ -243,6 +243,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QNetworkProxy)
class QSocks5SocketEngineHandler;
class QHttpSocketEngineHandler;

View File

@ -210,7 +210,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkProxyQuery &proxy
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QNetworkProxy)
QT_DECL_METATYPE_EXTERN(QNetworkProxy, Q_NETWORK_EXPORT)
#endif // QT_NO_NETWORKPROXY

View File

@ -500,6 +500,9 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN_TAGGED(QAbstractSocket::SocketState, QAbstractSocket__SocketState)
QT_IMPL_METATYPE_EXTERN_TAGGED(QAbstractSocket::SocketError, QAbstractSocket__SocketError)
static const int DefaultConnectTimeout = 30000;
static bool isProxyError(QAbstractSocket::SocketError error)

View File

@ -270,7 +270,9 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketState);
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QAbstractSocket::SocketState)
Q_DECLARE_METATYPE(QAbstractSocket::SocketError)
QT_DECL_METATYPE_EXTERN_TAGGED(QAbstractSocket::SocketState,
QAbstractSocket__SocketState, Q_NETWORK_EXPORT)
QT_DECL_METATYPE_EXTERN_TAGGED(QAbstractSocket::SocketError,
QAbstractSocket__SocketError, Q_NETWORK_EXPORT)
#endif // QABSTRACTSOCKET_H

View File

@ -44,6 +44,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QOcspResponse)
/*!
\class QOcspResponse
\brief This class represents Online Certificate Status Protocol response.

View File

@ -118,6 +118,6 @@ Q_DECLARE_SHARED(QOcspResponse)
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QOcspResponse)
QT_DECL_METATYPE_EXTERN(QOcspResponse, Q_NETWORK_EXPORT)
#endif // QOCSPRESPONSE_H

View File

@ -151,6 +151,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QSslCertificate)
QSslCertificatePrivate::QSslCertificatePrivate()
{
#ifndef QT_NO_SSL

View File

@ -167,6 +167,6 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QSslCertificate::SubjectInfo in
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QSslCertificate)
QT_DECL_METATYPE_EXTERN(QSslCertificate, Q_NETWORK_EXPORT)
#endif

View File

@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QSslConfiguration)
const QSsl::SslOptions QSslConfigurationPrivate::defaultSslOptions = QSsl::SslOptionDisableEmptyFragments
|QSsl::SslOptionDisableLegacyRenegotiation
|QSsl::SslOptionDisableCompression

View File

@ -206,7 +206,7 @@ Q_DECLARE_SHARED(QSslConfiguration)
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QSslConfiguration)
QT_DECL_METATYPE_EXTERN(QSslConfiguration, Q_NETWORK_EXPORT)
#endif // QT_NO_SSL

View File

@ -47,6 +47,8 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QSslEllipticCurve)
/*!
\class QSslEllipticCurve
\since 5.5

View File

@ -96,6 +96,6 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QSslEllipticCurve curve);
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QSslEllipticCurve)
QT_DECL_METATYPE_EXTERN(QSslEllipticCurve, Q_NETWORK_EXPORT)
#endif // QSSLELLIPTICCURVE_H

View File

@ -111,6 +111,11 @@
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SSL
QT_IMPL_METATYPE_EXTERN_TAGGED(QList<QSslError>, QList_QSslError)
#endif
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
// Avoid an ABI break due to the QScopedPointer->std::unique_ptr change
static_assert(sizeof(QScopedPointer<QSslErrorPrivate>) == sizeof(std::unique_ptr<QSslErrorPrivate>));

View File

@ -141,7 +141,7 @@ class Q_NETWORK_EXPORT QSslError {}; // dummy class so that moc has a complete t
QT_END_NAMESPACE
#ifndef QT_NO_SSL
Q_DECLARE_METATYPE(QList<QSslError>)
QT_DECL_METATYPE_EXTERN_TAGGED(QList<QSslError>, QList_QSslError, Q_NETWORK_EXPORT)
#endif
#endif

View File

@ -44,6 +44,9 @@
QT_BEGIN_NAMESPACE
QT_IMPL_METATYPE_EXTERN(QSslPreSharedKeyAuthenticator)
QT_IMPL_METATYPE_EXTERN_TAGGED(QSslPreSharedKeyAuthenticator*, QSslPreSharedKeyAuthenticator_ptr)
/*!
\internal
*/

View File

@ -90,7 +90,7 @@ Q_DECLARE_SHARED(QSslPreSharedKeyAuthenticator)
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QSslPreSharedKeyAuthenticator)
Q_DECLARE_METATYPE(QSslPreSharedKeyAuthenticator*)
QT_DECL_METATYPE_EXTERN(QSslPreSharedKeyAuthenticator, Q_NETWORK_EXPORT)
QT_DECL_METATYPE_EXTERN_TAGGED(QSslPreSharedKeyAuthenticator*, QSslPreSharedKeyAuthenticator_ptr, Q_NETWORK_EXPORT)
#endif // QSSLPRESHAREDKEYAUTHENTICATOR_H