string.tcc (_Rep::_S_max_size): Use typename for its size_type return type.

2000-09-14  Brendan Kehoe  <brendan@zen.org>

        * bits/string.tcc (_Rep::_S_max_size): Use typename for its size_type
        return type.

        * src/Makefile.an (headers): Also install backward/fstream.h.
        * src/Makefile.in: Regenerate.

        * bits/char_traits.h (char_traits<_CharT>::get_state,
        char_traits<char>::get_state, char_traits<wchar_t>::get_state): Pass
        argument in by reference, not by value. Uglify to _S_get_state.
	(char_traits<*>::__eos): Uglify to _S_eos.
	* bits/std_ostream.h (ends(basic_ostream<_CharT, _Traits>& __os)):
	Change __eos to _S_eos.

From-SVN: r36417
This commit is contained in:
Benjamin Kosnik 2000-09-14 19:44:03 +00:00
parent 3c71084a53
commit b75bedeb2a
7 changed files with 81 additions and 80 deletions

View File

@ -1,3 +1,24 @@
2000-09-14 Brendan Kehoe <brendan@zen.org>
* bits/string.tcc (_Rep::_S_max_size): Use typename for its size_type
return type.
* src/Makefile.an (headers): Also install backward/fstream.h.
* src/Makefile.in: Regenerate.
* bits/char_traits.h (char_traits<_CharT>::get_state,
char_traits<char>::get_state, char_traits<wchar_t>::get_state): Pass
argument in by reference, not by value. Uglify to _S_get_state.
(char_traits<*>::__eos): Uglify to _S_eos.
* bits/std_ostream.h (ends(basic_ostream<_CharT, _Traits>& __os)):
Change __eos to _S_eos.
2000-09-13 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/22_locale/static_members.cc: New file.
* testsuite/22_locale/ctor_copy_dtor.cc: New file.
* src/locale.cc: Minor formatting tweaks.
2000-09-12 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* testsuite/22_locale/global_templates.cc (test01): Add negative

View File

