stl_tree.h (_S_rb_tree_red): Make enum.

2002-03-06  Benjamin Kosnik  <bkoz@redhat.com>
	    Stephen M. Webb  <stephen.webb@bregmasoft.com>

	* include/bits/stl_tree.h (_S_rb_tree_red): Make enum.
	(_S_rb_tree_black): Make enum.
	Clean. Format.
	* include/bits/stl_bvector.h (__WORD_BIT): To _M_word_bit, enum.
	* include/bits/stl_algo.h (__stl_chunk_size): _M_chunk_size, enum.
	(__stl_threshold): _M_threshold, enum.
	* src/stl-inst.cc: Same.
	* config/linker-map.gnu: Remove.

	* testsuite/23_containers/vector_bool.cc: New.

Co-Authored-By: Stephen M. Webb <stephen.webb@bregmasoft.com>

From-SVN: r50393
This commit is contained in:
Benjamin Kosnik 2002-03-07 06:53:23 +00:00 committed by Benjamin Kosnik
parent 76a773f3b9
commit d3d526aca6
7 changed files with 1429 additions and 1232 deletions

View File

@ -1,3 +1,17 @@
2002-03-06 Benjamin Kosnik <bkoz@redhat.com>
Stephen M. Webb <stephen.webb@bregmasoft.com>
* include/bits/stl_tree.h (_S_rb_tree_red): Make enum.
(_S_rb_tree_black): Make enum.
Clean. Format.
* include/bits/stl_bvector.h (__WORD_BIT): To _M_word_bit, enum.
* include/bits/stl_algo.h (__stl_chunk_size): _M_chunk_size, enum.
(__stl_threshold): _M_threshold, enum.
* src/stl-inst.cc: Same.
* config/linker-map.gnu: Remove.
* testsuite/23_containers/vector_bool.cc: New.
2002-03-06 Phil Edwards <pme@gcc.gnu.org> 2002-03-06 Phil Edwards <pme@gcc.gnu.org>
* docs/doxygen/user.cfg.in: Also document deprecated entries. * docs/doxygen/user.cfg.in: Also document deprecated entries.

View File

