diff --git a/src/Makefile.am b/src/Makefile.am index 83690a923637..c266dc4a7055 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -260,13 +260,21 @@ BITCOIN_CORE_H = \ ui_interface.h \ undo.h \ unordered_lru_cache.h \ - util.h \ - utilasmap.h \ - utilmemory.h \ - utilmoneystr.h \ - utilstring.h \ - utiltime.h \ - utilthreadnames.h \ + util/bytevectorhash.h \ + util/error.h \ + util/fees.h \ + util/system.h \ + util/asmap.h \ + util/macros.h \ + util/memory.h \ + util/moneystr.h \ + util/serfloat.h \ + util/string.h \ + util/time.h \ + util/threadnames.h \ + util/vector.h \ + util/url.h \ + util/validation.h \ validation.h \ validationinterface.h \ versionbits.h \ @@ -444,7 +452,9 @@ crypto_libdash_crypto_base_a_SOURCES = \ crypto/sha3.cpp \ crypto/sha3.h \ crypto/sha512.cpp \ - crypto/sha512.h + crypto/sha512.h \ + crypto/siphash.cpp \ + crypto/siphash.h if USE_ASM crypto_libdash_crypto_base_a_SOURCES += crypto/sha256_sse4.cpp @@ -529,8 +539,8 @@ libdash_consensus_a_SOURCES = \ tinyformat.h \ uint256.cpp \ uint256.h \ - utilstrencodings.cpp \ - utilstrencodings.h \ + util/strencodings.cpp \ + util/strencodings.h \ version.h # common: shared between dashd, and dash-qt and non-server tools @@ -588,13 +598,19 @@ libdash_util_a_SOURCES = \ support/cleanse.cpp \ sync.cpp \ threadinterrupt.cpp \ - util.cpp \ - utilasmap.cpp \ - utilmoneystr.cpp \ - utilstrencodings.cpp \ - utiltime.cpp \ - utilstring.cpp \ - utilthreadnames.cpp \ + util/bytevectorhash.cpp \ + util/error.cpp \ + util/fees.cpp \ + util/system.cpp \ + util/asmap.cpp \ + util/moneystr.cpp \ + util/strencodings.cpp \ + util/time.cpp \ + util/serfloat.cpp \ + util/string.cpp \ + util/threadnames.cpp \ + util/url.cpp \ + util/validation.cpp \ $(BITCOIN_CORE_H) if GLIBC_BACK_COMPAT diff --git a/src/addrdb.cpp b/src/addrdb.cpp index c7183b226c7d..4023cf7d0d0f 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace { diff --git a/src/addrman.h b/src/addrman.h index 3c725a0172f3..26c03c4c7ae1 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index ea08dbf55d53..cdde91c568ee 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/src/attributes.h b/src/attributes.h index 9d5c1d44a04c..995c24e13f04 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -6,19 +6,6 @@ #ifndef BITCOIN_ATTRIBUTES_H #define BITCOIN_ATTRIBUTES_H -#if defined(__has_cpp_attribute) -# if __has_cpp_attribute(nodiscard) -# define NODISCARD [[nodiscard]] -# endif -#endif -#ifndef NODISCARD -# if defined(_MSC_VER) && _MSC_VER >= 1700 -# define NODISCARD _Check_return_ -# else -# define NODISCARD __attribute__((warn_unused_result)) -# endif -#endif - #if defined(__clang__) # if __has_attribute(lifetimebound) # define LIFETIMEBOUND [[clang::lifetimebound]] diff --git a/src/base58.cpp b/src/base58.cpp index f2f0f1373ea2..306547ce1e2e 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/src/base58.h b/src/base58.h index 230e4392a3c8..038e3288cd3f 100644 --- a/src/base58.h +++ b/src/base58.h @@ -35,13 +35,13 @@ std::string EncodeBase58(const std::vector& vch); * return true if decoding is successful. * psz cannot be nullptr. */ -NODISCARD bool DecodeBase58(const char* psz, std::vector& vchRet); +[[nodiscard]] bool DecodeBase58(const char* psz, std::vector& vchRet); /** * Decode a base58-encoded string (str) into a byte vector (vchRet). * return true if decoding is successful. */ -NODISCARD bool DecodeBase58(const std::string& str, std::vector& vchRet); +[[nodiscard]] bool DecodeBase58(const std::string& str, std::vector& vchRet); /** * Encode a byte vector into a base58-encoded string, including checksum @@ -52,12 +52,12 @@ std::string EncodeBase58Check(const std::vector& vchIn); * Decode a base58-encoded string (psz) that includes a checksum into a byte * vector (vchRet), return true if decoding is successful */ -NODISCARD bool DecodeBase58Check(const char* psz, std::vector& vchRet); +[[nodiscard]] bool DecodeBase58Check(const char* psz, std::vector& vchRet); /** * Decode a base58-encoded string (str) that includes a checksum into a byte * vector (vchRet), return true if decoding is successful */ -NODISCARD bool DecodeBase58Check(const std::string& str, std::vector& vchRet); +[[nodiscard]] bool DecodeBase58Check(const std::string& str, std::vector& vchRet); #endif // BITCOIN_BASE58_H diff --git a/src/batchedlogger.cpp b/src/batchedlogger.cpp index 009dc405dc65..55aaa7fec6d2 100644 --- a/src/batchedlogger.cpp +++ b/src/batchedlogger.cpp @@ -3,7 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#include +#include CBatchedLogger::CBatchedLogger(BCLog::LogFlags _category, const std::string& _header) : accept(LogAcceptCategory(_category)), header(_header) diff --git a/src/bech32.cpp b/src/bech32.cpp index c55f22b9b75f..d1ad9c0cb19c 100644 --- a/src/bech32.cpp +++ b/src/bech32.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include +#include namespace { @@ -24,13 +25,6 @@ const int8_t CHARSET_REV[128] = { 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1 }; -/** Concatenate two byte arrays. */ -data Cat(data x, const data& y) -{ - x.insert(x.end(), y.begin(), y.end()); - return x; -} - /** This function will compute what 6 5-bit values to XOR into the last 6 input values, in order to * make the checksum 0. These 6 values are packed together in a single 30-bit integer. The higher * bits correspond to earlier values. */ diff --git a/src/bench/bench_dash.cpp b/src/bench/bench_dash.cpp index fece0a9d263a..fcbc5f50ac10 100644 --- a/src/bench/bench_dash.cpp +++ b/src/bench/bench_dash.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/bench/bls.cpp b/src/bench/bls.cpp index 28f7cbef9d7a..8e1e92c2c004 100644 --- a/src/bench/bls.cpp +++ b/src/bench/bls.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include diff --git a/src/bench/checkqueue.cpp b/src/bench/checkqueue.cpp index b0a92ab08879..1bb81809d91f 100644 --- a/src/bench/checkqueue.cpp +++ b/src/bench/checkqueue.cpp @@ -3,7 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#include +#include #include #include #include diff --git a/src/bench/crypto_hash.cpp b/src/bench/crypto_hash.cpp index 65377ac0cd34..783df8368a0b 100644 --- a/src/bench/crypto_hash.cpp +++ b/src/bench/crypto_hash.cpp @@ -10,12 +10,13 @@ #include #include #include -#include +#include #include #include #include #include #include +#include /* Number of bytes to hash per iteration */ static const uint64_t BUFFER_SIZE = 1000*1000; diff --git a/src/bench/examples.cpp b/src/bench/examples.cpp index 718dd6064a10..f54664c2a09f 100644 --- a/src/bench/examples.cpp +++ b/src/bench/examples.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include // Sanity test: this should loop ten times, and // min/max/average should be close to 100ms. diff --git a/src/bench/string_cast.cpp b/src/bench/string_cast.cpp index da285c6e58b2..3cdb161d5534 100644 --- a/src/bench/string_cast.cpp +++ b/src/bench/string_cast.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/src/bench/util_time.cpp b/src/bench/util_time.cpp index 94cef29ac975..72d97354aa55 100644 --- a/src/bench/util_time.cpp +++ b/src/bench/util_time.cpp @@ -4,7 +4,7 @@ #include -#include +#include static void BenchTimeDeprecated(benchmark::State& state) { diff --git a/src/blockencodings.cpp b/src/blockencodings.cpp index daa3aa0b553b..e6cc07e81b5b 100644 --- a/src/blockencodings.cpp +++ b/src/blockencodings.cpp @@ -6,12 +6,13 @@ #include #include #include -#include +#include +#include #include #include #include #include -#include +#include #include diff --git a/src/blockfilter.cpp b/src/blockfilter.cpp index 271104fc62e3..366958102367 100644 --- a/src/blockfilter.cpp +++ b/src/blockfilter.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include +#include #include #include #include