From 290df23d487c1da49f4eb53d40d06e2499e4e424 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 1 Sep 2011 15:45:20 +0000 Subject: [PATCH] hashtable.h (_Hashtable<>::_Hashtable(_Hashtable&&)): Remove noexcept, the move constructor allocates memory... 2011-09-01 Paolo Carlini * include/bits/hashtable.h (_Hashtable<>::_Hashtable(_Hashtable&&)): Remove noexcept, the move constructor allocates memory; rearrange the code in the body to consistently update __ht._M_rehash_policy before using _M_next_bkt on it. * include/debug/unordered_map: Adjust. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * testsuite/23_containers/unordered_map/cons/ noexcept_move_construct.cc: Remove. * testsuite/23_containers/unordered_set/cons/ noexcept_move_construct.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/ noexcept_move_construct.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/ noexcept_move_construct.cc: Likewise. From-SVN: r178423 --- libstdc++-v3/ChangeLog | 19 +++++++++++++ libstdc++-v3/include/bits/hashtable.h | 9 +++---- libstdc++-v3/include/debug/unordered_map | 4 --- libstdc++-v3/include/debug/unordered_set | 4 --- libstdc++-v3/include/profile/unordered_map | 4 --- libstdc++-v3/include/profile/unordered_set | 4 --- .../cons/noexcept_move_construct.cc | 27 ------------------- .../cons/noexcept_move_construct.cc | 27 ------------------- .../cons/noexcept_move_construct.cc | 27 ------------------- .../cons/noexcept_move_construct.cc | 27 ------------------- 10 files changed, 22 insertions(+), 130 deletions(-) delete mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc delete mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc delete mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc delete mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9fc043de476..386a15e3de7 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,22 @@ +2011-09-01 Paolo Carlini + + * include/bits/hashtable.h (_Hashtable<>::_Hashtable(_Hashtable&&)): + Remove noexcept, the move constructor allocates memory; rearrange + the code in the body to consistently update __ht._M_rehash_policy + before using _M_next_bkt on it. + * include/debug/unordered_map: Adjust. + * include/debug/unordered_set: Likewise. + * include/profile/unordered_map: Likewise. + * include/profile/unordered_set: Likewise. + * testsuite/23_containers/unordered_map/cons/ + noexcept_move_construct.cc: Remove. + * testsuite/23_containers/unordered_set/cons/ + noexcept_move_construct.cc: Likewise. + * testsuite/23_containers/unordered_multimap/cons/ + noexcept_move_construct.cc: Likewise. + * testsuite/23_containers/unordered_multiset/cons/ + noexcept_move_construct.cc: Likewise. + 2011-08-31 Paolo Carlini * include/std/chrono (operator*(const _Rep1&, const duration<>&)): diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index d72c78bbdf2..ed9bdb380bc 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -674,8 +674,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>:: _Hashtable(_Hashtable&& __ht) - noexcept(__and_, - is_nothrow_copy_constructible<_H1>>::value) : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht), __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, __chc>(__ht), @@ -687,12 +685,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_element_count(__ht._M_element_count), _M_rehash_policy(__ht._M_rehash_policy) { - size_type __n_bkt = __ht._M_rehash_policy._M_next_bkt(0); - __ht._M_buckets = __ht._M_allocate_buckets(__n_bkt); - __ht._M_bucket_count = __n_bkt; + __ht._M_rehash_policy = _RehashPolicy(); + __ht._M_bucket_count = __ht._M_rehash_policy._M_next_bkt(0); + __ht._M_buckets = __ht._M_allocate_buckets(__ht._M_bucket_count); __ht._M_begin_bucket_index = __ht._M_bucket_count; __ht._M_element_count = 0; - __ht._M_rehash_policy = _RehashPolicy(); } template, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { } unordered_map(initializer_list __l, @@ -485,8 +483,6 @@ namespace __debug : _Base(__x) { } unordered_multimap(unordered_multimap&& __x) - noexcept(__and_, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { } unordered_multimap(initializer_list __l, diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set index 5be37247584..0cc3a12cf37 100644 --- a/libstdc++-v3/include/debug/unordered_set +++ b/libstdc++-v3/include/debug/unordered_set @@ -104,8 +104,6 @@ namespace __debug : _Base(__x) { } unordered_set(unordered_set&& __x) - noexcept(__and_, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { } unordered_set(initializer_list __l, @@ -480,8 +478,6 @@ namespace __debug : _Base(__x) { } unordered_multiset(unordered_multiset&& __x) - noexcept(__and_, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { } unordered_multiset(initializer_list __l, diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index 5bbb7aea6d8..5722771f425 100644 --- a/libstdc++-v3/include/profile/unordered_map +++ b/libstdc++-v3/include/profile/unordered_map @@ -104,8 +104,6 @@ namespace __profile } unordered_map(unordered_map&& __x) - noexcept(__and_, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { __profcxx_hashtable_construct(this, _Base::bucket_count()); @@ -374,8 +372,6 @@ namespace __profile } unordered_multimap(unordered_multimap&& __x) - noexcept(__and_, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { __profcxx_hashtable_construct(this, _Base::bucket_count()); diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set index 51b42db9633..cb3a0e17451 100644 --- a/libstdc++-v3/include/profile/unordered_set +++ b/libstdc++-v3/include/profile/unordered_set @@ -103,8 +103,6 @@ namespace __profile } unordered_set(unordered_set&& __x) - noexcept(__and_, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { __profcxx_hashtable_construct(this, _Base::bucket_count()); @@ -348,8 +346,6 @@ namespace __profile } unordered_multiset(unordered_multiset&& __x) - noexcept(__and_, - is_nothrow_copy_constructible<_Pred>>::value) : _Base(std::move(__x)) { __profcxx_hashtable_construct(this, _Base::bucket_count()); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc deleted file mode 100644 index cb2116873ed..00000000000 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc +++ /dev/null @@ -1,27 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=gnu++0x" } - -// 2011-06-01 Paolo Carlini -// -// Copyright (C) 2011 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -typedef std::unordered_map umtype; - -static_assert(std::is_nothrow_move_constructible::value, "Error"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc deleted file mode 100644 index 45ccee09db3..00000000000 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc +++ /dev/null @@ -1,27 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=gnu++0x" } - -// 2011-06-01 Paolo Carlini -// -// Copyright (C) 2011 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -typedef std::unordered_multimap ummtype; - -static_assert(std::is_nothrow_move_constructible::value, "Error"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc deleted file mode 100644 index 4a1ada81bec..00000000000 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc +++ /dev/null @@ -1,27 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=gnu++0x" } - -// 2011-06-01 Paolo Carlini -// -// Copyright (C) 2011 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -typedef std::unordered_multiset umstype; - -static_assert(std::is_nothrow_move_constructible::value, "Error"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc deleted file mode 100644 index 3e3ec73e09f..00000000000 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc +++ /dev/null @@ -1,27 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=gnu++0x" } - -// 2011-06-01 Paolo Carlini -// -// Copyright (C) 2011 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -typedef std::unordered_set ustype; - -static_assert(std::is_nothrow_move_constructible::value, "Error");