diff --git a/src/Makefile.am b/src/Makefile.am --- a/src/Makefile.am +++ b/src/Makefile.am @@ -241,6 +241,7 @@ util/settings.h \ util/threadnames.h \ util/time.h \ + util/translation.h \ util/url.h \ util/validation.h \ validation.h \ diff --git a/src/Makefile.seedertest.include b/src/Makefile.seedertest.include --- a/src/Makefile.seedertest.include +++ b/src/Makefile.seedertest.include @@ -9,8 +9,9 @@ $(SEEDER_INCLUDES) $(SEEDER_TEST_INCLUDES) $(TESTDEFS) SEEDER_TEST_UTIL = \ - seeder/test/dns_util.h \ - seeder/test/util.h + seeder/test/dns_util.h \ + seeder/test/translate_support.cpp \ + seeder/test/util.h SEEDER_TESTS = \ seeder/test/p2p_messaging_tests.cpp \ diff --git a/src/banman.cpp b/src/banman.cpp --- a/src/banman.cpp +++ b/src/banman.cpp @@ -9,6 +9,7 @@ #include #include #include +#include BanMan::BanMan(fs::path ban_file, const CChainParams &chainparams, CClientUIInterface *client_interface, int64_t default_ban_time) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,7 @@ #include #include +#include #include #include diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -20,12 +20,14 @@ #include #include #include +#include #include #include #include +#include #include static bool fCreateBlank; diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -12,9 +12,11 @@ #include #include #include +#include #include #include +#include const std::function G_TRANSLATION_FUN = nullptr; diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -23,8 +23,11 @@ #include #include #include +#include #include +#include + const std::function G_TRANSLATION_FUN = nullptr; /* Introduction text for doxygen: */ diff --git a/src/httprpc.cpp b/src/httprpc.cpp --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include // boost::trim diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef WIN32 #include diff --git a/src/net_permissions.cpp b/src/net_permissions.cpp --- a/src/net_permissions.cpp +++ b/src/net_permissions.cpp @@ -3,8 +3,10 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include + #include #include +#include // The parse the following format "perm1,perm2@xxxxxx" bool TryParsePermissionFlags(const std::string str, NetPermissionFlags &output, diff --git a/src/noui.cpp b/src/noui.cpp --- a/src/noui.cpp +++ b/src/noui.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/src/qt/main.cpp b/src/qt/main.cpp --- a/src/qt/main.cpp +++ b/src/qt/main.cpp @@ -4,6 +4,8 @@ #include +#include + #include #include diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/src/seeder/main.cpp b/src/seeder/main.cpp --- a/src/seeder/main.cpp +++ b/src/seeder/main.cpp @@ -13,12 +13,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include const std::function G_TRANSLATION_FUN = nullptr; diff --git a/src/seeder/test/CMakeLists.txt b/src/seeder/test/CMakeLists.txt --- a/src/seeder/test/CMakeLists.txt +++ b/src/seeder/test/CMakeLists.txt @@ -9,6 +9,8 @@ add_dependencies(check check-bitcoin-seeder) add_boost_unit_tests_to_suite(bitcoin-seeder test_bitcoin-seeder + translate_support.cpp + TESTS p2p_messaging_tests.cpp parse_name_tests.cpp diff --git a/src/seeder/test/p2p_messaging_tests.cpp b/src/seeder/test/p2p_messaging_tests.cpp --- a/src/seeder/test/p2p_messaging_tests.cpp +++ b/src/seeder/test/p2p_messaging_tests.cpp @@ -14,15 +14,13 @@ #include #include +#include + #include #include #include #include -const std::function G_TRANSLATION_FUN = nullptr; - -#include - std::ostream &operator<<(std::ostream &os, const PeerMessagingState &state) { os << to_integral(state); return os; diff --git a/src/seeder/test/translate_support.cpp b/src/seeder/test/translate_support.cpp new file mode 100644 --- /dev/null +++ b/src/seeder/test/translate_support.cpp @@ -0,0 +1,15 @@ +// Copyright (c) 2020 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +/** + * This file exist for the sole purpose of avoiding link error with the + * translate module. For some obscure reason, the seeder tests do not use the + * regular boost test framework and instead had various fixtures dumped into one + * of its test. + */ +#include + +#include + +const std::function G_TRANSLATION_FUN = nullptr; diff --git a/src/test/setup_common.cpp b/src/test/setup_common.cpp --- a/src/test/setup_common.cpp +++ b/src/test/setup_common.cpp @@ -30,10 +30,12 @@ #include #include #include +#include #include #include #include +#include #include const std::function G_TRANSLATION_FUN = nullptr; diff --git a/src/timedata.cpp b/src/timedata.cpp --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include static RecursiveMutex cs_nTimeOffset; diff --git a/src/txdb.cpp b/src/txdb.cpp --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include // boost::this_thread::interruption_point() (mingw) diff --git a/src/util/error.cpp b/src/util/error.cpp --- a/src/util/error.cpp +++ b/src/util/error.cpp @@ -4,7 +4,9 @@ #include +#include #include +#include std::string TransactionErrorString(const TransactionError error) { switch (error) { diff --git a/src/util/system.h b/src/util/system.h --- a/src/util/system.h +++ b/src/util/system.h @@ -41,17 +41,6 @@ extern const char *const BITCOIN_CONF_FILENAME; -/** Translate a message to the native language of the user. */ -const extern std::function G_TRANSLATION_FUN; - -/** - * Translation function. - * If no translation function is set, simply return the input. - */ -inline std::string _(const char *psz) { - return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz; -} - void SetupEnvironment(); bool SetupNetworking(); diff --git a/src/util/system.cpp b/src/util/system.cpp --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include diff --git a/src/util/translation.h b/src/util/translation.h new file mode 100644 --- /dev/null +++ b/src/util/translation.h @@ -0,0 +1,21 @@ +// Copyright (c) 2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_UTIL_TRANSLATION_H +#define BITCOIN_UTIL_TRANSLATION_H + +#include + +/** Translate a message to the native language of the user. */ +const extern std::function G_TRANSLATION_FUN; + +/** + * Translation function. + * If no translation function is set, simply return the input. + */ +inline std::string _(const char *psz) { + return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz; +} + +#endif // BITCOIN_UTIL_TRANSLATION_H diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include // boost::this_thread::interruption_point() (mingw) diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp --- a/src/wallet/load.cpp +++ b/src/wallet/load.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include bool VerifyWallets(const CChainParams &chainParams, interfaces::Chain &chain, diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/src/warnings.cpp b/src/warnings.cpp --- a/src/warnings.cpp +++ b/src/warnings.cpp @@ -8,6 +8,7 @@ #include #include #include +#include RecursiveMutex cs_warnings; std::string strMiscWarning;