diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-08-10 22:58:07 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-08-15 17:19:06 +0000 |
commit | ead57cc7431e80d7ad9b78dfd502f884cbb76a6b (patch) | |
tree | 52de6d9e56103c88203067c6e87c696ffa363814 | |
parent | a0b845f78c031a62d02883889bc6c3effa2d2b9e (diff) |
QBluetoothUuid: cut out the streamingOperator() middle-man
The split into an inline friend op<< and an out-of-line
streamingOperator() just causes the QDebug object to be copied once
more than otherwise necessary. Relegate the streamingOperator()
middle-man to QT_REMOVED_SINCE status and make op<< the real thing.
We can't make the named function call op<<, because Thiago says there
are situations in which the op<<(QDebug, QBluetoothUuid) call in
removed_api.cpp, if we were to use it, would get resolved to an
exported version of the old op<< in a user library compiled without
-fvisibility-hidden, creating a cycle. Fortunately, the implementation
is simple enough to make a DRY violation acceptable.
Problem exists in 6.5, too, but let's get as many removed_api.cpp
tasks done for 6.6, because the QT_NO_INT128 in removed_api.cpp will
make a QT_REMOVED_SINCE(6, 7) in this header file that much harder.
Change-Id: I10b42cfc1565db8d9a6924cee0af8fb6623c9000
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit a16133c959151892a386204aa54c8115992c1075)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/bluetooth/qbluetoothuuid.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothuuid.h | 7 | ||||
-rw-r--r-- | src/bluetooth/removed_api.cpp | 8 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp index 4959ba73..608658ef 100644 --- a/src/bluetooth/qbluetoothuuid.cpp +++ b/src/bluetooth/qbluetoothuuid.cpp @@ -1074,7 +1074,7 @@ QString QBluetoothUuid::descriptorToString(QBluetoothUuid::DescriptorType uuid) */ #ifndef QT_NO_DEBUG_STREAM -QDebug QBluetoothUuid::streamingOperator(QDebug debug, const QBluetoothUuid &uuid) +QDebug operator<<(QDebug debug, const QBluetoothUuid &uuid) { debug << uuid.toString(); return debug; diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h index d91670d9..9e087d76 100644 --- a/src/bluetooth/qbluetoothuuid.h +++ b/src/bluetooth/qbluetoothuuid.h @@ -370,12 +370,11 @@ public: } friend bool operator!=(const QBluetoothUuid &a, const QBluetoothUuid &b) { return !(a == b); } #ifndef QT_NO_DEBUG_STREAM - friend QDebug operator<<(QDebug debug, const QBluetoothUuid &uuid) - { - return streamingOperator(debug, uuid); - } + friend Q_BLUETOOTH_EXPORT QDebug operator<<(QDebug debug, const QBluetoothUuid &uuid); +#if QT_BLUETOOTH_REMOVED_SINCE(6, 6) static QDebug streamingOperator(QDebug debug, const QBluetoothUuid &uuid); #endif +#endif int minimumSize() const; diff --git a/src/bluetooth/removed_api.cpp b/src/bluetooth/removed_api.cpp index 86af8b9c..da42f242 100644 --- a/src/bluetooth/removed_api.cpp +++ b/src/bluetooth/removed_api.cpp @@ -39,4 +39,12 @@ quint128 QBluetoothUuid::toUInt128() const return uuid; } +#ifndef QT_NO_DEBUG_STREAM +QDebug QBluetoothUuid::streamingOperator(QDebug debug, const QBluetoothUuid &uuid) +{ + debug << uuid.toString(); + return debug; +} +#endif // QT_NO_DEBUG_STREAM + #endif // QT_BLUETOOTH_REMOVED_SINCE(6, 6) |