From: Paolo Carlini Date: Tue, 14 Oct 2008 15:02:45 +0000 (+0000) Subject: stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator for improved accuracy. X-Git-Tag: releases/gcc-4.4.0~2059 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fea874e7a0868d3d77c06286226c974237c45e9;p=thirdparty%2Fgcc.git stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator for improved accuracy. 2008-10-14 Paolo Carlini * include/bits/stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator for improved accuracy. * include/bits/stl_list.h (list<>::max_size): Likewise. * testsuite/23_containers/multimap/capacity/29134.cc: Adjust. * testsuite/23_containers/set/capacity/29134.cc: Likewise. * testsuite/23_containers/multiset/capacity/29134.cc: Likewise. * testsuite/23_containers/list/capacity/29134.cc: Likewise. * testsuite/23_containers/map/capacity/29134.cc: Likewise. From-SVN: r141110 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2d969f127959..63cb52f169a6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2008-10-14 Paolo Carlini + + * include/bits/stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator + for improved accuracy. + * include/bits/stl_list.h (list<>::max_size): Likewise. + * testsuite/23_containers/multimap/capacity/29134.cc: Adjust. + * testsuite/23_containers/set/capacity/29134.cc: Likewise. + * testsuite/23_containers/multiset/capacity/29134.cc: Likewise. + * testsuite/23_containers/list/capacity/29134.cc: Likewise. + * testsuite/23_containers/map/capacity/29134.cc: Likewise. + 2008-10-10 Paolo Carlini * testsuite/20_util/reference_wrapper/24803.cc: Avoid uninitialized diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 91c339c1746f..7f31e3ccfc16 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -807,7 +807,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) /** Returns the size() of the largest possible %list. */ size_type max_size() const - { return _M_get_Tp_allocator().max_size(); } + { return _M_get_Node_allocator().max_size(); } /** * @brief Resizes the %list to the specified number of elements. diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index d922a6db4ddd..73b75e462683 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -1,6 +1,6 @@ // RB tree implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -643,7 +643,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) size_type max_size() const - { return get_allocator().max_size(); } + { return _M_get_Node_allocator().max_size(); } void #ifdef __GXX_EXPERIMENTAL_CXX0X__ diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc index 513466565f62..f334479431a7 100644 --- a/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc +++ b/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -28,7 +28,13 @@ void test01() std::list l; - VERIFY( l.max_size() == l.get_allocator().max_size() ); +#ifndef _GLIBCXX_DEBUG + using std::_List_node; +#else + using std::_GLIBCXX_STD_D::_List_node; +#endif + + VERIFY( l.max_size() == std::allocator<_List_node >().max_size() ); } int main() diff --git a/libstdc++-v3/testsuite/23_containers/map/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/map/capacity/29134.cc index 6383eefa3ab1..b43f091e31ff 100644 --- a/libstdc++-v3/testsuite/23_containers/map/capacity/29134.cc +++ b/libstdc++-v3/testsuite/23_containers/map/capacity/29134.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -28,7 +28,8 @@ void test01() std::map m; - VERIFY( m.max_size() == m.get_allocator().max_size() ); + VERIFY( (m.max_size() == std::allocator > >().max_size()) ); } int main() diff --git a/libstdc++-v3/testsuite/23_containers/multimap/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/multimap/capacity/29134.cc index 466a3341f9e7..c592fd1f1bde 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/capacity/29134.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/capacity/29134.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -28,7 +28,8 @@ void test01() std::multimap mm; - VERIFY( mm.max_size() == mm.get_allocator().max_size() ); + VERIFY( (mm.max_size() == std::allocator > >().max_size()) ); } int main() diff --git a/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc index ddfb165e8d9b..f75e65268ffc 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -28,7 +28,8 @@ void test01() std::multiset ms; - VERIFY( ms.max_size() == ms.get_allocator().max_size() ); + VERIFY( ms.max_size() + == std::allocator >().max_size() ); } int main() diff --git a/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc index 51650399b733..6669f27d1eac 100644 --- a/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc +++ b/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -28,7 +28,8 @@ void test01() std::set s; - VERIFY( s.max_size() == s.get_allocator().max_size() ); + VERIFY( s.max_size() == + std::allocator >().max_size() ); } int main()