QObjectPrivate: mark inline functions not meant to be used elsewhere

The `inline` keyword does not control inlining, as we all know (use
Q_ALWAYS_INLINE to force inlining, if required). However, it does
control the emission of the out-of-line copy of an inline function, if
the compiler did inline it where it got used: with the keyword, no copy
is required, which is our objective here.

Furthermore, we compile with -fvisibility-inlines-hidden with
GCC-compatible compilers (all but MSVC and Integrity's), which means
those functions will never be in the ABI of QtCore: they'll either have
been inlined with no out-of-line copy, or that out-of-line emission is
hidden.

Change-Id: If2e0f4b2190341ebaa31fffd16e31584561669f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Thiago Macieira 2022-04-05 13:36:42 -07:00
parent 67b9baac52
commit 3b46f07ffa
2 changed files with 8 additions and 8 deletions

View File

@ -516,7 +516,7 @@ QObjectList QObjectPrivate::senderList() const
return returnValue; return returnValue;
} }
void QObjectPrivate::ensureConnectionData() inline void QObjectPrivate::ensureConnectionData()
{ {
if (connections.loadRelaxed()) if (connections.loadRelaxed())
return; return;
@ -535,7 +535,7 @@ void QObjectPrivate::ensureConnectionData()
Will also add the connection in the sender's list of the receiver. Will also add the connection in the sender's list of the receiver.
*/ */
void QObjectPrivate::addConnection(int signal, Connection *c) inline void QObjectPrivate::addConnection(int signal, Connection *c)
{ {
Q_ASSERT(c->sender == q_ptr); Q_ASSERT(c->sender == q_ptr);
ensureConnectionData(); ensureConnectionData();
@ -657,7 +657,7 @@ void QObjectPrivate::ConnectionData::cleanOrphanedConnectionsImpl(QObject *sende
} }
} }
void QObjectPrivate::ConnectionData::deleteOrphaned(QObjectPrivate::ConnectionOrSignalVector *o) inline void QObjectPrivate::ConnectionData::deleteOrphaned(QObjectPrivate::ConnectionOrSignalVector *o)
{ {
while (o) { while (o) {
QObjectPrivate::ConnectionOrSignalVector *next = nullptr; QObjectPrivate::ConnectionOrSignalVector *next = nullptr;
@ -1345,7 +1345,7 @@ QObject::~QObject()
d->setParent_helper(nullptr); d->setParent_helper(nullptr);
} }
QObjectPrivate::Connection::~Connection() inline QObjectPrivate::Connection::~Connection()
{ {
if (ownArgumentTypes) { if (ownArgumentTypes) {
const int *v = argumentTypes.loadRelaxed(); const int *v = argumentTypes.loadRelaxed();
@ -5532,7 +5532,7 @@ bool QObjectPrivate::disconnect(const QObject *sender, int signal_index, const Q
\internal \internal
\threadsafe \threadsafe
*/ */
bool QObjectPrivate::disconnect(QObjectPrivate::Connection *c) inline bool QObjectPrivate::disconnect(QObjectPrivate::Connection *c)
{ {
if (!c) if (!c)
return false; return false;

View File

@ -173,7 +173,7 @@ public:
QObjectList receiverList(const char *signal) const; QObjectList receiverList(const char *signal) const;
QObjectList senderList() const; QObjectList senderList() const;
void addConnection(int signal, Connection *c); inline void addConnection(int signal, Connection *c);
static QObjectPrivate *get(QObject *o) { return o->d_func(); } static QObjectPrivate *get(QObject *o) { return o->d_func(); }
static const QObjectPrivate *get(const QObject *o) { return o->d_func(); } static const QObjectPrivate *get(const QObject *o) { return o->d_func(); }
@ -211,9 +211,9 @@ public:
static bool disconnect(const QObject *sender, int signal_index, void **slot); static bool disconnect(const QObject *sender, int signal_index, void **slot);
static bool disconnect(const QObject *sender, int signal_index, const QObject *receiver, static bool disconnect(const QObject *sender, int signal_index, const QObject *receiver,
void **slot); void **slot);
static bool disconnect(Connection *c); static inline bool disconnect(Connection *c);
void ensureConnectionData(); inline void ensureConnectionData();
virtual std::string flagsForDumping() const; virtual std::string flagsForDumping() const;