diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-22 21:13:28 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-01-24 21:11:22 +0100 |
commit | 6f1821dfa302c028f7899e4485dfaf24a6a02457 (patch) | |
tree | e0fa45ab2c09574b85f5c590a0ba82def81091b4 /tests/benchmarks/corelib | |
parent | c00e443dcc5024aa1239ed2f494da13ab572d238 (diff) |
benchmarks: fix some (future) -Wunused-result warnings
Clang 10 warns about unused results of relational operators, which is
where this is coming from.
Fix by adding the usual prefix
[[maybe_unused]] auto r = ~~~;
to silence the warning. Do this elsewhere, too, since [[nodiscard]] is
slowly being rolled out across all our APIs. This is not a complete
sweep, though.
Not picking to 5.15, because this pattern doesn't work there and I
don't want to introduce a new one.
Pick-to: 6.3 6.2
Change-Id: I40dd8ad07496b686979dce533e044cbb486e30f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r-- | tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp | 2 | ||||
-rw-r--r-- | tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp b/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp index 8165f8d059..0ed155d221 100644 --- a/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp +++ b/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp @@ -188,7 +188,7 @@ void tst_QUrl::equality() QUrl url("pics/avatar.png"); QUrl url2("pics/avatar2.png"); QBENCHMARK { - url == url2; + [[maybe_unused]] auto r = url == url2; } } } diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp index 2db1563568..4088ea320a 100644 --- a/tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp +++ b/tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp @@ -55,7 +55,7 @@ private slots: void tst_QUuid::createUuid() { QBENCHMARK { - QUuid::createUuid(); + [[maybe_unused]] auto r = QUuid::createUuid(); } } @@ -70,7 +70,7 @@ void tst_QUuid::toString() { QUuid uuid = QUuid::createUuid(); QBENCHMARK { - uuid.toString(); + [[maybe_unused]] auto r = uuid.toString(); } } @@ -86,7 +86,7 @@ void tst_QUuid::toByteArray() { QUuid uuid = QUuid::createUuid(); QBENCHMARK { - uuid.toByteArray(); + [[maybe_unused]] auto r = uuid.toByteArray(); } } @@ -102,7 +102,7 @@ void tst_QUuid::toRfc4122() { QUuid uuid = QUuid::createUuid(); QBENCHMARK { - uuid.toRfc4122(); + [[maybe_unused]] auto r = uuid.toRfc4122(); } } @@ -168,7 +168,7 @@ void tst_QUuid::isNull() { QUuid uuid = QUuid(); QBENCHMARK { - uuid.isNull(); + [[maybe_unused]] auto r = uuid.isNull(); } } @@ -178,7 +178,7 @@ void tst_QUuid::operatorLess() uuid1 = QUuid::createUuid(); uuid2 = QUuid::createUuid(); QBENCHMARK { - uuid1 < uuid2; + [[maybe_unused]] auto r = uuid1 < uuid2; } } @@ -188,7 +188,7 @@ void tst_QUuid::operatorMore() uuid1 = QUuid::createUuid(); uuid2 = QUuid::createUuid(); QBENCHMARK { - uuid1 > uuid2; + [[maybe_unused]] auto r = uuid1 > uuid2; } } |