@ -82,18 +82,6 @@ GLIBCPP_3.1 {
_ZTv*; _ZTv*;
_ZTc*; _ZTc*;
# std::_S_rb_tree_red
_ZSt14_S_rb_tree_red;
# std::_S_rb_tree_black
_ZSt16_S_rb_tree_black;
# std::__stl_threshold
_ZSt15__stl_threshold;
# std::__stl_chunk_size
_ZSt16__stl_chunk_size;
# std::__convert_to_v # std::__convert_to_v
_ZSt14__convert_to_v*; _ZSt14__convert_to_v*;

View File

@ -1889,7 +1889,7 @@ __result, __binary_pred, _IterType());
* This controls some aspect of the sort routines. * This controls some aspect of the sort routines.
* @endmaint * @endmaint
*/ */
extern const int __stl_threshold; enum { _M_threshold = 16 };
/** /**
* @maint * @maint
@ -2016,9 +2016,9 @@ __result, __binary_pred, _IterType());
void void
__final_insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last) __final_insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last)
{ {
if (__last - __first > __stl_threshold) { if (__last - __first > _M_threshold) {
__insertion_sort(__first, __first + __stl_threshold); __insertion_sort(__first, __first + _M_threshold);
__unguarded_insertion_sort(__first + __stl_threshold, __last); __unguarded_insertion_sort(__first + _M_threshold, __last);
} }
else else
__insertion_sort(__first, __last); __insertion_sort(__first, __last);
@ -2034,9 +2034,9 @@ __result, __binary_pred, _IterType());
__final_insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last, __final_insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last,
_Compare __comp) _Compare __comp)
{ {
if (__last - __first > __stl_threshold) { if (__last - __first > _M_threshold) {
__insertion_sort(__first, __first + __stl_threshold, __comp); __insertion_sort(__first, __first + _M_threshold, __comp);
__unguarded_insertion_sort(__first + __stl_threshold, __last, __comp); __unguarded_insertion_sort(__first + _M_threshold, __last, __comp);
} }
else else
__insertion_sort(__first, __last, __comp); __insertion_sort(__first, __last, __comp);
@ -2068,7 +2068,7 @@ __result, __binary_pred, _IterType());
{ {
typedef typename iterator_traits<_RandomAccessIter>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIter>::value_type _ValueType;
while (__last - __first > __stl_threshold) { while (__last - __first > _M_threshold) {
if (__depth_limit == 0) { if (__depth_limit == 0) {
partial_sort(__first, __last, __last); partial_sort(__first, __last, __last);
return; return;
@ -2096,7 +2096,7 @@ __result, __binary_pred, _IterType());
{ {
typedef typename iterator_traits<_RandomAccessIter>::value_type _ValueType; typedef typename iterator_traits<_RandomAccessIter>::value_type _ValueType;
while (__last - __first > __stl_threshold) { while (__last - __first > _M_threshold) {
if (__depth_limit == 0) { if (__depth_limit == 0) {
partial_sort(__first, __last, __last, __comp); partial_sort(__first, __last, __last, __comp);
return; return;
@ -2253,7 +2253,7 @@ __result, __binary_pred, _IterType());
__comp); __comp);
} }
extern const int __stl_chunk_size; enum { _M_chunk_size = 7 };
template<typename _RandomAccessIter, typename _Distance> template<typename _RandomAccessIter, typename _Distance>
void void
@ -2289,7 +2289,7 @@ __result, __binary_pred, _IterType());
_Distance __len = __last - __first; _Distance __len = __last - __first;
_Pointer __buffer_last = __buffer + __len; _Pointer __buffer_last = __buffer + __len;
_Distance __step_size = __stl_chunk_size; _Distance __step_size = _M_chunk_size;
__chunk_insertion_sort(__first, __last, __step_size); __chunk_insertion_sort(__first, __last, __step_size);
while (__step_size < __len) { while (__step_size < __len) {
@ -2310,7 +2310,7 @@ __result, __binary_pred, _IterType());
_Distance __len = __last - __first; _Distance __len = __last - __first;
_Pointer __buffer_last = __buffer + __len; _Pointer __buffer_last = __buffer + __len;
_Distance __step_size = __stl_chunk_size; _Distance __step_size = _M_chunk_size;
__chunk_insertion_sort(__first, __last, __step_size, __comp); __chunk_insertion_sort(__first, __last, __step_size, __comp);
while (__step_size < __len) { while (__step_size < __len) {

View File

@ -63,7 +63,7 @@
namespace std namespace std
{ {
extern const int __WORD_BIT; enum { _M_word_bit = int(CHAR_BIT * sizeof(unsigned long)) };
struct _Bit_reference { struct _Bit_reference {
unsigned int* _M_p; unsigned int* _M_p;
@ -106,24 +106,24 @@ struct _Bit_iterator_base : public iterator<random_access_iterator_tag, bool>
: _M_p(__x), _M_offset(__y) {} : _M_p(__x), _M_offset(__y) {}
void _M_bump_up() { void _M_bump_up() {
if (_M_offset++ == __WORD_BIT - 1) { if (_M_offset++ == _M_word_bit - 1) {
_M_offset = 0; _M_offset = 0;
++_M_p; ++_M_p;
} }
} }
void _M_bump_down() { void _M_bump_down() {
if (_M_offset-- == 0) { if (_M_offset-- == 0) {
_M_offset = __WORD_BIT - 1; _M_offset = _M_word_bit - 1;
--_M_p; --_M_p;
} }
} }
void _M_incr(ptrdiff_t __i) { void _M_incr(ptrdiff_t __i) {
difference_type __n = __i + _M_offset; difference_type __n = __i + _M_offset;
_M_p += __n / __WORD_BIT; _M_p += __n / _M_word_bit;
__n = __n % __WORD_BIT; __n = __n % _M_word_bit;
if (__n < 0) { if (__n < 0) {
_M_offset = (unsigned int) __n + __WORD_BIT; _M_offset = (unsigned int) __n + _M_word_bit;
--_M_p; --_M_p;
} else } else
_M_offset = (unsigned int) __n; _M_offset = (unsigned int) __n;
@ -151,7 +151,7 @@ struct _Bit_iterator_base : public iterator<random_access_iterator_tag, bool>
inline ptrdiff_t inline ptrdiff_t
operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return __WORD_BIT * (__x._M_p - __y._M_p) + __x._M_offset - __y._M_offset; return _M_word_bit * (__x._M_p - __y._M_p) + __x._M_offset - __y._M_offset;
} }
@ -283,7 +283,7 @@ public:
protected: protected:
unsigned int* _M_bit_alloc(size_t __n) unsigned int* _M_bit_alloc(size_t __n)
{ return _M_data_allocator.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); } { return _M_data_allocator.allocate((__n + _M_word_bit - 1)/_M_word_bit); }
void _M_deallocate() { void _M_deallocate() {
if (_M_start._M_p) if (_M_start._M_p)
_M_data_allocator.deallocate(_M_start._M_p, _M_data_allocator.deallocate(_M_start._M_p,
@ -313,7 +313,7 @@ protected:
_Alloc_type; _Alloc_type;
unsigned int* _M_bit_alloc(size_t __n) unsigned int* _M_bit_alloc(size_t __n)
{ return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); } { return _Alloc_type::allocate((__n + _M_word_bit - 1)/_M_word_bit); }
void _M_deallocate() { void _M_deallocate() {
if (_M_start._M_p) if (_M_start._M_p)
_Alloc_type::deallocate(_M_start._M_p, _Alloc_type::deallocate(_M_start._M_p,
@ -380,7 +380,7 @@ template <typename _Alloc>
protected: protected:
void _M_initialize(size_type __n) { void _M_initialize(size_type __n) {
unsigned int* __q = _M_bit_alloc(__n); unsigned int* __q = _M_bit_alloc(__n);
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT; _M_end_of_storage = __q + (__n + _M_word_bit - 1)/_M_word_bit;
_M_start = iterator(__q, 0); _M_start = iterator(__q, 0);
_M_finish = _M_start + difference_type(__n); _M_finish = _M_start + difference_type(__n);
} }
@ -391,13 +391,13 @@ template <typename _Alloc>
++_M_finish; ++_M_finish;
} }
else { else {
size_type __len = size() ? 2 * size() : __WORD_BIT; size_type __len = size() ? 2 * size() : _M_word_bit;
unsigned int* __q = _M_bit_alloc(__len); unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0)); iterator __i = copy(begin(), __position, iterator(__q, 0));
*__i++ = __x; *__i++ = __x;
_M_finish = copy(__position, end(), __i); _M_finish = copy(__position, end(), __i);
_M_deallocate(); _M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; _M_end_of_storage = __q + (__len + _M_word_bit - 1)/_M_word_bit;
_M_start = iterator(__q, 0); _M_start = iterator(__q, 0);
} }
} }
@ -448,7 +448,7 @@ template <typename _Alloc>
__i = copy(__first, __last, __i); __i = copy(__first, __last, __i);
_M_finish = copy(__position, end(), __i); _M_finish = copy(__position, end(), __i);
_M_deallocate(); _M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; _M_end_of_storage = __q + (__len + _M_word_bit - 1)/_M_word_bit;
_M_start = iterator(__q, 0); _M_start = iterator(__q, 0);
} }
} }
@ -614,7 +614,7 @@ template <typename _Alloc>
_M_finish = copy(begin(), end(), iterator(__q, 0)); _M_finish = copy(begin(), end(), iterator(__q, 0));
_M_deallocate(); _M_deallocate();
_M_start = iterator(__q, 0); _M_start = iterator(__q, 0);
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT; _M_end_of_storage = __q + (__n + _M_word_bit - 1)/_M_word_bit;
} }
} }
@ -678,7 +678,7 @@ template <typename _Alloc>
fill_n(__i, __n, __x); fill_n(__i, __n, __x);
_M_finish = copy(__position, end(), __i + difference_type(__n)); _M_finish = copy(__position, end(), __i + difference_type(__n));
_M_deallocate(); _M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; _M_end_of_storage = __q + (__len + _M_word_bit - 1)/_M_word_bit;
_M_start = iterator(__q, 0); _M_start = iterator(__q, 0);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -39,12 +39,6 @@
namespace std namespace std
{ {
const int __stl_threshold = 16;
const int __stl_chunk_size = 7;
const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
const _Rb_tree_Color_type _S_rb_tree_red = false;
const _Rb_tree_Color_type _S_rb_tree_black = true;
template class __malloc_alloc_template<0>; template class __malloc_alloc_template<0>;
#ifndef __USE_MALLOC #ifndef __USE_MALLOC
@ -55,5 +49,4 @@ namespace std
void void
vector<unsigned int>:: vector<unsigned int>::
_M_insert_aux(vector<unsigned int>::iterator, unsigned int const &); _M_insert_aux(vector<unsigned int>::iterator, unsigned int const &);
} // namespace std } // namespace std

View File

@ -0,0 +1,36 @@
// 2002-03-05 Stephen M. Webb <stephen.webb@bregmasoft.com>
// Copyright (C) 2002 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 2, 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 23.2.5 class vector<bool>
#include <vector>
#include <testsuite_hooks.h>
void test01()
{
std::vector<bool>::iterator i;
++i;
}
int main()
{
test01();
return 0;
}