Skip to content

Commit 2eb2051

Browse files
laanwjPastaPastaPasta
authored andcommitted
Merge bitcoin#14094: refactoring: Remove unreferenced local variables
8ecaee1 Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4 (12 is assuming the changes in bitcoin#14086 are also implemented). (practicalswift) Pull request description: Remove unreferenced local variables: Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4. 12 is the number of MSVC warnings under our current appveyor setup assuming the changes in bitcoin#14086 are also implemented. This makes it easier to spot errors or more important warnings in the verbose appveyor output. MSVC warnings are good, so having access to them in a noise free way (read: without trivial warnings) via appveyor without having to use Windows is really valuable. See bitcoin#14086 (comment) plus discussion for context. Before: ``` c:\projects\bitcoin\src\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch [C:\projects\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj] c:\projects\bitcoin\src\rest.cpp(467): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\libbitcoin_server\libbitcoin_server.vcxproj] c:\projects\bitcoin\src\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\coins_tests.cpp(511): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\coins_tests.cpp(524): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\coins_tests.cpp(722): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\coins_tests.cpp(783): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\dbwrapper_tests.cpp(265): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\net_tests.cpp(118): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\net_tests.cpp(151): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\scheduler_tests.cpp(57): warning C4305: 'argument': truncation from 'int' to 'bool' [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] ``` After: ``` c:\projects\bitcoin\src\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch [C:\projects\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj] c:\projects\bitcoin\src\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] c:\projects\bitcoin\src\test\scheduler_tests.cpp(57): warning C4305: 'argument': truncation from 'int' to 'bool' [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] ``` Tree-SHA512: 5051134126c570b8421d57c710f1f1b977600398d2b5e69f8a8bd766b3696f992bf4e3459643b99a6b7e08dee1adc92985ee4d0d52b20755954415cb6f23f2fb
1 parent 75abadb commit 2eb2051

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/rest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
460460
oss >> fCheckMemPool;
461461
oss >> vOutPoints;
462462
}
463-
} catch (const std::ios_base::failure& e) {
463+
} catch (const std::ios_base::failure&) {
464464
// abort in case of unreadable binary data
465465
return RESTERR(req, HTTP_BAD_REQUEST, "Parse error");
466466
}

src/test/coins_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
513513
Coin cc4;
514514
ss4 >> cc4;
515515
BOOST_CHECK_MESSAGE(false, "We should have thrown");
516-
} catch (const std::ios_base::failure& e) {
516+
} catch (const std::ios_base::failure&) {
517517
}
518518

519519
// Very large scriptPubKey (3*10^9 bytes) past the end of the stream
@@ -526,7 +526,7 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
526526
Coin cc5;
527527
ss5 >> cc5;
528528
BOOST_CHECK_MESSAGE(false, "We should have thrown");
529-
} catch (const std::ios_base::failure& e) {
529+
} catch (const std::ios_base::failure&) {
530530
}
531531
}
532532

@@ -724,7 +724,7 @@ static void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount mo
724724
test.cache.AddCoin(OUTPOINT, Coin(std::move(output), 1, coinbase), coinbase);
725725
test.cache.SelfTest();
726726
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
727-
} catch (std::logic_error& e) {
727+
} catch (std::logic_error&) {
728728
result_value = FAIL;
729729
result_flags = NO_ENTRY;
730730
}
@@ -785,7 +785,7 @@ void CheckWriteCoins(CAmount parent_value, CAmount child_value, CAmount expected
785785
WriteCoinsViewEntry(test.cache, child_value, child_flags);
786786
test.cache.SelfTest();
787787
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
788-
} catch (std::logic_error& e) {
788+
} catch (std::logic_error&) {
789789
result_value = FAIL;
790790
result_flags = NO_ENTRY;
791791
}

src/test/net_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read)
119119
unsigned char pchMsgTmp[4];
120120
ssPeers1 >> pchMsgTmp;
121121
ssPeers1 >> addrman1;
122-
} catch (const std::exception& e) {
122+
} catch (const std::exception&) {
123123
exceptionThrown = true;
124124
}
125125

@@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted)
152152
unsigned char pchMsgTmp[4];
153153
ssPeers1 >> pchMsgTmp;
154154
ssPeers1 >> addrman1;
155-
} catch (const std::exception& e) {
155+
} catch (const std::exception&) {
156156
exceptionThrown = true;
157157
}
158158
// Even through de-serialization failed addrman is not left in a clean state.

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ static UniValue setlabel(const JSONRPCRequest& request)
321321
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Dash address");
322322
}
323323

324-
std::string old_label = pwallet->mapAddressBook[dest].name;
325324
std::string label = LabelFromValue(request.params[1]);
326325

327326
if (IsMine(*pwallet, dest)) {

0 commit comments

Comments
 (0)