From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29473 invoked by alias); 19 Oct 2008 14:52:07 -0000 Received: (qmail 29459 invoked by uid 22791); 19 Oct 2008 14:52:06 -0000 X-Spam-Check-By: sourceware.org Received: from agminet01.oracle.com (HELO agminet01.oracle.com) (141.146.126.228) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 19 Oct 2008 14:51:22 +0000 Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id m9JEpISQ028678; Sun, 19 Oct 2008 09:51:19 -0500 Received: from acsmt705.oracle.com (acsmt705.oracle.com [141.146.40.83]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id m9JEpGhL010031; Sun, 19 Oct 2008 08:51:16 -0600 Received: from [192.168.0.2] (/87.6.221.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 19 Oct 2008 07:51:16 -0700 Message-ID: <48FB4961.8070806@oracle.com> Date: Sun, 19 Oct 2008 18:50:00 -0000 From: Paolo Carlini User-Agent: Thunderbird 2.0.0.17 (X11/20080922) MIME-Version: 1.0 To: Gcc Patch List CC: libstdc++ Subject: [v3] In C++0x mode use only Node_allocator in _Rb_tree too Content-Type: multipart/mixed; boundary="------------030101040207040909050308" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-10/txt/msg00791.txt.bz2 This is a multi-part message in MIME format. --------------030101040207040909050308 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 123 Hi, similarly to the recent changes to list. Tested x86_64-linux, committed to mainline. Paolo. /////////////////////// --------------030101040207040909050308 Content-Type: text/plain; name="CL_tree" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="CL_tree" Content-length: 471 2008-10-19 Paolo Carlini * include/bits/stl_tree.h (_Rb_tree_node<>::_Rb_tree_node<> (_Args&&...)): Add in C++0x mode. (_Rb_tree<>::_M_create_node<>(_Args&&...)): Add in C++0x mode, use _M_get_Node_allocator. (_Rb_tree<>::_M_destroy_node(_Link_type): Use _M_get_Node_allocator in C++0x mode. * testsuite/23_containers/set/operators/1_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/map/operators/1_neg.cc: Likewise. --------------030101040207040909050308 Content-Type: text/plain; name="patch_tree" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch_tree" Content-length: 4424 Index: include/bits/stl_tree.h =================================================================== *** include/bits/stl_tree.h (revision 141220) --- include/bits/stl_tree.h (working copy) *************** _GLIBCXX_BEGIN_NAMESPACE(std) *** 133,138 **** --- 133,145 ---- { typedef _Rb_tree_node<_Val>* _Link_type; _Val _M_value_field; + + #ifdef __GXX_EXPERIMENTAL_CXX0X__ + template + _Rb_tree_node(_Args&&... __args) + : _Rb_tree_node_base(), + _M_value_field(std::forward<_Args>(__args)...) { } + #endif }; _Rb_tree_node_base* *************** _GLIBCXX_BEGIN_NAMESPACE(std) *** 360,365 **** --- 367,373 ---- _M_put_node(_Link_type __p) { _M_impl._Node_allocator::deallocate(__p, 1); } + #ifndef __GXX_EXPERIMENTAL_CXX0X__ _Link_type _M_create_node(const value_type& __x) { *************** _GLIBCXX_BEGIN_NAMESPACE(std) *** 374,379 **** --- 382,420 ---- return __tmp; } + void + _M_destroy_node(_Link_type __p) + { + get_allocator().destroy(&__p->_M_value_field); + _M_put_node(__p); + } + #else + template + _Link_type + _M_create_node(_Args&&... __args) + { + _Link_type __tmp = _M_get_node(); + try + { + _M_get_Node_allocator().construct(__tmp, + std::forward<_Args>(__args)...); + } + catch(...) + { + _M_put_node(__tmp); + __throw_exception_again; + } + return __tmp; + } + + void + _M_destroy_node(_Link_type __p) + { + _M_get_Node_allocator().destroy(__p); + _M_put_node(__p); + } + #endif + _Link_type _M_clone_node(_Const_Link_type __x) { *************** _GLIBCXX_BEGIN_NAMESPACE(std) *** 384,396 **** return __tmp; } - void - _M_destroy_node(_Link_type __p) - { - get_allocator().destroy(&__p->_M_value_field); - _M_put_node(__p); - } - protected: template --- 425,430 ---- Index: testsuite/23_containers/set/operators/1_neg.cc =================================================================== *** testsuite/23_containers/set/operators/1_neg.cc (revision 141220) --- testsuite/23_containers/set/operators/1_neg.cc (working copy) *************** *** 1,6 **** // { dg-do compile } ! // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free --- 1,6 ---- // { dg-do compile } ! // Copyright (C) 2000, 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 *************** void test01() *** 40,44 **** test &= itr == setByName.end(); // { dg-error "no" } } ! // { dg-error "candidates are" "" { target *-*-* } 285 } ! // { dg-error "candidates are" "" { target *-*-* } 289 } --- 40,44 ---- test &= itr == setByName.end(); // { dg-error "no" } } ! // { dg-error "candidates are" "" { target *-*-* } 292 } ! // { dg-error "candidates are" "" { target *-*-* } 296 } Index: testsuite/23_containers/map/operators/1_neg.cc =================================================================== *** testsuite/23_containers/map/operators/1_neg.cc (revision 141220) --- testsuite/23_containers/map/operators/1_neg.cc (working copy) *************** *** 1,6 **** // { dg-do compile } ! // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free --- 1,6 ---- // { dg-do compile } ! // Copyright (C) 2000, 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 *************** void test01() *** 42,46 **** test &= itr == mapByName.end(); // { dg-error "no" } } ! // { dg-error "candidates are" "" { target *-*-* } 210 } ! // { dg-error "candidates are" "" { target *-*-* } 214 } --- 42,46 ---- test &= itr == mapByName.end(); // { dg-error "no" } } ! // { dg-error "candidates are" "" { target *-*-* } 217 } ! // { dg-error "candidates are" "" { target *-*-* } 221 } --------------030101040207040909050308--