Skip to content

Commit 807b9f8

Browse files
committed
Merge #19188: test: Avoid overwriting the NodeContext member of the testing setup [-Wshadow-field]
fac6b9b test: Avoid overwriting the NodeContext member of the testing setup (MarcoFalke) fa16e78 build: Add -Wshadow-field (MarcoFalke) Pull request description: Adding this warning will eliminate unexpected test failures and hard to review code. Moreover, there shouldn't be a use case in Bitcoin Core that relies on fields to be shadowed. ACKs for top commit: fanquake: ACK fac6b9b - Warnings compiling fa16e78 are below. No warnings with fac6b9b. The `-Wshadow-field` diagnostic has been available in Clang since 5.0.0. It's not available for GCC. practicalswift: ACK fac6b9b -- patch looks correct hebasto: ACK fac6b9b, tested on Linux Mint 19.3 (x86_64): Tree-SHA512: 824874ca10877efea7463cf934a2953147f3f99c486f04679426c14ff968975d8652cbba5729bfb7cb2c86c637ade5d1e5b873d611c06bad013a7cad8427e2bf
2 parents b3091b2 + fac6b9b commit 807b9f8

File tree

4 files changed

+2
-3
lines changed

4 files changed

+2
-3
lines changed

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ if test "x$enable_werror" = "xyes"; then
380380
fi
381381
AX_CHECK_COMPILE_FLAG([-Werror=gnu],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=gnu"],,[[$CXXFLAG_WERROR]])
382382
AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$CXXFLAG_WERROR]])
383+
AX_CHECK_COMPILE_FLAG([-Werror=shadow-field],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=shadow-field"],,[[$CXXFLAG_WERROR]])
383384
AX_CHECK_COMPILE_FLAG([-Werror=switch],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=switch"],,[[$CXXFLAG_WERROR]])
384385
AX_CHECK_COMPILE_FLAG([-Werror=thread-safety],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=thread-safety"],,[[$CXXFLAG_WERROR]])
385386
AX_CHECK_COMPILE_FLAG([-Werror=unused-variable],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=unused-variable"],,[[$CXXFLAG_WERROR]])
@@ -400,6 +401,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
400401
AX_CHECK_COMPILE_FLAG([-Wgnu],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wgnu"],,[[$CXXFLAG_WERROR]])
401402
AX_CHECK_COMPILE_FLAG([-Wformat],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat"],,[[$CXXFLAG_WERROR]])
402403
AX_CHECK_COMPILE_FLAG([-Wvla],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wvla"],,[[$CXXFLAG_WERROR]])
404+
AX_CHECK_COMPILE_FLAG([-Wshadow-field],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wshadow-field"],,[[$CXXFLAG_WERROR]])
403405
AX_CHECK_COMPILE_FLAG([-Wswitch],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wswitch"],,[[$CXXFLAG_WERROR]])
404406
AX_CHECK_COMPILE_FLAG([-Wformat-security],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat-security"],,[[$CXXFLAG_WERROR]])
405407
AX_CHECK_COMPILE_FLAG([-Wthread-safety],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wthread-safety"],,[[$CXXFLAG_WERROR]])

src/wallet/test/init_test_fixture.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ struct InitWalletDirTestingSetup: public BasicTestingSetup {
1818
fs::path m_datadir;
1919
fs::path m_cwd;
2020
std::map<std::string, fs::path> m_walletdir_path_cases;
21-
NodeContext m_node;
2221
std::unique_ptr<interfaces::Chain> m_chain = interfaces::MakeChain(m_node);
2322
std::unique_ptr<interfaces::ChainClient> m_chain_client;
2423
};

src/wallet/test/wallet_test_fixture.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
struct WalletTestingSetup: public TestingSetup {
2020
explicit WalletTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
2121

22-
NodeContext m_node;
2322
std::unique_ptr<interfaces::Chain> m_chain = interfaces::MakeChain(m_node);
2423
std::unique_ptr<interfaces::ChainClient> m_chain_client = interfaces::MakeWalletClient(*m_chain, {});
2524
CWallet m_wallet;

src/wallet/test/wallet_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,6 @@ class ListCoinsTestingSetup : public TestChain100Setup
535535
return it->second;
536536
}
537537

538-
NodeContext m_node;
539538
std::unique_ptr<interfaces::Chain> m_chain = interfaces::MakeChain(m_node);
540539
std::unique_ptr<CWallet> wallet;
541540
};

0 commit comments

Comments
 (0)