diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index 7b4d7837d70..9d6351af5a7 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -209,7 +209,7 @@ fi if [[ "${RUN_IWYU}" == true ]]; then # TODO: Consider enforcing IWYU across the entire codebase. - FILES_WITH_ENFORCED_IWYU="/src/((crypto|index|kernel|primitives|univalue/(lib|test)|zmq)/.*\\.cpp|node/blockstorage\\.cpp|node/utxo_snapshot\\.cpp|core_io\\.cpp|signet\\.cpp)" + FILES_WITH_ENFORCED_IWYU="/src/(((crypto|index|kernel|primitives|univalue/(lib|test)|zmq)/.*|common/license_info|node/blockstorage|node/utxo_snapshot|clientversion|core_io|signet)\\.cpp)" jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json" jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns) | not))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_warnings.json" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad18115bbc5..f8588efd199 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -97,6 +97,7 @@ add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL common/config.cpp common/init.cpp common/interfaces.cpp + common/license_info.cpp common/messages.cpp common/netif.cpp common/pcp.cpp diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 2c02d87c655..b0caf2d1ebe 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index fdff656f600..d4702a9cf0f 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/bitcoin-util.cpp b/src/bitcoin-util.cpp index a6fd026b147..aa3fd306679 100644 --- a/src/bitcoin-util.cpp +++ b/src/bitcoin-util.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 6811f8c5ea1..9b0136da4c4 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/bitcoin.cpp b/src/bitcoin.cpp index 5d42bb0472c..827f6cf101e 100644 --- a/src/bitcoin.cpp +++ b/src/bitcoin.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 32db3e7282e..ac731587683 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 86610112ba0..222dafb329c 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -6,10 +6,8 @@ #include -#include -#include - #include +#include #include #include @@ -70,34 +68,3 @@ std::string FormatSubVersion(const std::string& name, int nClientVersion, const if (!comments.empty()) comments_str = strprintf("(%s)", Join(comments, "; ")); return strprintf("/%s:%s%s/", name, FormatVersion(nClientVersion), comments_str); } - -std::string CopyrightHolders(const std::string& strPrefix) -{ - const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION).translated; - std::string strCopyrightHolders = strPrefix + copyright_devs; - - // Make sure Bitcoin Core copyright is not removed by accident - if (copyright_devs.find("Bitcoin Core") == std::string::npos) { - strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers"; - } - return strCopyrightHolders; -} - -std::string LicenseInfo() -{ - const std::string URL_SOURCE_CODE = ""; - - return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2009, COPYRIGHT_YEAR).translated + " ") + "\n" + - "\n" + - strprintf(_("Please contribute if you find %s useful. " - "Visit %s for further information about the software."), - CLIENT_NAME, "<" CLIENT_URL ">") - .translated + - "\n" + - strprintf(_("The source code is available from %s."), URL_SOURCE_CODE).translated + - "\n" + - "\n" + - _("This is experimental software.") + "\n" + - strprintf(_("Distributed under the MIT software license, see the accompanying file %s or %s"), "COPYING", "").translated + - "\n"; -} diff --git a/src/clientversion.h b/src/clientversion.h index 9d09e502acc..f4822a12b69 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -34,11 +34,6 @@ extern const std::string UA_NAME; std::string FormatFullVersion(); std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector& comments); -std::string CopyrightHolders(const std::string& strPrefix); - -/** Returns licensing information (for -version) */ -std::string LicenseInfo(); - #endif // RC_INVOKED #endif // BITCOIN_CLIENTVERSION_H diff --git a/src/common/license_info.cpp b/src/common/license_info.cpp new file mode 100644 index 00000000000..8cf99c2902f --- /dev/null +++ b/src/common/license_info.cpp @@ -0,0 +1,43 @@ +// Copyright (c) The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or https://opensource.org/license/mit/. + +#include // IWYU pragma: keep + +#include + +#include +#include + +#include + +std::string CopyrightHolders(const std::string& strPrefix) +{ + const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION).translated; + std::string strCopyrightHolders = strPrefix + copyright_devs; + + // Make sure Bitcoin Core copyright is not removed by accident + if (copyright_devs.find("Bitcoin Core") == std::string::npos) { + strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers"; + } + return strCopyrightHolders; +} + +std::string LicenseInfo() +{ + const std::string URL_SOURCE_CODE = ""; + + return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2009, COPYRIGHT_YEAR).translated + " ") + "\n" + + "\n" + + strprintf(_("Please contribute if you find %s useful. " + "Visit %s for further information about the software."), + CLIENT_NAME, "<" CLIENT_URL ">") + .translated + + "\n" + + strprintf(_("The source code is available from %s."), URL_SOURCE_CODE).translated + + "\n" + + "\n" + + _("This is experimental software.") + "\n" + + strprintf(_("Distributed under the MIT software license, see the accompanying file %s or %s"), "COPYING", "").translated + + "\n"; +} diff --git a/src/common/license_info.h b/src/common/license_info.h new file mode 100644 index 00000000000..aedb1b7f5f6 --- /dev/null +++ b/src/common/license_info.h @@ -0,0 +1,15 @@ +// Copyright (c) The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or https://opensource.org/license/mit/. + +#ifndef BITCOIN_COMMON_LICENSE_INFO_H +#define BITCOIN_COMMON_LICENSE_INFO_H + +#include + +std::string CopyrightHolders(const std::string& strPrefix); + +/** Returns licensing information (for -version) */ +std::string LicenseInfo(); + +#endif // BITCOIN_COMMON_LICENSE_INFO_H diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 553f6789435..5a89ce0813d 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 99a3a837b99..5784b317601 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp index d3156336973..4402caa0188 100644 --- a/src/test/fuzz/string.cpp +++ b/src/test/fuzz/string.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include