mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
Merge bitcoin/bitcoin#35852: scripted-diff: Use inline const(expr) over static constexpr in headers
fab74a0e92refactor: Use C++14 digit separator for large int literals (MarcoFalke)fae759be79scripted-diff: Use inline constexpr over plain constexpr (MarcoFalke)fa74f58a26scripted-diff: Use inline const over (static) const (MarcoFalke)fab1a62c87refactor: Use inline constexpr for string literals in headers (MarcoFalke)fa08bbed8dcontrib: Adjust generate-seeds.py to write inline constexpr (MarcoFalke)fad753611bscripted-diff: Use inline constexpr over (static) const (MarcoFalke)faedb52583refactor: Make CFeeRate(integral) ctor constexpr (MarcoFalke)5555d5dcb5scripted-diff: Use inline constexpr over static constexpr (MarcoFalke)fa6e1a1e85refactor: Remove static from constexpr functions in headers (MarcoFalke) Pull request description: Both are fine and this refactor doesn't change any behavior. However, `inline constexpr` from C++17 will ensure each symbol has a single address across all TU, making the release binary minimally smaller. (For me it is smaller by about 1kB) ACKs for top commit: l0rinc: reACKfab74a0e92rustaceanrob: ACKfab74a0e92hebasto: ACKfab74a0e92, I have reviewed the code and it looks OK. Tree-SHA512: 6ec94136c12bcbf696812d0661c9857318a69e367c79fc00b9ca0b4068f269d10e5548d95c9ba2070225308c12d7a54fe8cb8447de7e0979cba99f48892b35f9
This commit is contained in:
@@ -49,7 +49,7 @@ public:
|
||||
};
|
||||
|
||||
//! Default maximum number of derivation indexes in a single derivation path when limiting its depth.
|
||||
constexpr int MAX_DEPTH{2};
|
||||
inline constexpr int MAX_DEPTH{2};
|
||||
|
||||
/**
|
||||
* Whether the buffer, if it represents a valid descriptor, contains a derivation path deeper than
|
||||
@@ -58,9 +58,9 @@ constexpr int MAX_DEPTH{2};
|
||||
bool HasDeepDerivPath(std::span<const uint8_t> buff, int max_depth = MAX_DEPTH);
|
||||
|
||||
//! Default maximum number of sub-fragments.
|
||||
constexpr int MAX_SUBS{1'000};
|
||||
inline constexpr int MAX_SUBS{1'000};
|
||||
//! Maximum number of nested sub-fragments we'll allow in a descriptor.
|
||||
constexpr size_t MAX_NESTED_SUBS{10'000};
|
||||
inline constexpr size_t MAX_NESTED_SUBS{10'000};
|
||||
|
||||
/**
|
||||
* Whether the buffer, if it represents a valid descriptor, contains a fragment with more
|
||||
@@ -70,7 +70,7 @@ bool HasTooManySubFrag(std::span<const uint8_t> buff, int max_subs = MAX_SUBS,
|
||||
size_t max_nested_subs = MAX_NESTED_SUBS);
|
||||
|
||||
//! Default maximum number of wrappers per fragment.
|
||||
constexpr int MAX_WRAPPERS{100};
|
||||
inline constexpr int MAX_WRAPPERS{100};
|
||||
|
||||
/**
|
||||
* Whether the buffer, if it represents a valid descriptor, contains a fragment with more
|
||||
@@ -80,7 +80,7 @@ bool HasTooManyWrappers(std::span<const uint8_t> buff, int max_wrappers = MAX_WR
|
||||
|
||||
/// Default maximum leaf size. This should be large enough to cover an extended
|
||||
/// key, including paths "/", inside and outside of "[]".
|
||||
constexpr uint32_t MAX_LEAF_SIZE{200};
|
||||
inline constexpr uint32_t MAX_LEAF_SIZE{200};
|
||||
|
||||
/// Whether the expanded buffer (after calling GetDescriptor() in
|
||||
/// MockedDescriptorConverter) has a leaf size too large.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
const auto NoMalleation = [](AutoFile& file, node::SnapshotMetadata& meta){};
|
||||
inline constexpr auto NoMalleation = [](AutoFile& file, node::SnapshotMetadata& meta){};
|
||||
|
||||
/**
|
||||
* Create and activate a UTXO snapshot, optionally providing a function to
|
||||
|
||||
@@ -118,7 +118,7 @@ struct ConnmanTestMsg : public CConnman {
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
|
||||
};
|
||||
|
||||
constexpr ServiceFlags ALL_SERVICE_FLAGS[]{
|
||||
inline constexpr ServiceFlags ALL_SERVICE_FLAGS[]{
|
||||
NODE_NONE,
|
||||
NODE_NETWORK,
|
||||
NODE_BLOOM,
|
||||
@@ -128,7 +128,7 @@ constexpr ServiceFlags ALL_SERVICE_FLAGS[]{
|
||||
NODE_P2P_V2,
|
||||
};
|
||||
|
||||
constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]{
|
||||
inline constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]{
|
||||
NetPermissionFlags::None,
|
||||
NetPermissionFlags::BloomFilter,
|
||||
NetPermissionFlags::Relay,
|
||||
@@ -141,7 +141,7 @@ constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]{
|
||||
NetPermissionFlags::All,
|
||||
};
|
||||
|
||||
constexpr ConnectionType ALL_CONNECTION_TYPES[]{
|
||||
inline constexpr ConnectionType ALL_CONNECTION_TYPES[]{
|
||||
ConnectionType::INBOUND,
|
||||
ConnectionType::OUTBOUND_FULL_RELAY,
|
||||
ConnectionType::MANUAL,
|
||||
@@ -151,7 +151,7 @@ constexpr ConnectionType ALL_CONNECTION_TYPES[]{
|
||||
ConnectionType::PRIVATE_BROADCAST,
|
||||
};
|
||||
|
||||
constexpr auto ALL_NETWORKS = std::array{
|
||||
inline constexpr auto ALL_NETWORKS = std::array{
|
||||
Network::NET_UNROUTABLE,
|
||||
Network::NET_IPV4,
|
||||
Network::NET_IPV6,
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <script/script.h>
|
||||
#include <script/verify_flags.h>
|
||||
|
||||
static const std::vector<uint8_t> WITNESS_STACK_ELEM_OP_TRUE{uint8_t{OP_TRUE}};
|
||||
static const CScript P2WSH_OP_TRUE{
|
||||
inline const std::vector<uint8_t> WITNESS_STACK_ELEM_OP_TRUE{uint8_t{OP_TRUE}};
|
||||
inline const CScript P2WSH_OP_TRUE{
|
||||
CScript{}
|
||||
<< OP_0
|
||||
<< ToByteVector([] {
|
||||
@@ -19,8 +19,8 @@ static const CScript P2WSH_OP_TRUE{
|
||||
return hash;
|
||||
}())};
|
||||
|
||||
static const std::vector<uint8_t> EMPTY{};
|
||||
static const CScript P2WSH_EMPTY{
|
||||
inline const std::vector<uint8_t> EMPTY{};
|
||||
inline const CScript P2WSH_EMPTY{
|
||||
CScript{}
|
||||
<< OP_0
|
||||
<< ToByteVector([] {
|
||||
@@ -28,8 +28,8 @@ static const CScript P2WSH_EMPTY{
|
||||
CSHA256().Write(EMPTY.data(), EMPTY.size()).Finalize(hash.begin());
|
||||
return hash;
|
||||
}())};
|
||||
static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TRUE_STACK{{static_cast<uint8_t>(OP_TRUE)}, {}};
|
||||
static const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TWO_STACK{{static_cast<uint8_t>(OP_2)}, {}};
|
||||
inline const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TRUE_STACK{{static_cast<uint8_t>(OP_TRUE)}, {}};
|
||||
inline const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TWO_STACK{{static_cast<uint8_t>(OP_2)}, {}};
|
||||
|
||||
/** Flags that are not forbidden by an assert in script validation */
|
||||
bool IsValidFlagCombination(script_verify_flags flags);
|
||||
|
||||
@@ -38,7 +38,7 @@ extern const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUM
|
||||
/** Retrieve the unit test name. */
|
||||
extern const std::function<std::string()> G_TEST_GET_FULL_NAME;
|
||||
|
||||
static constexpr CAmount CENT{1000000};
|
||||
inline constexpr CAmount CENT{1'000'000};
|
||||
|
||||
/** Register common test args. Shared across binaries that rely on the test framework. */
|
||||
void SetupCommonTestArgs(ArgsManager& argsman);
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
#include <versionbits.h>
|
||||
|
||||
/** Total possible bits available for versionbits per original BIP 9 specification */
|
||||
static constexpr int VERSIONBITS_MAX_NUM_BITS{29};
|
||||
inline constexpr int VERSIONBITS_MAX_NUM_BITS{29};
|
||||
|
||||
#endif // BITCOIN_TEST_UTIL_VERSIONBITS_H
|
||||
|
||||
Reference in New Issue
Block a user