From 4fcd7aea6113a3fe798e1b039a1f08e0e6c22828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 10 May 2023 22:14:25 +0200 Subject: [PATCH] Workarounds to GCC-12 false positive warning --- include/boost/container/node_handle.hpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/include/boost/container/node_handle.hpp b/include/boost/container/node_handle.hpp index 323b79c..18ec61f 100644 --- a/include/boost/container/node_handle.hpp +++ b/include/boost/container/node_handle.hpp @@ -33,6 +33,12 @@ #include #include +//GCC 12 is confused about maybe uninitialized allocators +#if defined(BOOST_GCC) && (BOOST_GCC >= 120000) && (BOOST_GCC < 130000) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + //!\file @@ -60,11 +66,11 @@ class node_handle_friend public: template - BOOST_CONTAINER_FORCEINLINE static void destroy_alloc(NH &nh) BOOST_NOEXCEPT + inline static void destroy_alloc(NH &nh) BOOST_NOEXCEPT { nh.destroy_alloc(); } template - BOOST_CONTAINER_FORCEINLINE static typename NH::node_pointer &get_node_pointer(NH &nh) BOOST_NOEXCEPT + inline static typename NH::node_pointer &get_node_pointer(NH &nh) BOOST_NOEXCEPT { return nh.get_node_pointer(); } }; @@ -299,10 +305,10 @@ class node_handle //! Returns: m_ptr != nullptr. //! #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED - BOOST_CONTAINER_FORCEINLINE explicit operator bool + inline explicit operator bool #else private: struct bool_conversion {int for_bool; int for_arg(); }; typedef int bool_conversion::* explicit_bool_arg; - public: BOOST_CONTAINER_FORCEINLINE operator explicit_bool_arg + public: inline operator explicit_bool_arg #endif ()const BOOST_NOEXCEPT { return m_ptr ? &bool_conversion::for_bool : explicit_bool_arg(0); } @@ -343,6 +349,7 @@ class node_handle nh.move_construct_alloc(this->node_alloc()); this->destroy_alloc(); } + ::boost::adl_move_swap(m_ptr, nh.m_ptr); } @@ -440,6 +447,10 @@ struct insert_return_type_base } //namespace container { } //namespace boost { +#if defined(BOOST_GCC) && (BOOST_GCC >= 120000) && (BOOST_GCC < 130000) +#pragma GCC diagnostic pop +#endif + #include #endif //BOOST_CONTAINER_NODE_HANDLE_HPP