From e16db79ffc95d0e1adcfb4b955d6fa708ae19f14 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 29 Jan 2023 21:58:03 -0800 Subject: python3-greenlet: Fix build with gcc13 Signed-off-by: Khem Raj --- ...ythonAllocator-define-missing-rebind-type.patch | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-greenlet/0001-PythonAllocator-define-missing-rebind-type.patch (limited to 'meta-python/recipes-devtools/python/python3-greenlet') diff --git a/meta-python/recipes-devtools/python/python3-greenlet/0001-PythonAllocator-define-missing-rebind-type.patch b/meta-python/recipes-devtools/python/python3-greenlet/0001-PythonAllocator-define-missing-rebind-type.patch new file mode 100644 index 0000000000..01092025de --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-greenlet/0001-PythonAllocator-define-missing-rebind-type.patch @@ -0,0 +1,56 @@ +From 18fb84bb041072503b783ae03c5252f26d2216b8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 29 Jan 2023 21:42:08 -0800 +Subject: [PATCH] PythonAllocator: define missing 'rebind' type + +`gcc-13` added an assert to standard headers to make sure custom +allocators have intended implementation of rebind type instead +of inherited rebind. gcc change: + https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=64c986b49558a7 + +Without the fix build fails on this week's `gcc-13` as: + +| In file included from ../recipe-sysroot/usr/include/c++/13.0.1/ext/alloc_traits.h:34, +| from ../recipe-sysroot/usr/include/c++/13.0.1/bits/basic_string.h:39, +| from ../recipe-sysroot/usr/include/c++/13.0.1/string:54, +| from src/greenlet/greenlet.cpp:10: +| ../recipe-sysroot/usr/include/c++/13.0.1/bits/alloc_traits.h: In instantiation of 'struct std::__allocator_traits_base::__rebind, _greenlet*, void>': +| ../recipe-sysroot/usr/include/c++/13.0.1/bits/alloc_traits.h:94:11: required by substitution of 'template using std::__alloc_rebind = typename std::__allocator_traits_base::__rebind<_Alloc, _Up>::type [with _Alloc = greenlet::PythonAllocator<_greenlet*>; _Up = _greenlet*]' +| ../recipe-sysroot/usr/include/c++/13.0.1/bits/alloc_traits.h:228:8: required by substitution of 'template template using std::allocator_traits< >::rebind_alloc = std::__alloc_rebind<_Alloc, _Tp> [with _Tp = _greenlet*; _Alloc = greenlet::PythonAllocator<_greenlet*>]' +| ../recipe-sysroot/usr/include/c++/13.0.1/ext/alloc_traits.h:126:65: required from 'struct __gnu_cxx::__alloc_traits, _greenlet*>::rebind<_greenlet*>' +| ../recipe-sysroot/usr/include/c++/13.0.1/bits/stl_vector.h:88:21: required from 'struct std::_Vector_base<_greenlet*, greenlet::PythonAllocator<_greenlet*> >' +| ../recipe-sysroot/usr/include/c++/13.0.1/bits/stl_vector.h:423:11: required from 'class std::vector<_greenlet*, greenlet::PythonAllocator<_greenlet*> >' +| src/greenlet/greenlet_thread_state.hpp:115:16: required from here +| ../recipe-sysroot/usr/include/c++/13.0.1/bits/alloc_traits.h:70:31: error: static assertion failed: allocator_traits::rebind_alloc must be A +| 70 | _Tp>::value, +| | ^~~~~ +| ../recipe-sysroot/usr/include/c++/13.0.1/bits/alloc_traits.h:70:31: note: 'std::integral_constant::value' evaluates to false + +The change adds trivial `rebind` definition with expected return type +and satisfies conversion requirements. + +Upstream-Status: Submitted [https://github.com/python-greenlet/greenlet/pull/344] +Signed-off-by: Khem Raj +--- + src/greenlet/greenlet_allocator.hpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/greenlet/greenlet_allocator.hpp b/src/greenlet/greenlet_allocator.hpp +index 666307d..beaa7ed 100644 +--- a/src/greenlet/greenlet_allocator.hpp ++++ b/src/greenlet/greenlet_allocator.hpp +@@ -32,6 +32,11 @@ namespace greenlet + + PythonAllocator() : std::allocator() {} + ++ template struct rebind ++ { ++ typedef PythonAllocator other; ++ }; ++ + T* allocate(size_t number_objects, const void* UNUSED(hint)=0) + { + void* p; +-- +2.39.1 + -- cgit v1.2.3-54-g00ecf