Skip to content

Commit 564385f

Browse files
committed
Merge #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 #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 #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/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
2 parents fa61627 + 8ecaee1 commit 564385f

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

src/rest.cpp

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

src/test/coins_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
508508
Coin cc4;
509509
ss4 >> cc4;
510510
BOOST_CHECK_MESSAGE(false, "We should have thrown");
511-
} catch (const std::ios_base::failure& e) {
511+
} catch (const std::ios_base::failure&) {
512512
}
513513

514514
// Very large scriptPubKey (3*10^9 bytes) past the end of the stream
@@ -521,7 +521,7 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
521521
Coin cc5;
522522
ss5 >> cc5;
523523
BOOST_CHECK_MESSAGE(false, "We should have thrown");
524-
} catch (const std::ios_base::failure& e) {
524+
} catch (const std::ios_base::failure&) {
525525
}
526526
}
527527

@@ -719,7 +719,7 @@ static void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount mo
719719
test.cache.AddCoin(OUTPOINT, Coin(std::move(output), 1, coinbase), coinbase);
720720
test.cache.SelfTest();
721721
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
722-
} catch (std::logic_error& e) {
722+
} catch (std::logic_error&) {
723723
result_value = FAIL;
724724
result_flags = NO_ENTRY;
725725
}
@@ -780,7 +780,7 @@ void CheckWriteCoins(CAmount parent_value, CAmount child_value, CAmount expected
780780
WriteCoinsViewEntry(test.cache, child_value, child_flags);
781781
test.cache.SelfTest();
782782
GetCoinsMapEntry(test.cache.map(), result_value, result_flags);
783-
} catch (std::logic_error& e) {
783+
} catch (std::logic_error&) {
784784
result_value = FAIL;
785785
result_flags = NO_ENTRY;
786786
}

src/test/dbwrapper_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ struct StringContentsSerializer {
262262
try {
263263
READWRITE(c);
264264
str.push_back(c);
265-
} catch (const std::ios_base::failure& e) {
265+
} catch (const std::ios_base::failure&) {
266266
break;
267267
}
268268
}

src/test/net_tests.cpp

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

@@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted)
148148
unsigned char pchMsgTmp[4];
149149
ssPeers1 >> pchMsgTmp;
150150
ssPeers1 >> addrman1;
151-
} catch (const std::exception& e) {
151+
} catch (const std::exception&) {
152152
exceptionThrown = true;
153153
}
154154
// 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
@@ -278,7 +278,6 @@ static UniValue setlabel(const JSONRPCRequest& request)
278278
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
279279
}
280280

281-
std::string old_label = pwallet->mapAddressBook[dest].name;
282281
std::string label = LabelFromValue(request.params[1]);
283282

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

0 commit comments

Comments
 (0)