From a8da9829dc26c51b93156b1cdcce7034bb48283f Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 9 Feb 2024 11:05:49 +0100 Subject: [PATCH] QTest: rename local `timeout` variable in QTRY_IMPL macro `timeout` is a likely name for a variable in the scope in which a QTRY_ macro is used, so don't use that name in the macro itself. The other variables are all prefixed with `qt_test_`, so do that here as well, and be explicit about what the variable stores. Amends d4bb448cddce63e0c6a84a86020fa59dd32b2293. Task-number: QTBUG-121746 Change-Id: If05dccdc24a66e95a08156b820d185f184783ad6 Reviewed-by: Marc Mutz --- src/testlib/qtestcase.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 7724e0504b6..edb220f6d09 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -199,13 +199,13 @@ inline void useVerifyThrowsException() {} } #define QTRY_IMPL(expr, timeoutAsGiven)\ - const auto timeout = [&] { \ + const auto qt_test_timeoutAsMs = [&] { \ /* make 5s work w/o user action: */ \ using namespace std::chrono_literals; \ return std::chrono::milliseconds{timeoutAsGiven}; \ }(); \ - const int qt_test_step = timeout.count() < 350 ? timeout.count() / 7 + 1 : 50; \ - const int qt_test_timeoutValue = timeout.count(); \ + const int qt_test_step = qt_test_timeoutAsMs.count() < 350 ? qt_test_timeoutAsMs.count() / 7 + 1 : 50; \ + const int qt_test_timeoutValue = qt_test_timeoutAsMs.count(); \ { QTRY_LOOP_IMPL(expr, qt_test_timeoutValue, qt_test_step) } \ QTRY_TIMEOUT_DEBUG_IMPL(expr, qt_test_timeoutValue, qt_test_step) // Ends with an if-block, so doesn't want a following semicolon.