Merge 763c9ddfab6ab47769ec3cf7597818cb814befe1 into 5f4422d68dc3530c353af1f87499de1c864b60ad

This commit is contained in:
Cory Fields 2025-03-17 03:53:31 +01:00 committed by GitHub
commit 3af1e0e078
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 6 deletions

View File

@ -80,9 +80,25 @@ add_library(bitcoinkernel
../validationinterface.cpp ../validationinterface.cpp
../versionbits.cpp ../versionbits.cpp
) )
# Compiler warnings that apply only to the kernel and its dependencies.
# These can be more strict and/or warnings that only apply to shared
# libs.
add_library(kernel_warn_interface INTERFACE)
if(MSVC)
else()
try_append_cxx_flags("-Wunique-object-duplication" TARGET kernel_warn_interface SKIP_LINK)
endif()
# Also manually apply the warnings to the kernel's internal dependencies
target_link_libraries(bitcoin_clientversion PRIVATE kernel_warn_interface)
target_link_libraries(bitcoin_crypto PRIVATE kernel_warn_interface)
target_link_libraries(leveldb PRIVATE kernel_warn_interface)
target_link_libraries(bitcoinkernel target_link_libraries(bitcoinkernel
PRIVATE PRIVATE
core_interface core_interface
kernel_warn_interface
bitcoin_clientversion bitcoin_clientversion
bitcoin_crypto bitcoin_crypto
leveldb leveldb

View File

@ -400,3 +400,10 @@ void LockedPoolManager::CreateInstance()
static LockedPoolManager instance(std::move(allocator)); static LockedPoolManager instance(std::move(allocator));
LockedPoolManager::_instance = &instance; LockedPoolManager::_instance = &instance;
} }
LockedPoolManager& LockedPoolManager::Instance()
{
static std::once_flag init_flag;
std::call_once(init_flag, LockedPoolManager::CreateInstance);
return *LockedPoolManager::_instance;
}

View File

@ -219,12 +219,7 @@ class LockedPoolManager : public LockedPool
{ {
public: public:
/** Return the current instance, or create it once */ /** Return the current instance, or create it once */
static LockedPoolManager& Instance() static LockedPoolManager& Instance();
{
static std::once_flag init_flag;
std::call_once(init_flag, LockedPoolManager::CreateInstance);
return *LockedPoolManager::_instance;
}
private: private:
explicit LockedPoolManager(std::unique_ptr<LockedPageAllocator> allocator); explicit LockedPoolManager(std::unique_ptr<LockedPageAllocator> allocator);