From 55aa1b50abdf36e38de370971de02f019f81e59b Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Tue, 31 Dec 2024 07:38:56 +0100 Subject: [PATCH] aligned_alloc: remove old __MSVCRT_VERSION__ checks for mingw-w64 In upstream mingw-w64 the default value of __MSVCRT_VERSION__ was recently changed from 0x700 to 0x600, causing boost/align to fall back to a mingw-w64 provided _aligned_malloc for pre-winxp targets instead of using the default one. See this for details: https://github.com/mingw-w64/mingw-w64/commit/90d3f33f1135b7a9f349267476fe39c27cd96cdc _aligned_malloc is available in msvcrt.dll since WinXP, according to https://github.com/mingw-w64/mingw-w64/blob/03d8a40f57649fbb773f1cdbe3a760f5e0943e76/mingw-w64-crt/lib-common/msvcrt.def.in#L1175-L1206, so assuming boost/align does not support things older than WinXP, just remove the checks and use one implementation for all of Windows instead. _aligned_malloc is provided by mingw-w64 itself since 2009, so this change should not affect compatibility with any of the currently used mingw-w64 versions. --- include/boost/align/aligned_alloc.hpp | 6 +--- .../align/detail/aligned_alloc_mingw.hpp | 34 ------------------- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 include/boost/align/detail/aligned_alloc_mingw.hpp diff --git a/include/boost/align/aligned_alloc.hpp b/include/boost/align/aligned_alloc.hpp index b5b6bd8..4e6e979 100644 --- a/include/boost/align/aligned_alloc.hpp +++ b/include/boost/align/aligned_alloc.hpp @@ -22,12 +22,8 @@ Distributed under the Boost Software License, Version 1.0. #include #elif defined(BOOST_ALIGN_USE_NEW) #include -#elif defined(_MSC_VER) && !defined(UNDER_CE) +#elif defined(_WIN32) && !defined(UNDER_CE) #include -#elif defined(__MINGW32__) && (__MSVCRT_VERSION__ >= 0x0700) -#include -#elif defined(__MINGW32__) -#include #elif MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 #include #elif MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 diff --git a/include/boost/align/detail/aligned_alloc_mingw.hpp b/include/boost/align/detail/aligned_alloc_mingw.hpp deleted file mode 100644 index 36be3d5..0000000 --- a/include/boost/align/detail/aligned_alloc_mingw.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright 2020 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MINGW_HPP -#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MINGW_HPP - -#include -#include -#include - -namespace boost { -namespace alignment { - -inline void* -aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT -{ - BOOST_ASSERT(detail::is_alignment(alignment)); - return ::__mingw_aligned_malloc(size, alignment); -} - -inline void -aligned_free(void* ptr) BOOST_NOEXCEPT -{ - ::__mingw_aligned_free(ptr); -} - -} /* alignment */ -} /* boost */ - -#endif