From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id EEE29389A12F; Fri, 16 Sep 2022 15:02:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EEE29389A12F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663340532; bh=NHfimtE6/oSLRstiUI1Td59ClhbZ/feSL2dD6eCaUYo=; h=From:To:Subject:Date:From; b=rTrxAzrU/Q3kQUGPYGxOXtdC4M0sTfqNMSv4zvv9JttVyfCg5jQVV40ZkZlUvhDq5 P1UasQUZ8fTEyzTOFZKoufiJppFWn+B1Y2kuy6mehPIIKnygOf9c13B0MmXgACQiKZ 56WS77iN91V6CkKM62nDw4iRALL1W67jdURQLfPA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-2698] libstdc++: Remove __alloc_neq helper X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 64f9580423eef22b81a7e90be851c81dc6e04778 X-Git-Newrev: 15943285867a6952dbc5a603c434e61bfe32296f Message-Id: <20220916150212.EEE29389A12F@sourceware.org> Date: Fri, 16 Sep 2022 15:02:12 +0000 (GMT) List-Id: https://gcc.gnu.org/g:15943285867a6952dbc5a603c434e61bfe32296f commit r13-2698-g15943285867a6952dbc5a603c434e61bfe32296f Author: Jonathan Wakely Date: Fri Sep 16 11:39:41 2022 +0100 libstdc++: Remove __alloc_neq helper This class template and partial specialization were added 15 years ago to optimize allocator equality comparisons in std::list. I think it's safe to assume that GCC is now capable of optimizing an inline operator!= that just returns false at least as well as an inline member function that just returns false. libstdc++-v3/ChangeLog: * include/bits/allocator.h (__alloc_neq): Remove. * include/bits/stl_list.h (list::_M_check_equal_allocators): Compare allocators directly, without __alloc_neq. Diff: --- libstdc++-v3/include/bits/allocator.h | 17 ----------------- libstdc++-v3/include/bits/stl_list.h | 5 ++--- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 28abf13eba9..c39166e24fe 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -298,23 +298,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } }; - // Optimize for stateless allocators. - template - struct __alloc_neq - { - static bool - _S_do_it(const _Alloc&, const _Alloc&) - { return false; } - }; - - template - struct __alloc_neq<_Alloc, false> - { - static bool - _S_do_it(const _Alloc& __one, const _Alloc& __two) - { return __one != __two; } - }; - #if __cplusplus >= 201103L template, diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index b8bd46191fc..a73ca60df5a 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -2026,10 +2026,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // To implement the splice (and merge) bits of N1599. void - _M_check_equal_allocators(list& __x) _GLIBCXX_NOEXCEPT + _M_check_equal_allocators(const list& __x) _GLIBCXX_NOEXCEPT { - if (std::__alloc_neq:: - _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator())) + if (_M_get_Node_allocator() != __x._M_get_Node_allocator()) __builtin_abort(); }