* [v3] In C++0x mode use only Node_allocator in _Rb_tree too
@ 2008-10-19 18:50 Paolo Carlini
0 siblings, 0 replies; only message in thread
From: Paolo Carlini @ 2008-10-19 18:50 UTC (permalink / raw)
To: Gcc Patch List; +Cc: libstdc++
[-- Attachment #1: Type: text/plain, Size: 123 bytes --]
Hi,
similarly to the recent changes to list. Tested x86_64-linux, committed
to mainline.
Paolo.
///////////////////////
[-- Attachment #2: CL_tree --]
[-- Type: text/plain, Size: 471 bytes --]
2008-10-19 Paolo Carlini <paolo.carlini@oracle.com>
* 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.
[-- Attachment #3: patch_tree --]
[-- Type: text/plain, Size: 4424 bytes --]
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<typename... _Args>
+ _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<typename... _Args>
+ _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<typename _Key_compare,
bool _Is_pod_comparator = __is_pod(_Key_compare)>
--- 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 }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-19 14:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-19 18:50 [v3] In C++0x mode use only Node_allocator in _Rb_tree too Paolo Carlini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).