diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 50633c89f2f..2869dafa810 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,24 @@ +2019-05-11 Jonathan Wakely + + Remove array_allocator extension, deprecated since 4.9.0 + * doc/xml/manual/allocator.xml: Remove documentation for + array_allocator. + * doc/xml/manual/evolution.xml: Document array_allocator removal. + * doc/xml/manual/using.xml: Remove header from documentation. + * include/Makefile.am: Remove header. + * include/Makefile.in: Regenerate. + * include/ext/array_allocator.h: Remove. + * include/precompiled/extc++.h: Do not include removed header. + * testsuite/ext/array_allocator/1.cc: Remove. + * testsuite/ext/array_allocator/2.cc: Remove. + * testsuite/ext/array_allocator/26875.cc: Remove. + * testsuite/ext/array_allocator/3.cc: Remove. + * testsuite/ext/array_allocator/check_deallocate_null.cc: Remove. + * testsuite/ext/array_allocator/check_delete.cc: Remove. + * testsuite/ext/array_allocator/check_new.cc: Remove. + * testsuite/ext/array_allocator/variadic_construct.cc: Remove. + * testsuite/ext/headers.cc: Do not include removed header. + 2019-05-11 François Dumont * include/bits/stl_bvector.h diff --git a/libstdc++-v3/doc/xml/manual/allocator.xml b/libstdc++-v3/doc/xml/manual/allocator.xml index 8d49b919ff6..2b9a5ca6611 100644 --- a/libstdc++-v3/doc/xml/manual/allocator.xml +++ b/libstdc++-v3/doc/xml/manual/allocator.xml @@ -354,23 +354,6 @@ taken care of elsewhere). - - - array_allocator - - - Allows allocations of known and fixed sizes using existing - global or external storage allocated via construction of - std::tr1::array objects. By using this - allocator, fixed size containers (including - std::string) can be used without - instances calling ::operator new and - ::operator delete. This capability - allows the use of STL abstractions without runtime - complications or overhead, even in situations such as program - startup. For usage examples, please consult the testsuite. - - debug_allocator diff --git a/libstdc++-v3/doc/xml/manual/evolution.xml b/libstdc++-v3/doc/xml/manual/evolution.xml index c7efb8f0f8a..80288694056 100644 --- a/libstdc++-v3/doc/xml/manual/evolution.xml +++ b/libstdc++-v3/doc/xml/manual/evolution.xml @@ -947,4 +947,8 @@ now defaults to zero. +
<constant>10</constant> + __gnu_cxx::array_allocator removed. +
+ diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml index 8e099d9c3d8..a97099989a1 100644 --- a/libstdc++-v3/doc/xml/manual/using.xml +++ b/libstdc++-v3/doc/xml/manual/using.xml @@ -719,7 +719,6 @@ compiler supports scalar decimal floating-point types defined via ext/algorithm ext/atomicity.h -ext/array_allocator.h ext/bitmap_allocator.h ext/cast.h diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 1deacb80ca2..f8f126fbc7d 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -563,7 +563,6 @@ ext_headers = \ ${ext_srcdir}/aligned_buffer.h \ ${ext_srcdir}/alloc_traits.h \ ${ext_srcdir}/atomicity.h \ - ${ext_srcdir}/array_allocator.h \ ${ext_srcdir}/bitmap_allocator.h \ ${ext_srcdir}/cast.h \ ${ext_srcdir}/cmath \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index bc475c6dd90..31e83eab7ec 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -906,7 +906,6 @@ ext_headers = \ ${ext_srcdir}/aligned_buffer.h \ ${ext_srcdir}/alloc_traits.h \ ${ext_srcdir}/atomicity.h \ - ${ext_srcdir}/array_allocator.h \ ${ext_srcdir}/bitmap_allocator.h \ ${ext_srcdir}/cast.h \ ${ext_srcdir}/cmath \ diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h deleted file mode 100644 index c0d4a3497dc..00000000000 --- a/libstdc++-v3/include/ext/array_allocator.h +++ /dev/null @@ -1,182 +0,0 @@ -// array allocator -*- C++ -*- - -// Copyright (C) 2004-2019 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. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** @file ext/array_allocator.h - * This file is a GNU extension to the Standard C++ Library. - */ - -#ifndef _ARRAY_ALLOCATOR_H -#define _ARRAY_ALLOCATOR_H 1 - -#include -#include -#include -#include -#include -#if __cplusplus >= 201103L -#include -#endif - -// Suppress deprecated warning for this file. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - using std::size_t; - using std::ptrdiff_t; - - /// Base class. - template - class array_allocator_base - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - pointer - address(reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - const_pointer - address(const_reference __x) const _GLIBCXX_NOEXCEPT - { return std::__addressof(__x); } - - void - deallocate(pointer, size_type) - { - // Does nothing. - } - - size_type - max_size() const _GLIBCXX_USE_NOEXCEPT - { return size_t(-1) / sizeof(_Tp); } - -#if __cplusplus >= 201103L - template - void - construct(_Up* __p, _Args&&... __args) - { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } - - template - void - destroy(_Up* __p) { __p->~_Up(); } -#else - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 402. wrong new expression in [some_] allocator::construct - void - construct(pointer __p, const _Tp& __val) - { ::new((void *)__p) value_type(__val); } - - void - destroy(pointer __p) { __p->~_Tp(); } -#endif - } _GLIBCXX_DEPRECATED; - - /** - * @brief An allocator that uses previously allocated memory. - * This memory can be externally, globally, or otherwise allocated. - * @ingroup allocators - */ - template > - class array_allocator : public array_allocator_base<_Tp> - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - typedef _Array array_type; - -#if __cplusplus >= 201103L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2103. std::allocator propagate_on_container_move_assignment - typedef std::true_type propagate_on_container_move_assignment; - - typedef std::true_type is_always_equal; -#endif - - private: - array_type* _M_array; - size_type _M_used; - - public: - template - struct rebind - { - typedef array_allocator<_Tp1, _Array1> other _GLIBCXX_DEPRECATED; - } _GLIBCXX_DEPRECATED; - - array_allocator(array_type* __array = 0) _GLIBCXX_USE_NOEXCEPT - : _M_array(__array), _M_used(size_type()) { } - - array_allocator(const array_allocator& __o) _GLIBCXX_USE_NOEXCEPT - : _M_array(__o._M_array), _M_used(__o._M_used) { } - - template - array_allocator(const array_allocator<_Tp1, _Array1>&) - _GLIBCXX_USE_NOEXCEPT - : _M_array(0), _M_used(size_type()) { } - - ~array_allocator() _GLIBCXX_USE_NOEXCEPT { } - - _GLIBCXX_NODISCARD pointer - allocate(size_type __n, const void* = 0) - { - if (_M_array == 0 || _M_used + __n > _M_array->size()) - std::__throw_bad_alloc(); - pointer __ret = _M_array->begin() + _M_used; - _M_used += __n; - return __ret; - } - } _GLIBCXX_DEPRECATED; - - template - inline bool - operator==(const array_allocator<_Tp, _Array>&, - const array_allocator<_Tp, _Array>&) - { return true; } - - template - inline bool - operator!=(const array_allocator<_Tp, _Array>&, - const array_allocator<_Tp, _Array>&) - { return false; } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace - -#pragma GCC diagnostic pop - -#endif diff --git a/libstdc++-v3/include/precompiled/extc++.h b/libstdc++-v3/include/precompiled/extc++.h index 0379a0247a8..e6cf779fb8e 100644 --- a/libstdc++-v3/include/precompiled/extc++.h +++ b/libstdc++-v3/include/precompiled/extc++.h @@ -37,7 +37,6 @@ # include #endif #include -#include #include #include #include diff --git a/libstdc++-v3/testsuite/ext/array_allocator/1.cc b/libstdc++-v3/testsuite/ext/array_allocator/1.cc deleted file mode 100644 index 4c2b2c49d92..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/1.cc +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2004-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -#include -#include -#include - -typedef char char_type; -typedef std::char_traits traits_type; -typedef std::tr1::array array_type; - -array_type extern_array; - -void test01() -{ - using __gnu_cxx::__versa_string; - typedef __gnu_cxx::array_allocator allocator_type; - typedef __versa_string string_type; - - allocator_type a(&extern_array); - string_type s(a); - - try - { - s.reserve(4); // Actually need 4 + 1 + sizeof(std::string::_Rep). - } - catch(std::bad_alloc& obj) - { - VERIFY( true ); - } - catch(...) - { - VERIFY( false ); - } -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/array_allocator/2.cc b/libstdc++-v3/testsuite/ext/array_allocator/2.cc deleted file mode 100644 index 44060415dc0..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/2.cc +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2004-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -#include -#include -#include -#include - -typedef char char_type; -typedef std::char_traits traits_type; -typedef std::tr1::array array_type; - -array_type extern_array; - -void test01() -{ - using __gnu_cxx::__versa_string; - typedef __gnu_cxx::array_allocator allocator_type; - typedef __versa_string string_type; - - allocator_type a(&extern_array); - string_type s(a); - - try - { - s.reserve(4); // Actually need 4 + 1 + sizeof(std::string::_Rep). - } - catch(std::bad_alloc& obj) - { - VERIFY( false ); - } - catch(...) - { - VERIFY( false ); - } - - s.append(1, 'c'); - s.append(2, 'b'); - - std::cout << s.c_str() << std::endl; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/array_allocator/26875.cc b/libstdc++-v3/testsuite/ext/array_allocator/26875.cc deleted file mode 100644 index e72e3b2e0ef..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/26875.cc +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright (C) 2006-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -#include - -// libstdc++/26875 -int main() -{ - typedef std::tr1::array array_type; - array_type Array1; - array_type Array2; - - typedef __gnu_cxx::array_allocator allocator_type; - allocator_type Allocator1(&Array1); - allocator_type Allocator2(&Array2); - - try - { - (void) Allocator1.allocate(1); - (void) Allocator2.allocate(1); - } - catch (std::bad_alloc& ex) - { - // fail, rethrow - throw; - } - - return 0; -} - diff --git a/libstdc++-v3/testsuite/ext/array_allocator/3.cc b/libstdc++-v3/testsuite/ext/array_allocator/3.cc deleted file mode 100644 index 041972f8b74..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/3.cc +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2004-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -#include -#include -#include - -typedef char char_type; -typedef std::char_traits traits_type; -typedef std::tr1::array array_type; - -array_type extern_array; - -void test01() -{ - using __gnu_cxx::__versa_string; - typedef __gnu_cxx::array_allocator allocator_type; - typedef __versa_string string_type; - - // Construct array_allocator without underlying array. - allocator_type a; - string_type s(a); - - try - { - s.reserve(4); // Actually need 4 + 1 + sizeof(std::string::_Rep). - } - catch(std::bad_alloc& obj) - { - VERIFY( true ); - } - catch(...) - { - VERIFY( false ); - } -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/array_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/array_allocator/check_allocate_max_size.cc deleted file mode 100644 index 7bba0c66d70..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/check_allocate_max_size.cc +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (C) 2004-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -// 20.4.1.1 allocator members - -#include -#include - -int main() -{ - typedef int value_type; - typedef __gnu_cxx::array_allocator allocator_type; - __gnu_test::check_allocate_max_size(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/array_allocator/check_deallocate_null.cc b/libstdc++-v3/testsuite/ext/array_allocator/check_deallocate_null.cc deleted file mode 100644 index ae59fcbff4d..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/check_deallocate_null.cc +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright (C) 2004-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -// 20.4.1.1 allocator members - -#include -#include - -int main() -{ - typedef int value_type; - typedef __gnu_cxx::array_allocator allocator_type; - __gnu_test::check_deallocate_null(); - return 0; -} - diff --git a/libstdc++-v3/testsuite/ext/array_allocator/check_delete.cc b/libstdc++-v3/testsuite/ext/array_allocator/check_delete.cc deleted file mode 100644 index 681935371ec..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/check_delete.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 2001-11-25 Phil Edwards -// -// Copyright (C) 2001-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -// 20.4.1.1 allocator members - -#include -#include -#include - -int main() -{ - typedef unsigned int value_type; - typedef std::tr1::array array_type; - typedef __gnu_cxx::array_allocator allocator_type; - array_type store; - allocator_type a(&store); - __gnu_test::check_delete(a); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/array_allocator/check_new.cc b/libstdc++-v3/testsuite/ext/array_allocator/check_new.cc deleted file mode 100644 index 9c515c08582..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/check_new.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 2001-11-25 Phil Edwards -// -// Copyright (C) 2001-2019 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 -// . - -// { dg-options "-Wno-deprecated" } - -// 20.4.1.1 allocator members - -#include -#include -#include - -int main() -{ - typedef unsigned int value_type; - typedef std::tr1::array array_type; - typedef __gnu_cxx::array_allocator allocator_type; - array_type store; - allocator_type a(&store); - __gnu_test::check_new(a); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc deleted file mode 100644 index 880362b0be8..00000000000 --- a/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc +++ /dev/null @@ -1,49 +0,0 @@ -// { dg-do run { target c++11 } } -// { dg-options "-Wno-deprecated" } - -// 2007-10-27 Paolo Carlini - -// Copyright (C) 2007-2019 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 -// . - -// 20.4.1.1 allocator members - -#include -#include -#include - -void test01() -{ - typedef std::pair pair_type; - typedef std::tr1::array array_type; - array_type store; - - __gnu_cxx::array_allocator alloc1(&store); - pair_type* ptp1 = alloc1.allocate(1); - alloc1.construct(ptp1, 3, 'a'); - - VERIFY( ptp1->first == 3 ); - VERIFY( ptp1->second == 'a' ); - - alloc1.deallocate(ptp1, 1); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/headers.cc b/libstdc++-v3/testsuite/ext/headers.cc index b7c3597e700..0e365d6d044 100644 --- a/libstdc++-v3/testsuite/ext/headers.cc +++ b/libstdc++-v3/testsuite/ext/headers.cc @@ -24,7 +24,6 @@ // subdirectory that are meant to be directly included. #include -#include #include #include #if _GLIBCXX_HAVE_ICONV