mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Merge bitcoin/bitcoin#25733: tidy: enable bugprone-use-after-move
f345dc3960
tidy: enable bugprone-use-after-move (fanquake)94f2235f85
test: work around bugprone-use-after-move warnings in util tests (fanquake) Pull request description: Would have caught #25640. Currently `// NOLINT`s around: ```bash test/util_tests.cpp:2513:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v2[0].origin == &t2); ^ test/util_tests.cpp:2511:15: note: move occurred here auto v2 = Vector(std::move(t2)); ^ test/util_tests.cpp:2519:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v3[1].origin == &t2); ^ test/util_tests.cpp:2516:15: note: move occurred here auto v3 = Vector(t1, std::move(t2)); ^ test/util_tests.cpp:2527:34: error: 't3' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v4[2].origin == &t3); ^ test/util_tests.cpp:2523:15: note: move occurred here auto v4 = Vector(std::move(v3[0]), v3[1], std::move(t3)); ``` See: https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-use-after-move.html ACKs for top commit: ryanofsky: Code review ACKf345dc3960
. Only change since last review is switching to NOLINT directives Tree-SHA512: afadecbaf1069653f4be5d6e66a5800ffd975c0b1a960057abc6367b616c181cd518897a874a8f3fd5e5e1f45fcc165f7a9a3171136cd4deee641214c4b765b8
This commit is contained in:
commit
52dcb1d2a3
@ -1,6 +1,7 @@
|
||||
Checks: '
|
||||
-*,
|
||||
bugprone-argument-comment,
|
||||
bugprone-use-after-move,
|
||||
misc-unused-using-decls,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-nullptr,
|
||||
@ -11,6 +12,7 @@ readability-redundant-string-init,
|
||||
'
|
||||
WarningsAsErrors: '
|
||||
bugprone-argument-comment,
|
||||
bugprone-use-after-move,
|
||||
misc-unused-using-decls,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-nullptr,
|
||||
|
@ -2511,13 +2511,13 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector)
|
||||
|
||||
auto v2 = Vector(std::move(t2));
|
||||
BOOST_CHECK_EQUAL(v2.size(), 1U);
|
||||
BOOST_CHECK(v2[0].origin == &t2);
|
||||
BOOST_CHECK(v2[0].origin == &t2); // NOLINT(*-use-after-move)
|
||||
BOOST_CHECK_EQUAL(v2[0].copies, 0);
|
||||
|
||||
auto v3 = Vector(t1, std::move(t2));
|
||||
BOOST_CHECK_EQUAL(v3.size(), 2U);
|
||||
BOOST_CHECK(v3[0].origin == &t1);
|
||||
BOOST_CHECK(v3[1].origin == &t2);
|
||||
BOOST_CHECK(v3[1].origin == &t2); // NOLINT(*-use-after-move)
|
||||
BOOST_CHECK_EQUAL(v3[0].copies, 1);
|
||||
BOOST_CHECK_EQUAL(v3[1].copies, 0);
|
||||
|
||||
@ -2525,7 +2525,7 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector)
|
||||
BOOST_CHECK_EQUAL(v4.size(), 3U);
|
||||
BOOST_CHECK(v4[0].origin == &t1);
|
||||
BOOST_CHECK(v4[1].origin == &t2);
|
||||
BOOST_CHECK(v4[2].origin == &t3);
|
||||
BOOST_CHECK(v4[2].origin == &t3); // NOLINT(*-use-after-move)
|
||||
BOOST_CHECK_EQUAL(v4[0].copies, 1);
|
||||
BOOST_CHECK_EQUAL(v4[1].copies, 1);
|
||||
BOOST_CHECK_EQUAL(v4[2].copies, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user