From 8e77593c387aeda6176e398c20c7a1d0a68da986 Mon Sep 17 00:00:00 2001 From: bkoz Date: Thu, 14 Sep 2000 19:44:03 +0000 Subject: [PATCH] 2000-09-14 Brendan Kehoe * 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::get_state, char_traits::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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36417 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 21 +++++++ libstdc++-v3/bits/char_traits.h | 12 ++-- libstdc++-v3/bits/std_ostream.h | 2 +- libstdc++-v3/bits/string.tcc | 2 +- libstdc++-v3/src/Makefile.am | 3 +- libstdc++-v3/src/Makefile.in | 2 +- libstdc++-v3/src/locale.cc | 121 +++++++++++++++++----------------------- 7 files changed, 82 insertions(+), 81 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 77283e1aeaf..db6f542a081 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,24 @@ +2000-09-14 Brendan Kehoe + + * 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::get_state, char_traits::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 + + * 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 * testsuite/22_locale/global_templates.cc (test01): Add negative diff --git a/libstdc++-v3/bits/char_traits.h b/libstdc++-v3/bits/char_traits.h index 9d4b4ff58ec..4b141f9de3b 100644 --- a/libstdc++-v3/bits/char_traits.h +++ b/libstdc++-v3/bits/char_traits.h @@ -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(-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(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(WEOF); } static int_type - __eos() { return char_type(); } + _S_eos() { return char_type(); } static int_type not_eof(const int_type& __c) diff --git a/libstdc++-v3/bits/std_ostream.h b/libstdc++-v3/bits/std_ostream.h index eca9d6b5d45..eb63e93623a 100644 --- a/libstdc++-v3/bits/std_ostream.h +++ b/libstdc++-v3/bits/std_ostream.h @@ -262,7 +262,7 @@ namespace std { template basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) - { return __os.put(_Traits::__eos()); } + { return __os.put(_Traits::_S_eos()); } template basic_ostream<_CharT, _Traits>& diff --git a/libstdc++-v3/bits/string.tcc b/libstdc++-v3/bits/string.tcc index 7dd87754417..82a5a7af8ff 100644 --- a/libstdc++-v3/bits/string.tcc +++ b/libstdc++-v3/bits/string.tcc @@ -49,7 +49,7 @@ namespace std _Rep::_S_terminal = _CharT(); template - 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; diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 47a58774219..92a197a2dc5 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -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 \ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 64f338446d9..a3aed9b757d 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -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 diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 2359de8a4cf..58e55a36d0a 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -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; - - 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; + 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; + 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 > __vec_facet; typedef vector > __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 > __vec_facet; typedef vector > __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); @@ -777,7 +765,7 @@ namespace std { _S_classic->_M_facet_init(new std::messages); #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::table_size; - ctype:: - ~ctype() + ctype::~ctype() { if (_M_del) delete[] this->table(); } char - ctype:: - do_widen(char __c) const + ctype::do_widen(char __c) const { return __c; } const char* - ctype:: - do_widen(const char* __low, const char* __high, char* __dest) const + ctype::do_widen(const char* __low, const char* __high, + char* __dest) const { memcpy(__dest, __low, __high - __low); return __high; } char - ctype:: - do_narrow(char __c, char /*__dfault*/) const + ctype::do_narrow(char __c, char /*__dfault*/) const { return __c; } const char* - ctype:: - do_narrow(const char* __low, const char* __high, char /*__dfault*/, - char* __dest) const + ctype::do_narrow(const char* __low, const char* __high, + char /*__dfault*/, char* __dest) const { memcpy(__dest, __low, __high - __low); return __high; } - ctype_byname:: - ctype_byname(const char* /*__s*/, size_t __refs) + ctype_byname::ctype_byname(const char* /*__s*/, size_t __refs) : ctype(new mask[table_size], true, __refs) { } @@ -907,9 +889,8 @@ namespace std { collate::~collate() { } int - collate:: - do_compare(const char* __lo1, const char* __hi1, - const char* __lo2, const char* __hi2) const + collate::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:: - collate_byname(const char* /*__s*/, size_t __refs) + collate_byname::collate_byname(const char* /*__s*/, size_t __refs) : collate(__refs) { } - numpunct_byname:: - numpunct_byname(const char* /*__s*/, size_t __refs) + numpunct_byname::numpunct_byname(const char* /*__s*/, size_t __refs) : numpunct(__refs) { } - moneypunct_byname:: - moneypunct_byname(const char* /*__s*/, size_t __refs) + moneypunct_byname::moneypunct_byname(const char* /*__s*/, + size_t __refs) : moneypunct(__refs) { } - moneypunct_byname:: - moneypunct_byname(const char* /*__s*/, size_t __refs) + moneypunct_byname::moneypunct_byname(const char* /*__s*/, + size_t __refs) : moneypunct(__refs) { } messages_byname:: -- 2.11.0