From b05a2768c2fb166bdca8f05a6833409fe5a40ee6 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sat, 3 Sep 2022 11:48:39 +0200 Subject: [PATCH] Fix warning from testing assignment Tests that do QTRY_VERIFY(a = b); generate a compiler warning: using the result of an assignment as a condition without parentheses [-Wparentheses]: place parentheses around the assignment to silence this warning Do that centrally in the QTRY_TIMEOUT_DEBUG_IMPL macro definition. Pick-to: 6.4 Change-Id: I4a4b0161c4e16c0e1e27a68f33a41efdaa2c962c Reviewed-by: Thiago Macieira --- src/testlib/qtestcase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index cd713ceebf..3d268135a4 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -168,7 +168,7 @@ inline void useVerifyThrowsException() {} #define QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step) \ if (!QTest::currentTestFailed() && !(expr)) { \ QTRY_LOOP_IMPL(expr, 2 * (timeoutValue), step) \ - if (expr) { \ + if ((expr)) { \ QFAIL(qPrintable(QTest::Internal::formatTryTimeoutDebugMessage(\ u8"" #expr, timeoutValue, timeoutValue + qt_test_i))); \ } \