QFutureSynchronizer: mark ctors [[nodiscard]]

QFutureSynchronizer is a RAII class. QUIP-0019 says that RAII class
ctors should be marked as [[nodiscard]].

Pick-to: 6.6
Task-number: QTBUG-104164
Change-Id: I0b6710f2b9a14d67f64150f240f819b8336e0929
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2023-06-21 11:45:50 +02:00
parent e8dcbaaaf6
commit f403ef428e

View File

@ -17,7 +17,8 @@ class QFutureSynchronizer
Q_DISABLE_COPY(QFutureSynchronizer)
public:
QFutureSynchronizer() : m_cancelOnWait(false) { }
Q_NODISCARD_CTOR QFutureSynchronizer() : m_cancelOnWait(false) { }
Q_NODISCARD_CTOR
explicit QFutureSynchronizer(QFuture<T> future)
: m_cancelOnWait(false)
{ addFuture(std::move(future)); }