tst_QPointer: fix Clang 19 -Wunused-lambda-capture
Clang informs that ITERATIONS_PER_THREAD need not be captured: tst_qpointer.cpp:548:66: warning: lambda capture 'ITERATIONS_PER_THREAD' is not required to be captured for this use [-Wunused-lambda-capture] 548 | QThread::create([&startSemaphore, &targetObject, ITERATIONS_PER_THREAD]() { | ~~^~~~~~~~~~~~~~~~~~~~~ Make ITERATIONS_PER_THREAD (and NUM_THREADS, while at it) constexpr, indicating even to non-language-lawyers that these variables, indeed, need not be captured, then drop the capture. Amends 253f34082f526ff1ffd9eaefac73cc9aa616ab2a. Pick-to: 6.8 6.5 Change-Id: I27d94763058e1dcea3a65d4ff2c859b40336446f Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 668d81f73a5c2f4ec14764d1892f2eaf6494c0f1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit cf1a20df70cb7049085b07555b593565fa437e7f)
This commit is contained in:
parent
09cdda9527
commit
8423de299f
@ -533,8 +533,8 @@ void tst_QPointer::threadSafety()
|
||||
|
||||
void tst_QPointer::raceCondition()
|
||||
{
|
||||
const int NUM_THREADS = 20;
|
||||
const int ITERATIONS_PER_THREAD = 10;
|
||||
constexpr int NUM_THREADS = 20;
|
||||
constexpr int ITERATIONS_PER_THREAD = 10;
|
||||
|
||||
QSemaphore startSemaphore;
|
||||
|
||||
@ -545,7 +545,7 @@ void tst_QPointer::raceCondition()
|
||||
|
||||
for (int i = 0; i < NUM_THREADS; ++i) {
|
||||
QThread *thread =
|
||||
QThread::create([&startSemaphore, &targetObject, ITERATIONS_PER_THREAD]() {
|
||||
QThread::create([&startSemaphore, &targetObject] {
|
||||
startSemaphore.acquire();
|
||||
|
||||
for (int j = 0; j < ITERATIONS_PER_THREAD; ++j) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user