svn commit: r237507 - stable/9/contrib/libstdc++/include/bits
Pedro F. Giffuni
pfg at FreeBSD.org
Sat Jun 23 20:33:29 UTC 2012
Author: pfg
Date: Sat Jun 23 20:33:29 2012
New Revision: 237507
URL: http://svn.freebsd.org/changeset/base/237507
Log:
MFC: r236829
Bring a couple of libstdc++ patches from Apple's llvm-gcc project.
Modified Fri Jul 10 07:44:34 2009 CDT by rafael
backport part of
http://gcc.gnu.org/ml/gcc-cvs/2007-10/msg00118.html
The patch is for libstdc++ and it was GPL2 at the time.
Modified Tue Apr 29 01:20:19 2008 CDT by asl
Backport from mainline (pre-GPLv3).
Fix for sizeof(const void*) > sizeof(unsigned long).
Modified:
stable/9/contrib/libstdc++/include/bits/locale_facets.tcc
stable/9/contrib/libstdc++/include/bits/stl_bvector.h
stable/9/contrib/libstdc++/include/bits/stl_deque.h
stable/9/contrib/libstdc++/include/bits/stl_list.h
stable/9/contrib/libstdc++/include/bits/stl_map.h
stable/9/contrib/libstdc++/include/bits/stl_multimap.h
stable/9/contrib/libstdc++/include/bits/stl_multiset.h
stable/9/contrib/libstdc++/include/bits/stl_set.h
stable/9/contrib/libstdc++/include/bits/stl_tree.h
stable/9/contrib/libstdc++/include/bits/stl_vector.h
Directory Properties:
stable/9/contrib/libstdc++/ (props changed)
Modified: stable/9/contrib/libstdc++/include/bits/locale_facets.tcc
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/locale_facets.tcc Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/locale_facets.tcc Sat Jun 23 20:33:29 2012 (r237507)
@@ -887,7 +887,11 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
const fmtflags __fmt = __io.flags();
__io.flags(__fmt & ~ios_base::basefield | ios_base::hex);
- unsigned long __ul;
+ typedef __gnu_cxx::__conditional_type<(sizeof(void*)
+ <= sizeof(unsigned long)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+
+ _UIntPtrType __ul;
__beg = _M_extract_int(__beg, __end, __io, __err, __ul);
// Reset from hex formatted input.
@@ -1309,8 +1313,12 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
| ios_base::internal);
__io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase));
+ typedef __gnu_cxx::__conditional_type<(sizeof(const void*)
+ <= sizeof(unsigned long)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+
__s = _M_insert_int(__s, __io, __fill,
- reinterpret_cast<unsigned long>(__v));
+ reinterpret_cast<_UIntPtrType>(__v));
__io.flags(__flags);
return __s;
}
Modified: stable/9/contrib/libstdc++/include/bits/stl_bvector.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_bvector.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_bvector.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -385,6 +385,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
_Bit_iterator _M_start;
_Bit_iterator _M_finish;
_Bit_type* _M_end_of_storage;
+
+ _Bvector_impl()
+ : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0)
+ { }
+
_Bvector_impl(const _Bit_alloc_type& __a)
: _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0)
{ }
@@ -405,7 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
get_allocator() const
{ return allocator_type(_M_get_Bit_allocator()); }
- _Bvector_base(const allocator_type& __a) : _M_impl(__a) { }
+ _Bvector_base()
+ : _M_impl() { }
+
+ _Bvector_base(const allocator_type& __a)
+ : _M_impl(__a) { }
~_Bvector_base()
{ this->_M_deallocate(); }
@@ -480,8 +489,11 @@ template<typename _Alloc>
using _Base::_M_get_Bit_allocator;
public:
+ vector()
+ : _Base() { }
+
explicit
- vector(const allocator_type& __a = allocator_type())
+ vector(const allocator_type& __a)
: _Base(__a) { }
explicit
@@ -678,7 +690,7 @@ template<typename _Alloc>
}
void
- swap(vector<bool, _Alloc>& __x)
+ swap(vector& __x)
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
Modified: stable/9/contrib/libstdc++/include/bits/stl_deque.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_deque.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_deque.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -380,6 +380,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
+ _Deque_base()
+ : _M_impl()
+ { _M_initialize_map(0); }
+
_Deque_base(const allocator_type& __a, size_t __num_elements)
: _M_impl(__a)
{ _M_initialize_map(__num_elements); }
@@ -406,6 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
iterator _M_start;
iterator _M_finish;
+ _Deque_impl()
+ : _Tp_alloc_type(), _M_map(0), _M_map_size(0),
+ _M_start(), _M_finish()
+ { }
+
_Deque_impl(const _Tp_alloc_type& __a)
: _Tp_alloc_type(__a), _M_map(0), _M_map_size(0),
_M_start(), _M_finish()
@@ -679,8 +688,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
/**
* @brief Default constructor creates no elements.
*/
+ deque()
+ : _Base() { }
+
explicit
- deque(const allocator_type& __a = allocator_type())
+ deque(const allocator_type& __a)
: _Base(__a, 0) {}
/**
Modified: stable/9/contrib/libstdc++/include/bits/stl_list.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_list.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_list.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -305,6 +305,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
{
_List_node_base _M_node;
+ _List_impl()
+ : _Node_alloc_type(), _M_node()
+ { }
+
_List_impl(const _Node_alloc_type& __a)
: _Node_alloc_type(__a), _M_node()
{ }
@@ -339,6 +343,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
get_allocator() const
{ return allocator_type(_M_get_Node_allocator()); }
+ _List_base()
+ : _M_impl()
+ { _M_init(); }
+
_List_base(const allocator_type& __a)
: _M_impl(__a)
{ _M_init(); }
@@ -468,8 +476,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
/**
* @brief Default constructor creates no elements.
*/
+ list()
+ : _Base() { }
+
explicit
- list(const allocator_type& __a = allocator_type())
+ list(const allocator_type& __a)
: _Base(__a) { }
/**
Modified: stable/9/contrib/libstdc++/include/bits/stl_map.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_map.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_map.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* @brief Default constructor creates no elements.
*/
map()
- : _M_t(_Compare(), allocator_type()) { }
+ : _M_t() { }
// for some reason this was made a separate function
/**
@@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
*/
template <typename _InputIterator>
map(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
+ : _M_t()
{ _M_t._M_insert_unique(__first, __last); }
/**
Modified: stable/9/contrib/libstdc++/include/bits/stl_multimap.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_multimap.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_multimap.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* @brief Default constructor creates no elements.
*/
multimap()
- : _M_t(_Compare(), allocator_type()) { }
+ : _M_t() { }
// for some reason this was made a separate function
/**
@@ -184,8 +184,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
*/
template <typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t._M_insert_equal(__first, __last); }
+ : _M_t()
+ { _M_t._M_insert_unique(__first, __last); }
/**
* @brief Builds a %multimap from a range.
Modified: stable/9/contrib/libstdc++/include/bits/stl_multiset.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_multiset.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_multiset.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -134,7 +134,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* @brief Default constructor creates no elements.
*/
multiset()
- : _M_t(_Compare(), allocator_type()) { }
+ : _M_t() { }
explicit
multiset(const _Compare& __comp,
@@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
*/
template <class _InputIterator>
multiset(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
+ : _M_t()
{ _M_t._M_insert_equal(__first, __last); }
/**
@@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* The newly-created %multiset uses a copy of the allocation object used
* by @a x.
*/
- multiset(const multiset<_Key,_Compare,_Alloc>& __x)
+ multiset(const multiset& __x)
: _M_t(__x._M_t) { }
/**
@@ -190,8 +190,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* All the elements of @a x are copied, but unlike the copy constructor,
* the allocator object is not copied.
*/
- multiset<_Key,_Compare,_Alloc>&
- operator=(const multiset<_Key,_Compare,_Alloc>& __x)
+ multiset&
+ operator=(const multiset& __x)
{
_M_t = __x._M_t;
return *this;
@@ -275,7 +275,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* std::swap(s1,s2) will feed to this function.
*/
void
- swap(multiset<_Key, _Compare, _Alloc>& __x)
+ swap(multiset& __x)
{ _M_t.swap(__x._M_t); }
// insert/erase
Modified: stable/9/contrib/libstdc++/include/bits/stl_set.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_set.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_set.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -138,7 +138,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
// allocation/deallocation
/// Default constructor creates no elements.
set()
- : _M_t(_Compare(), allocator_type()) {}
+ : _M_t() { }
/**
* @brief Default constructor creates no elements.
@@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
*/
template<class _InputIterator>
set(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
+ : _M_t()
{ _M_t._M_insert_unique(__first, __last); }
/**
@@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* The newly-created %set uses a copy of the allocation object used
* by @a x.
*/
- set(const set<_Key,_Compare,_Alloc>& __x)
+ set(const set& __x)
: _M_t(__x._M_t) { }
/**
@@ -200,8 +200,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* All the elements of @a x are copied, but unlike the copy constructor,
* the allocator object is not copied.
*/
- set<_Key,_Compare,_Alloc>&
- operator=(const set<_Key, _Compare, _Alloc>& __x)
+ set&
+ operator=(const set& __x)
{
_M_t = __x._M_t;
return *this;
@@ -283,7 +283,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
* std::swap(s1,s2) will feed to this function.
*/
void
- swap(set<_Key,_Compare,_Alloc>& __x)
+ swap(set& __x)
{ _M_t.swap(__x._M_t); }
// insert/erase
Modified: stable/9/contrib/libstdc++/include/bits/stl_tree.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_tree.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_tree.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -410,10 +410,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Rb_tree_node_base _M_header;
size_type _M_node_count; // Keeps track of size of tree.
- _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(),
- const _Key_compare& __comp = _Key_compare())
- : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
+ _Rb_tree_impl()
+ : _Node_allocator(), _M_key_compare(), _M_header(),
_M_node_count(0)
+ { _M_initialize(); }
+
+ _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
+ : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
+ _M_node_count(0)
+ { _M_initialize(); }
+
+ private:
+ void
+ _M_initialize()
{
this->_M_header._M_color = _S_red;
this->_M_header._M_parent = 0;
@@ -431,11 +440,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Rb_tree_node_base _M_header;
size_type _M_node_count; // Keeps track of size of tree.
- _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(),
- const _Key_compare& __comp = _Key_compare())
+ _Rb_tree_impl()
+ : _Node_allocator(), _M_key_compare(), _M_header(),
+ _M_node_count(0)
+ { _M_initialize(); }
+
+ _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
: _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
_M_node_count(0)
- {
+ { _M_initialize(); }
+
+ private:
+ void
+ _M_initialize()
+ {
this->_M_header._M_color = _S_red;
this->_M_header._M_parent = 0;
this->_M_header._M_left = &this->_M_header;
@@ -568,16 +586,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Rb_tree()
{ }
- _Rb_tree(const _Compare& __comp)
- : _M_impl(allocator_type(), __comp)
- { }
-
- _Rb_tree(const _Compare& __comp, const allocator_type& __a)
- : _M_impl(__a, __comp)
+ _Rb_tree(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__comp, __a)
{ }
- _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
- : _M_impl(__x._M_get_Node_allocator(), __x._M_impl._M_key_compare)
+ _Rb_tree(const _Rb_tree& __x)
+ : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator())
{
if (__x._M_root() != 0)
{
@@ -591,8 +606,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
~_Rb_tree()
{ _M_erase(_M_begin()); }
- _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
- operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x);
+ _Rb_tree&
+ operator=(const _Rb_tree& __x);
// Accessors.
_Compare
@@ -653,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return get_allocator().max_size(); }
void
- swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t);
+ swap(_Rb_tree& __t);
// Insert/erase.
pair<iterator, bool>
Modified: stable/9/contrib/libstdc++/include/bits/stl_vector.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/stl_vector.h Sat Jun 23 19:49:18 2012 (r237506)
+++ stable/9/contrib/libstdc++/include/bits/stl_vector.h Sat Jun 23 20:33:29 2012 (r237507)
@@ -84,6 +84,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
_Tp* _M_start;
_Tp* _M_finish;
_Tp* _M_end_of_storage;
+
+ _Vector_impl()
+ : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
+ { }
+
_Vector_impl(_Tp_alloc_type const& __a)
: _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }
@@ -104,6 +109,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
get_allocator() const
{ return allocator_type(_M_get_Tp_allocator()); }
+ _Vector_base()
+ : _M_impl() { }
+
_Vector_base(const allocator_type& __a)
: _M_impl(__a)
{ }
@@ -194,8 +202,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
/**
* @brief Default constructor creates no elements.
*/
+ vector()
+ : _Base() { }
+
explicit
- vector(const allocator_type& __a = allocator_type())
+ vector(const allocator_type& __a)
: _Base(__a)
{ }
More information about the svn-src-stable-9
mailing list