depends: Fix Boost warnings under Clang 11

C++17 deprecated the two-argument version of std::allocator::allocate.
Starting with 11.0, libc++ enforces these deprecations, which causes
warnings from the Boost headers, and since we require native Linux
builds to be warning-free, this breaks CI.

Boost addressed this issue for MSVC in 1.75; the patch in this commit
forces Clang to be handled in the same way.
This commit is contained in:
Jack Grigg 2021-01-18 21:55:22 +00:00
parent a58d74c6be
commit fa41e9adca
2 changed files with 104 additions and 0 deletions

View File

@ -4,6 +4,7 @@ $(package)_download_path=https://dl.bintray.com/boostorg/release/$(subst _,.,$($
$(package)_file_name=boost_$($(package)_version).tar.bz2
$(package)_sha256_hash=953db31e016db7bb207f11432bef7df100516eeb746843fa0486a222e3fd49cb
$(package)_dependencies=native_b2
$(package)_patches=deprecated-two-arg-allocate.diff
ifneq ($(host_os),darwin)
$(package)_dependencies+=libcxx
@ -41,6 +42,7 @@ endif
endef
define $(package)_preprocess_cmds
patch -p2 < $($(package)_patch_dir)/deprecated-two-arg-allocate.diff && \
echo "using $($(package)_toolset_$(host_os)) : : $($(package)_cxx) : <cflags>\"$($(package)_cflags)\" <cxxflags>\"$($(package)_cxxflags)\" <compileflags>\"$($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$($(package)_ar)\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
endef

View File

@ -0,0 +1,102 @@
diff -ur orig/include/boost/core/allocator_access.hpp patched/include/boost/core/allocator_access.hpp
--- orig/include/boost/core/allocator_access.hpp 2021-01-18 21:42:05.926895400 +0000
+++ patched/include/boost/core/allocator_access.hpp 2021-01-18 21:44:26.426895400 +0000
@@ -11,7 +11,7 @@
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#include <boost/core/pointer_traits.hpp>
-#if !defined(BOOST_MSVC)
+#if !defined(BOOST_MSVC) && !defined(BOOST_CLANG)
#include <limits>
#else
#include <memory>
@@ -49,7 +49,7 @@
struct allocator_pointer {
typedef typename A::pointer type;
};
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A>
struct allocator_pointer {
typedef typename std::allocator_traits<A>::pointer type;
@@ -72,7 +72,7 @@
struct allocator_const_pointer {
typedef typename A::const_pointer type;
};
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A>
struct allocator_const_pointer {
typedef typename std::allocator_traits<A>::const_pointer type;
@@ -137,7 +137,7 @@
struct allocator_difference_type {
typedef typename A::difference_type type;
};
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A>
struct allocator_difference_type {
typedef typename std::allocator_traits<A>::difference_type type;
@@ -161,7 +161,7 @@
struct allocator_size_type {
typedef typename A::size_type type;
};
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A>
struct allocator_size_type {
typedef typename std::allocator_traits<A>::size_type type;
@@ -260,7 +260,7 @@
struct allocator_rebind {
typedef typename A::template rebind<T>::other type;
};
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A, class T>
struct allocator_rebind {
typedef typename std::allocator_traits<A>::template rebind_alloc<T> type;
@@ -313,7 +313,7 @@
{
return a.allocate(n, h);
}
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A>
inline typename allocator_pointer<A>::type
allocator_allocate(A& a, typename allocator_size_type<A>::type n,
@@ -400,7 +400,7 @@
::new((void*)p) T(v);
}
#endif
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A, class T, class... Args>
inline void
allocator_construct(A& a, T* p, Args&&... args)
@@ -449,7 +449,7 @@
p->~T();
(void)p;
}
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A, class T>
inline void
allocator_destroy(A& a, T* p)
@@ -496,7 +496,7 @@
{
return a.max_size();
}
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A>
inline typename allocator_size_type<A>::type
allocator_max_size(const A& a)
@@ -545,7 +545,7 @@
{
return a;
}
-#elif defined(BOOST_MSVC)
+#elif defined(BOOST_MSVC) || defined(BOOST_CLANG)
template<class A>
inline A
allocator_select_on_container_copy_construction(const A& a)