From 1f543216d48d067661962b4e3161218a94fc1c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 28 Nov 2024 13:17:24 +0100 Subject: [PATCH] Disable Wdeprecated-declarations when using deprecated allocator --- include/boost/container/allocator_traits.hpp | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/boost/container/allocator_traits.hpp b/include/boost/container/allocator_traits.hpp index dd5bf0e4..6a385cce 100644 --- a/include/boost/container/allocator_traits.hpp +++ b/include/boost/container/allocator_traits.hpp @@ -533,17 +533,35 @@ struct allocator_traits inline static pointer priv_allocate(dtl::false_type, Allocator &a, size_type n, const_void_pointer) { return a.allocate(n); } + #if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif + template inline static void priv_destroy(dtl::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW { a.destroy(p); } + #if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) + #pragma GCC diagnostic pop + #endif + template inline static void priv_destroy(dtl::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW { p->~T(); (void)p; } + #if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif + inline static size_type priv_max_size(dtl::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a.max_size(); } + #if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) + #pragma GCC diagnostic pop + #endif + inline static size_type priv_max_size(dtl::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return size_type(-1)/sizeof(value_type); } @@ -553,6 +571,12 @@ struct allocator_traits inline static const Allocator &priv_select_on_container_copy_construction(dtl::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a; } + + #if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template inline static void priv_construct(dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) @@ -598,6 +622,11 @@ struct allocator_traits #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + #if defined(BOOST_CONTAINER_GCC_COMPATIBLE_HAS_DIAGNOSTIC_IGNORED) + #pragma GCC diagnostic pop + #endif + + template inline static void priv_construct(dtl::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) { ::new((void*)p, boost_container_new_t()) T; }