From e054d36dc88d004efb16f6afe1234b4ea94f995c Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 23 Aug 2018 07:08:34 -0400 Subject: Add partial specializations for FixedSizeAllocatorWithCleanup This allocator still has some demons buried inside due to the bit fiddling. This commit should isolate the demons to aligned stack allocations when an alignment facility from the platform or OS is not available. That is, we use CRYPTOPP_ALIGN_DATA when we can because it is most reliable. We can tell when things have gone sideways using Debug builds. The CRYPTOPP_ASSERT(m_allocated) will fire on destruction because the flag gets overwritten. --- config.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config.h') diff --git a/config.h b/config.h index 2d4f970f..67664b2f 100644 --- a/config.h +++ b/config.h @@ -346,10 +346,13 @@ NAMESPACE_END // CRYPTOPP_ALIGN_DATA may not be reliable on AIX. #ifndef CRYPTOPP_ALIGN_DATA #if defined(_MSC_VER) + #define CRYPTOPP_ALIGN_ATTRIBUTE 1 #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x)) #elif defined(__GNUC__) || (__SUNPRO_CC >= 0x5100) + #define CRYPTOPP_ALIGN_ATTRIBUTE 1 #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x))) #elif defined(__xlc__) || defined(__xlC__) + #define CRYPTOPP_ALIGN_ATTRIBUTE 1 #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x))) #else #define CRYPTOPP_ALIGN_DATA(x) -- cgit v1.2.1