dev-libs/boost: Sync with Gentoo

It's from Gentoo commit ad6496f10ac3e6101a9886d73997245f7ff0a69b.
This commit is contained in:
Flatcar Buildbot 2022-12-12 07:14:02 +00:00
parent e6613dff2e
commit 7de0e5f8a9
3 changed files with 0 additions and 189 deletions

View File

@ -1,121 +0,0 @@
https://src.fedoraproject.org/rpms/boost/raw/master/f/boost-1.58.0-pool.patch
https://bugzilla.redhat.com/show_bug.cgi?id=828856
https://bugs.gentoo.org/620468
https://svn.boost.org/trac10/ticket/6701
--- a/boost/pool/pool.hpp
+++ b/boost/pool/pool.hpp
@@ -27,4 +27,6 @@
#include <boost/pool/poolfwd.hpp>
+// std::numeric_limits
+#include <boost/limits.hpp>
// boost::integer::static_lcm
#include <boost/integer/common_factor_ct.hpp>
@@ -356,4 +358,11 @@
}
+ size_type max_chunks() const
+ { //! Calculated maximum number of memory chunks that can be allocated in a single call by this Pool.
+ size_type partition_size = alloc_size();
+ size_type POD_size = integer::static_lcm<sizeof(size_type), sizeof(void *)>::value + sizeof(size_type);
+ return (std::numeric_limits<size_type>::max() - POD_size) / alloc_size();
+ }
+
static void * & nextof(void * const ptr)
{ //! \returns Pointer dereferenced.
@@ -375,5 +384,7 @@
//! the first time that object needs to allocate system memory.
//! The default is 32. This parameter may not be 0.
- //! \param nmax_size is the maximum number of chunks to allocate in one block.
+ //! \param nmax_size is the maximum number of chunks to allocate in one block.
+ set_next_size(nnext_size);
+ set_max_size(nmax_size);
}
@@ -398,7 +409,7 @@
}
void set_next_size(const size_type nnext_size)
- { //! Set number of chunks to request from the system the next time that object needs to allocate system memory. This value should never be set to 0.
- //! \returns nnext_size.
- next_size = start_size = nnext_size;
+ { //! Set number of chunks to request from the system the next time that object needs to allocate system memory. This value should never be set to 0.
+ BOOST_USING_STD_MIN();
+ next_size = start_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(nnext_size, max_chunks());
}
size_type get_max_size() const
@@ -408,5 +419,6 @@
void set_max_size(const size_type nmax_size)
{ //! Set max_size.
- max_size = nmax_size;
+ BOOST_USING_STD_MIN();
+ max_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(nmax_size, max_chunks());
}
size_type get_requested_size() const
@@ -709,7 +721,7 @@
BOOST_USING_STD_MIN();
if(!max_size)
- next_size <<= 1;
+ set_next_size(next_size << 1);
else if( next_size*partition_size/requested_size < max_size)
- next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size);
+ set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size));
// initialize it,
@@ -749,7 +761,7 @@
BOOST_USING_STD_MIN();
if(!max_size)
- next_size <<= 1;
+ set_next_size(next_size << 1);
else if( next_size*partition_size/requested_size < max_size)
- next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size);
+ set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size));
// initialize it,
@@ -793,4 +805,6 @@
//! \returns Address of chunk n if allocated ok.
//! \returns 0 if not enough memory for n chunks.
+ if (n > max_chunks())
+ return 0;
const size_type partition_size = alloc_size();
@@ -841,7 +855,7 @@
BOOST_USING_STD_MIN();
if(!max_size)
- next_size <<= 1;
+ set_next_size(next_size << 1);
else if( next_size*partition_size/requested_size < max_size)
- next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size);
+ set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size));
// insert it into the list,
--- a/libs/pool/test/test_bug_6701.cpp
+++ b/libs/pool/test/test_bug_6701.cpp
@@ -0,0 +1,27 @@
+/* Copyright (C) 2012 Étienne Dupuis
+*
+* Use, modification and distribution is subject to the
+* Boost Software License, Version 1.0. (See accompanying
+* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Test of bug #6701 (https://svn.boost.org/trac/boost/ticket/6701)
+
+#include <boost/pool/object_pool.hpp>
+#include <boost/limits.hpp>
+
+int main()
+{
+ boost::pool<> p(1024, std::numeric_limits<size_t>::max() / 768);
+
+ void *x = p.malloc();
+ BOOST_ASSERT(!x);
+
+ BOOST_ASSERT(std::numeric_limits<size_t>::max() / 1024 >= p.get_next_size());
+ BOOST_ASSERT(std::numeric_limits<size_t>::max() / 1024 >= p.get_max_size());
+
+ void *y = p.ordered_malloc(std::numeric_limits<size_t>::max() / 768);
+ BOOST_ASSERT(!y);
+
+ return 0;
+}

View File

@ -1,29 +0,0 @@
--- a/libs/locale/build/Jamfile.v2
+++ b/libs/locale/build/Jamfile.v2
@@ -65,8 +65,8 @@
if $(ICU_LINK)
{
- ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <runtime-link>shared ;
- ICU64_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin64 <runtime-link>shared ;
+ ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <runtime-link>shared ;
+ ICU64_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <runtime-link>shared ;
}
else
{
@@ -124,7 +124,6 @@
<library>icuuc/<link>shared/<runtime-link>shared
<library>icudt/<link>shared/<runtime-link>shared
<library>icuin/<link>shared/<runtime-link>shared
- <dll-path>$(ICU_PATH)/bin
<runtime-link>shared ;
@@ -183,7 +182,6 @@
<library>icuuc_64/<link>shared/<runtime-link>shared
<library>icudt_64/<link>shared/<runtime-link>shared
<library>icuin_64/<link>shared/<runtime-link>shared
- <dll-path>$(ICU_PATH)/bin64
<runtime-link>shared ;

View File

@ -1,39 +0,0 @@
https://github.com/boostorg/boost/commit/791442bf1ed7a3b14893ed9e73ef2ab32b2a6026, and
https://github.com/boostorg/config/commit/1a55d1d9c6d1cf7739645080bdd92fe903b4211e without the file renaming.
--- a/boostcpp.jam
+++ b/boostcpp.jam
@@ -634,7 +634,7 @@ rule address-model ( )
return <conditional>@boostcpp.deduce-address-model ;
}
-local deducable-architectures = arm mips1 power riscv s390x sparc x86 combined ;
+local deducable-architectures = arm mips power riscv s390x sparc x86 combined ;
feature.feature deduced-architecture : $(deducable-architectures) : propagated optional composite hidden ;
for a in $(deducable-architectures)
{
@@ -645,10 +645,10 @@ rule deduce-architecture ( properties * )
{
local result ;
local filtered = [ toolset-properties $(properties) ] ;
- local names = arm mips1 power riscv s390x sparc x86 combined ;
+ local names = arm mips power riscv s390x sparc x86 combined ;
local idx = [ configure.find-builds "default architecture" : $(filtered)
: /boost/architecture//arm
- : /boost/architecture//mips1
+ : /boost/architecture//mips
: /boost/architecture//power
: /boost/architecture//riscv
: /boost/architecture//s390x
--- a/libs/config/checks/architecture/Jamfile.jam
+++ b/libs/config/checks/architecture/Jamfile.jam
@@ -18,7 +18,8 @@ obj 64 : 64.cpp ;
obj arm : arm.cpp ;
obj combined : combined.cpp ;
-obj mips1 : mips1.cpp ;
+obj mips : mips1.cpp ;
+alias mips1 : mips ; # Backwards compatibility
obj power : power.cpp ;
obj riscv : riscv.cpp ;
obj sparc : sparc.cpp ;