@ -131,13 +131,13 @@ namespace std {
{ return __c1 == __c2; }
static state_type
get_state (pos_type __pos) { return __pos.state(); }
_S_get_state(const pos_type& __pos) { return __pos.state(); }
static int_type
eof() { return static_cast<int_type>(-1); }
static int_type
__eos() { return char_type(); }
_S_eos() { return char_type(); }
static int_type
not_eof(const int_type& __c)
@ -205,13 +205,13 @@ namespace std {
{ return __c1 == __c2; }
static state_type
get_state(pos_type __pos) { return __pos.state(); }
_S_get_state(const pos_type& __pos) { return __pos.state(); }
static int_type
eof() { return static_cast<int_type>(EOF); }
static int_type
__eos() { return char_type(); }
_S_eos() { return char_type(); }
static int_type
not_eof(const int_type& __c)
@ -276,13 +276,13 @@ namespace std {
{ return __c1 == __c2; }
static state_type
get_state(pos_type __pos) { return __pos.state(); }
_S_get_state(const pos_type& __pos) { return __pos.state(); }
static int_type
eof() { return static_cast<int_type>(WEOF); }
static int_type
__eos() { return char_type(); }
_S_eos() { return char_type(); }
static int_type
not_eof(const int_type& __c)

View File

@ -262,7 +262,7 @@ namespace std {
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
ends(basic_ostream<_CharT, _Traits>& __os)
{ return __os.put(_Traits::__eos()); }
{ return __os.put(_Traits::_S_eos()); }
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&

View File

@ -49,7 +49,7 @@ namespace std
_Rep::_S_terminal = _CharT();
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>::size_type
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
_Rep::_S_max_size = (((npos - sizeof(_Rep))/sizeof(_CharT)) - 1) / 4;

View File

@ -21,7 +21,7 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
## $Id: Makefile.am,v 1.28 2000/08/16 18:36:57 aoliva Exp $
## $Id: Makefile.am,v 1.29 2000/08/22 17:22:38 bkoz Exp $
AUTOMAKE_OPTIONS = 1.3 gnits
MAINT_CHARSET = latin1
@ -138,6 +138,7 @@ headers = \
backward/multiset.h backward/pair.h backward/iostream.h \
backward/rope.h backward/set.h backward/slist.h backward/stack.h \
backward/tempbuf.h backward/tree.h backward/vector.h \
backward/fstream.h \
bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
bits/std_iterator.h bits/std_list.h \
bits/std_map.h bits/std_memory.h bits/std_numeric.h \

View File

@ -163,7 +163,7 @@ LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM
# course is impossible.
CXXLINK = $(LIBTOOL) --mode=link "$(CC)" @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
headers = bits/cpp_type_traits.h bits/std_cctype.h bits/ctype_base.h bits/ctype_specializations.h bits/char_traits.h bits/codecvt.h bits/basic_string.h bits/std_string.h bits/string.tcc bits/generic_shadow.h bits/std_utility.h bits/std_complex.h bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h bits/gslice.h bits/gslice_array.h bits/indirect_array.h bits/std_cassert.h bits/std_cwctype.h bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h bits/std_clocale.h bits/std_cmath.h bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h bits/std_typeinfo.h bits/std_new.h bits/std_exception.h bits/exception_support.h bits/std_fstream.h bits/std_iomanip.h bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h bits/std_istream.h bits/istream.tcc bits/std_locale.h bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h bits/streambuf.tcc bits/basic_file.h bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h bits/stl_pthread_alloc.h bits/pthread_allocimpl.h bits/stl_threads.h bits/stl_iterator_base.h backward/algo.h backward/algobase.h backward/alloc.h backward/bvector.h backward/defalloc.h backward/deque.h backward/function.h backward/hash_map.h backward/hash_set.h backward/hashtable.h backward/heap.h backward/iterator.h backward/list.h backward/map.h backward/multimap.h backward/new.h backward/multiset.h backward/pair.h backward/iostream.h backward/rope.h backward/set.h backward/slist.h backward/stack.h backward/tempbuf.h backward/tree.h backward/vector.h bits/std_bitset.h bits/std_deque.h bits/std_functional.h bits/std_iterator.h bits/std_list.h bits/std_map.h bits/std_memory.h bits/std_numeric.h bits/std_queue.h bits/std_set.h bits/std_stack.h bits/std_stdexcept.h bits/std_vector.h bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h bits/stl_deque.h bits/stl_function.h bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h bits/stl_relops.h bits/stl_set.h bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h bits/concept_checks.h bits/container_concepts.h bits/sequence_concepts.h bits/std_strstream.h ext/ropeimpl.h ext/stl_rope.h ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h ext/stl_hashtable.h ext/stl_hash_fun.h ext/hash_map ext/hash_set ext/rope ext/slist ext/tree ext/bvector shadow/assert.h shadow/ctype.h shadow/errno.h shadow/float.h shadow/libio.h shadow/limits.h shadow/locale.h shadow/math.h shadow/setjmp.h shadow/signal.h shadow/stdarg.h shadow/stddef.h shadow/stdio.h shadow/stdlib.h shadow/string.h shadow/time.h shadow/unistd.h shadow/wchar.h shadow/wctype.h shadow/bits/std_cassert.h shadow/bits/std_cctype.h shadow/bits/std_cerrno.h shadow/bits/std_cfloat.h shadow/bits/std_climits.h shadow/bits/std_clocale.h shadow/bits/std_cmath.h shadow/bits/std_csetjmp.h shadow/bits/std_csignal.h shadow/bits/std_cstdarg.h shadow/bits/std_cstddef.h shadow/bits/std_cstdio.h shadow/bits/std_cstdlib.h shadow/bits/std_cstring.h shadow/bits/std_ctime.h shadow/bits/std_cwchar.h shadow/bits/std_cwctype.h shadow/bits/wrap_libio.h shadow/bits/wrap_unistd.h shadow/sys/cdefs.h
headers = bits/cpp_type_traits.h bits/std_cctype.h bits/ctype_base.h bits/ctype_specializations.h bits/char_traits.h bits/codecvt.h bits/basic_string.h bits/std_string.h bits/string.tcc bits/generic_shadow.h bits/std_utility.h bits/std_complex.h bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h bits/gslice.h bits/gslice_array.h bits/indirect_array.h bits/std_cassert.h bits/std_cwctype.h bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h bits/std_clocale.h bits/std_cmath.h bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h bits/std_typeinfo.h bits/std_new.h bits/std_exception.h bits/exception_support.h bits/std_fstream.h bits/std_iomanip.h bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h bits/std_istream.h bits/istream.tcc bits/std_locale.h bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h bits/streambuf.tcc bits/basic_file.h bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h bits/stl_pthread_alloc.h bits/pthread_allocimpl.h bits/stl_threads.h bits/stl_iterator_base.h backward/algo.h backward/algobase.h backward/alloc.h backward/bvector.h backward/defalloc.h backward/deque.h backward/function.h backward/hash_map.h backward/hash_set.h backward/hashtable.h backward/heap.h backward/iterator.h backward/list.h backward/map.h backward/multimap.h backward/new.h backward/multiset.h backward/pair.h backward/iostream.h backward/rope.h backward/set.h backward/slist.h backward/stack.h backward/tempbuf.h backward/tree.h backward/vector.h backward/fstream.h bits/std_bitset.h bits/std_deque.h bits/std_functional.h bits/std_iterator.h bits/std_list.h bits/std_map.h bits/std_memory.h bits/std_numeric.h bits/std_queue.h bits/std_set.h bits/std_stack.h bits/std_stdexcept.h bits/std_vector.h bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h bits/stl_deque.h bits/stl_function.h bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h bits/stl_relops.h bits/stl_set.h bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h bits/concept_checks.h bits/container_concepts.h bits/sequence_concepts.h bits/std_strstream.h ext/ropeimpl.h ext/stl_rope.h ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h ext/stl_hashtable.h ext/stl_hash_fun.h ext/hash_map ext/hash_set ext/rope ext/slist ext/tree ext/bvector shadow/assert.h shadow/ctype.h shadow/errno.h shadow/float.h shadow/libio.h shadow/limits.h shadow/locale.h shadow/math.h shadow/setjmp.h shadow/signal.h shadow/stdarg.h shadow/stddef.h shadow/stdio.h shadow/stdlib.h shadow/string.h shadow/time.h shadow/unistd.h shadow/wchar.h shadow/wctype.h shadow/bits/std_cassert.h shadow/bits/std_cctype.h shadow/bits/std_cerrno.h shadow/bits/std_cfloat.h shadow/bits/std_climits.h shadow/bits/std_clocale.h shadow/bits/std_cmath.h shadow/bits/std_csetjmp.h shadow/bits/std_csignal.h shadow/bits/std_cstdarg.h shadow/bits/std_cstddef.h shadow/bits/std_cstdio.h shadow/bits/std_cstdlib.h shadow/bits/std_cstring.h shadow/bits/std_ctime.h shadow/bits/std_cwchar.h shadow/bits/std_cwctype.h shadow/bits/wrap_libio.h shadow/bits/wrap_unistd.h shadow/sys/cdefs.h
std_headers = algorithm bitset cassert cctype cerrno cfloat climits clocale ciso646 cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime cwchar cwctype deque exception fstream functional iomanip ios iosfwd iostream istream iterator limits list locale map memory new numeric ostream queue set sstream stack stdexcept streambuf string strstream typeinfo utility valarray vector

View File

@ -43,18 +43,18 @@
namespace std {
// Definitions for static const data members of locale.
const locale::category locale::none;
const locale::category locale::collate;
const locale::category locale::ctype;
const locale::category locale::monetary;
const locale::category locale::numeric;
const locale::category locale::time;
const locale::category locale::messages;
const locale::category locale::all;
const locale::category locale::none;
const locale::category locale::collate;
const locale::category locale::ctype;
const locale::category locale::monetary;
const locale::category locale::numeric;
const locale::category locale::time;
const locale::category locale::messages;
const locale::category locale::all;
locale::_Impl* locale::_S_global; // init'd to 0 before static ctors run
locale::_Impl* locale::_S_classic; // init'd to 0 before static ctors run
const int locale::_S_num_categories;
locale::_Impl* locale::_S_global;
locale::_Impl* locale::_S_classic;
const int locale::_S_num_categories;
// Definitions for static const data members of locale::_Impl
const locale::id* const
@ -563,18 +563,14 @@ namespace std {
locale::_Impl::
_Impl(size_t __numfacets, size_t __refs)
: _M_num_references(__refs - 1)
, _M_facets(0)
, _M_category_names(0)
, _M_has_name(false)
, _M_cached_name_ok(false)
, _M_cached_name(string ("*"))
: _M_num_references(__refs - 1), _M_facets(0), _M_category_names(0),
_M_has_name(false), _M_cached_name_ok(false), _M_cached_name(string ("*"))
{
typedef vector<facet*, allocator<facet*> > __vec_facet;
typedef vector<string, allocator<string> > __vec_string;
auto_ptr<__vec_facet> __pvf(new __vec_facet(__numfacets, (facet*)0));
auto_ptr<__vec_string> __pcn(new __vec_string(_S_num_categories,
auto_ptr<__vec_string> __pcn(new __vec_string(_S_num_categories,
string("*")));
_M_facets = __pvf.release();
_M_category_names = __pcn.release();
@ -582,12 +578,10 @@ namespace std {
locale::_Impl::
_Impl(const _Impl& __other, size_t __refs)
: _M_num_references(__refs)
, _M_facets(0)
, _M_category_names(0)
, _M_has_name(__other._M_has_name)
, _M_cached_name_ok(__other._M_cached_name_ok)
, _M_cached_name(__other._M_cached_name)
: _M_num_references(__refs), _M_facets(0), _M_category_names(0),
_M_has_name(__other._M_has_name),
_M_cached_name_ok(__other._M_cached_name_ok),
_M_cached_name(__other._M_cached_name)
{
typedef vector<facet*, allocator<facet*> > __vec_facet;
typedef vector<string, allocator<string> > __vec_string;
@ -600,9 +594,9 @@ namespace std {
for (; __it != __pvf->end(); ++__it)
(*__it)->_M_add_reference();
// these must be last since in the presence of an exception, the
// These must be last since in the presence of an exception, the
// destructor for 'this' won't run until AFTER execution has passed
// the closing brace of the constructor
// the closing brace of the constructor.
_M_facets = __pvf.release();
_M_category_names = __pcn.release();
}
@ -659,20 +653,18 @@ namespace std {
if (__index >= _M_facets->size())
_M_facets->resize(__index + 1, 0); // might throw
facet*& __fpr = (*_M_facets)[__index];
// order matters, here:
// Order matters, here:
__fp->_M_add_reference();
if (__fpr)
__fpr->_M_remove_reference();
__fpr = __fp;
}
locale::
locale(_Impl* __ip) throw()
locale::locale(_Impl* __ip) throw()
: _M_impl(__ip)
{ __ip->_M_add_reference(); }
locale::
locale(const locale& __other, const locale& __one, category __cats)
locale::locale(const locale& __other, const locale& __one, category __cats)
{
__cats = _S_normalize_category(__cats); // might throw
_M_impl = new _Impl(*__other._M_impl, 1); // might throw
@ -691,8 +683,7 @@ namespace std {
}
const locale&
locale::
operator=(const locale& __other) throw()
locale::operator=(const locale& __other) throw()
{
__other._M_impl->_M_add_reference();
_M_impl->_M_remove_reference();
@ -701,8 +692,7 @@ namespace std {
}
locale
locale::
global(const locale& __other)
locale::global(const locale& __other)
{
// XXX MT
_S_initialize();
@ -716,26 +706,24 @@ namespace std {
}
string
locale::
name() const
locale::name() const
{
// XXX not done
return "*";
}
locale const&
locale::
classic()
locale::classic()
{
static locale* __classic_locale;
// XXX MT
if (!_S_classic)
{
try {
_S_classic = _S_global = new _Impl(26u, 2u);
// 26 Standard facets, 2 references.
// One reference for _M_classic, one for _M_global
// (constructor for (*the_classic_locale) adds a third)
_S_classic = _S_global = new _Impl(26, 2);
// collate category
_S_classic->_M_facet_init(new std::collate<char>);
@ -777,7 +765,7 @@ namespace std {
_S_classic->_M_facet_init(new std::messages<wchar_t>);
#endif
// finesse static init order hassles
// Finesse static init order hassles
__classic_locale = new locale(_S_classic);
}
catch(...) {
@ -796,8 +784,7 @@ namespace std {
}
int
locale::
_S_normalize_category(int __cats)
locale::_S_normalize_category(int __cats)
{
if ((__cats & all) && !(__cats & ~all))
return __cats;
@ -816,7 +803,7 @@ namespace std {
case LC_ALL: return all;
}
// XXX should throw derived class here
// XXX Should throw derived class here
throw runtime_error("bad locale category");
/* NOTREACHED */
}
@ -863,39 +850,34 @@ namespace std {
const size_t ctype<char>::table_size;
ctype<char>::
~ctype()
ctype<char>::~ctype()
{ if (_M_del) delete[] this->table(); }
char
ctype<char>::
do_widen(char __c) const
ctype<char>::do_widen(char __c) const
{ return __c; }
const char*
ctype<char>::
do_widen(const char* __low, const char* __high, char* __dest) const
ctype<char>::do_widen(const char* __low, const char* __high,
char* __dest) const
{
memcpy(__dest, __low, __high - __low);
return __high;
}
char
ctype<char>::
do_narrow(char __c, char /*__dfault*/) const
ctype<char>::do_narrow(char __c, char /*__dfault*/) const
{ return __c; }
const char*
ctype<char>::
do_narrow(const char* __low, const char* __high, char /*__dfault*/,
char* __dest) const
ctype<char>::do_narrow(const char* __low, const char* __high,
char /*__dfault*/, char* __dest) const
{
memcpy(__dest, __low, __high - __low);
return __high;
}
ctype_byname<char>::
ctype_byname(const char* /*__s*/, size_t __refs)
ctype_byname<char>::ctype_byname(const char* /*__s*/, size_t __refs)
: ctype<char>(new mask[table_size], true, __refs)
{ }
@ -907,9 +889,8 @@ namespace std {
collate<char>::~collate() { }
int
collate<char>::
do_compare(const char* __lo1, const char* __hi1,
const char* __lo2, const char* __hi2) const
collate<char>::do_compare(const char* __lo1, const char* __hi1,
const char* __lo2, const char* __hi2) const
{
for (; __lo1 < __hi1 && __lo2 < __hi2; ++__lo1, ++__lo2)
if (*__lo1 != *__lo2)
@ -938,20 +919,18 @@ namespace std {
return __val;
}
collate_byname<char>::
collate_byname(const char* /*__s*/, size_t __refs)
collate_byname<char>::collate_byname(const char* /*__s*/, size_t __refs)
: collate<char>(__refs) { }
numpunct_byname<char>::
numpunct_byname(const char* /*__s*/, size_t __refs)
numpunct_byname<char>::numpunct_byname(const char* /*__s*/, size_t __refs)
: numpunct<char>(__refs) { }
moneypunct_byname<char, false>::
moneypunct_byname(const char* /*__s*/, size_t __refs)
moneypunct_byname<char, false>::moneypunct_byname(const char* /*__s*/,
size_t __refs)
: moneypunct<char, false>(__refs) { }
moneypunct_byname<char, true>::
moneypunct_byname(const char* /*__s*/, size_t __refs)
moneypunct_byname<char, true>::moneypunct_byname(const char* /*__s*/,
size_t __refs)
: moneypunct<char, true>(__refs) { }
messages_byname<char>::