diff --git a/builds/msvc/vs2022/libbitcoin-system.import.props b/builds/msvc/vs2022/libbitcoin-system.import.props
index 390dc00393..bb11eeb347 100644
--- a/builds/msvc/vs2022/libbitcoin-system.import.props
+++ b/builds/msvc/vs2022/libbitcoin-system.import.props
@@ -51,8 +51,7 @@
WITH_ICU;WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)
BC_STATIC;%(PreprocessorDefinitions)
-
-
+ _CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)
WITH_AVX512;%(PreprocessorDefinitions)
WITH_AVX2;%(PreprocessorDefinitions)
diff --git a/builds/msvc/vs2022/libbitcoin-system/libbitcoin-system.props b/builds/msvc/vs2022/libbitcoin-system/libbitcoin-system.props
index 3bf5c75a6e..bc258cc4e9 100644
--- a/builds/msvc/vs2022/libbitcoin-system/libbitcoin-system.props
+++ b/builds/msvc/vs2022/libbitcoin-system/libbitcoin-system.props
@@ -25,6 +25,7 @@
WITH_ICU;WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)
BC_DLL;%(PreprocessorDefinitions)
BC_STATIC;%(PreprocessorDefinitions)
+ _CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)
WITH_AVX512;%(PreprocessorDefinitions)
WITH_AVX2;%(PreprocessorDefinitions)
diff --git a/include/bitcoin/system/have.hpp b/include/bitcoin/system/have.hpp
index 31ed4f9758..ac4eccd62c 100644
--- a/include/bitcoin/system/have.hpp
+++ b/include/bitcoin/system/have.hpp
@@ -128,10 +128,10 @@
#define HAVE_ICU
#endif
-/// XCPU architecture intrinsics sse41, avx2, avx512f, sha-ni.
+/// XCPU architecture intrinsics sse41, avx2, avx512f/bw, sha-ni.
/// This assumes that avx512 implies avx2 and that all imply sse41.
#if defined(HAVE_XCPU)
- // TODO: CLANG/GCC compile test and set -msse4 -mavx2 -mavx512f -msha.
+ // CLANG/GCC compile with -msse4 -mavx2 -mavx512f/-mavx512bw -msha.
#if defined(WITH_SHANI)
#define HAVE_SHANI
#endif
@@ -204,9 +204,6 @@
#endif
#endif
-/// C++20: parenthesized initialization of aggregates requires clang16/xcode16.
-/// We don't have macro treatment for that, just ad-hoc HAVE_CLANG conditions.
-
/// None on xcode.
/// Requires link with -ltbb on gcc (v9).
/// Experimental on clang (libcxx.llvm.org/Status/PSTL.html), requires:
@@ -227,7 +224,7 @@
#define HAVE_SUPPRESSION
/// Disable noexcept to capture stack trace.
-#define HAVE_NOEXCEPT
+////#define HAVE_NOEXCEPT
/// Disable to emit all suppressed warnings.
#define HAVE_WARNINGS
diff --git a/include/bitcoin/system/intrinsics/haves.hpp b/include/bitcoin/system/intrinsics/haves.hpp
index 282c84f5e8..3e206dc5db 100644
--- a/include/bitcoin/system/intrinsics/haves.hpp
+++ b/include/bitcoin/system/intrinsics/haves.hpp
@@ -74,7 +74,6 @@ namespace cpu1_0
constexpr auto avx_ecx_bit = 28;
}
-// wikichip.org/wiki/x86/avx-512
namespace cpu7_0
{
constexpr auto leaf = 7;
diff --git a/include/bitcoin/system/literals.hpp b/include/bitcoin/system/literals.hpp
index d94fd83197..60560fe888 100644
--- a/include/bitcoin/system/literals.hpp
+++ b/include/bitcoin/system/literals.hpp
@@ -35,7 +35,7 @@ namespace libbitcoin {
/// not be subject to regressions in other code, as a break here causes a large
/// number of test and other failures. See tests for usage and detailed info.
/// ---------------------------------------------------------------------------
-/// These should be consteval for safety, but waiting on clang++20 to catch up.
+/// These should be consteval for safety, but waiting on clang++ v17.
// Functions are consteval where available (bogus warning).
BC_PUSH_WARNING(USE_CONSTEXPR_FOR_FUNCTION)
diff --git a/include/bitcoin/system/preprocessor.hpp b/include/bitcoin/system/preprocessor.hpp
index f3808b8bca..ccade62d24 100644
--- a/include/bitcoin/system/preprocessor.hpp
+++ b/include/bitcoin/system/preprocessor.hpp
@@ -32,6 +32,22 @@
/// Debugging.
/// ---------------------------------------------------------------------------
+/// Enables ETW tracing for VS memory profiler.
+#if defined(HAVE_MSC)
+ #define ALLOCATOR __declspec(allocator)
+#else
+ #define ALLOCATOR
+#endif
+
+/// learn.microsoft.com/en-us/cpp/c-runtime-library/
+/// find-memory-leaks-using-the-crt-library
+/// _CRTDBG_MAP_ALLOC must be prior to the includes, so defined in props.
+#if defined(HAVE_MSC) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
+ #include
+ #include
+ ////_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+#endif
+
/// NDEBUG (conditional exclusion).
#if defined(NDEBUG)
#define BC_ASSERT(expression)
@@ -44,13 +60,6 @@
#define BC_DEBUG_ONLY(expression) expression
#endif
-/// Enables ETW tracing for VS memory profiler.
-#if defined(HAVE_MSC)
- #define ALLOCATOR __declspec(allocator)
-#else
- #define ALLOCATOR
-#endif
-
/// Messages.
/// ---------------------------------------------------------------------------
diff --git a/src/arena.cpp b/src/arena.cpp
index 936b868fe2..1ea64cf81f 100644
--- a/src/arena.cpp
+++ b/src/arena.cpp
@@ -18,12 +18,11 @@
*/
#include
+#include
#include
namespace libbitcoin {
-BC_PUSH_WARNING(NO_NEW_OR_DELETE)
-
bool operator==(const arena& left, const arena& right) NOEXCEPT
{
return &left == &right || left.is_equal(right);
@@ -41,14 +40,18 @@ void* default_arena::do_allocate(size_t bytes, size_t) THROWS
{
////if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
//// return ::operator new(bytes, std::align_val_t{ align });
- return ::operator new(bytes);
+ BC_PUSH_WARNING(NO_MALLOC_OR_FREE)
+ return std::malloc(bytes);
+ BC_POP_WARNING()
}
void default_arena::do_deallocate(void* ptr, size_t, size_t) NOEXCEPT
{
////if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
//// ::operator delete(ptr, std::align_val_t{ align });
- ::operator delete(ptr);
+ BC_PUSH_WARNING(NO_MALLOC_OR_FREE)
+ std::free(ptr);
+ BC_POP_WARNING()
}
bool default_arena::do_is_equal(const arena& other) const NOEXCEPT
@@ -57,6 +60,7 @@ bool default_arena::do_is_equal(const arena& other) const NOEXCEPT
return &other == this;
}
+// null return indicates that this arena is not detachable.
void* default_arena::start(size_t) THROWS
{
return nullptr;
@@ -71,6 +75,4 @@ void default_arena::release(void*) NOEXCEPT
{
}
-BC_POP_WARNING()
-
} // namespace libbitcoin
diff --git a/src/chain/block.cpp b/src/chain/block.cpp
index 31c05c7f5a..0a750b596f 100644
--- a/src/chain/block.cpp
+++ b/src/chain/block.cpp
@@ -20,7 +20,6 @@
#include
#include
-#include
#include
#include
#include
diff --git a/src/chain/point.cpp b/src/chain/point.cpp
index 05fa87f309..9d9c29dbcf 100644
--- a/src/chain/point.cpp
+++ b/src/chain/point.cpp
@@ -18,7 +18,6 @@
*/
#include
-#include
#include
#include
#include
diff --git a/src/chain/script.cpp b/src/chain/script.cpp
index b0384cdad8..bc06d44521 100644
--- a/src/chain/script.cpp
+++ b/src/chain/script.cpp
@@ -20,7 +20,6 @@
#include
#include
-#include
#include
#include
#include
diff --git a/src/chain/transaction.cpp b/src/chain/transaction.cpp
index f90f6ad928..7a6da3ac44 100644
--- a/src/chain/transaction.cpp
+++ b/src/chain/transaction.cpp
@@ -20,7 +20,6 @@
#include
#include
-#include
#include
#include
#include
diff --git a/test/allocator.cpp b/test/allocator.cpp
index 88f0ff1f62..5ade65cc17 100644
--- a/test/allocator.cpp
+++ b/test/allocator.cpp
@@ -26,10 +26,6 @@ BC_PUSH_WARNING(NO_UNGUARDED_POINTERS)
BC_PUSH_WARNING(NO_DELETE_RAW_POINTER)
BC_PUSH_WARNING(NO_UNCLEARED_OWNER_POINTER)
-// Clang is not yet C++20 compliant in terms of aggregate initialization.
-// See [reviews.llvm.org/D140327] for details. So vectors provide constructors.
-///////////////////////////////////////////////////////////////////////////////
-
struct simple
{
simple(size_t arg={}) NOEXCEPT