Commit 26c691a8 by Benjamin Kosnik Committed by Benjamin Kosnik

re PR libstdc++/12854 (libstdc++ vs. -Weffc++)


2004-05-22  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/12854
	Fixups for -Weffc++.
	* include/bits/basic_string.h (basic_string::operator=): Return
	pointer to this instead of result of assign. Although redundant,
	this doesn't impact resultant codegen.

	* include/bits/locale_facets.h (__numpunct_cache): Declare
	assignment opxserator and copy constructor private.
	(__timepunct_cache): Same.
	(__moneypunct_cache): Same.
	(collate): Use member initialization list for _M_c_locale_collate.
	* config/locale/gnu/messages_members.h: Same.
	* config/locale/gnu/time_members.h (__timepunct): Same.
	* src/codecvt.cc: Use member initialization list to initialize
	_M_c_locale_codecvt.
	* src/ctype.cc: Same, with _M_c_locale_ctype and _M_narrow_ok.
	* config/os/gnu-linux/ctype_noninline.h: Same.
	* src/locale.cc (_Impl): Same.
	* src/locale_init.cc: Same.
	* src/localename.cc: Same.

	* include/bits/basic_ios.h (basic_ios): Complete member
	initialization list.
	* include/bits/istream.tcc (basic_istream::sentry): Same.
	* include/bits/ostream.tcc (basic_ostream::sentry): Same.
	* include/bits/fstream.tcc (basic_filebuf): Add _M_lock and
	_M_pback to member initialization list.
	* include/std/std_streambuf.h: Same.
	* include/std/std_sstream.h: Same, for _M_mode.
	* src/ios.cc (ios_base): Same.

	* include/ext/rope: Make derived classes match exception

	 specifications. Add copy constructors and assignment operators.

	* include/debug/safe_base.h (_Safe_sequence_base): Declare copy
	constructor and assignment operator protected.
	(_Safe_iterator_base): Same.
	* include/debug/formatter.h (_Error_formatter): Define copy
	constructor and assignment operator.

	* include/backward/strstream: Declare assignment operator and copy
	constructor private.

From-SVN: r82153
parent d6dc556b
2004-05-22 Benjamin Kosnik <bkoz@redhat.com> 2004-05-22 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/12854
Fixups for -Weffc++.
* include/bits/basic_string.h (basic_string::operator=): Return
pointer to this instead of result of assign. Although redundant,
this doesn't impact resultant codegen.
* include/bits/locale_facets.h (__numpunct_cache): Declare
assignment opxserator and copy constructor private.
(__timepunct_cache): Same.
(__moneypunct_cache): Same.
(collate): Use member initialization list for _M_c_locale_collate.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/time_members.h (__timepunct): Same.
* src/codecvt.cc: Use member initialization list to initialize
_M_c_locale_codecvt.
* src/ctype.cc: Same, with _M_c_locale_ctype and _M_narrow_ok.
* config/os/gnu-linux/ctype_noninline.h: Same.
* src/locale.cc (_Impl): Same.
* src/locale_init.cc: Same.
* src/localename.cc: Same.
* include/bits/basic_ios.h (basic_ios): Complete member
initialization list.
* include/bits/istream.tcc (basic_istream::sentry): Same.
* include/bits/ostream.tcc (basic_ostream::sentry): Same.
* include/bits/fstream.tcc (basic_filebuf): Add _M_lock and
_M_pback to member initialization list.
* include/std/std_streambuf.h: Same.
* include/std/std_sstream.h: Same, for _M_mode.
* src/ios.cc (ios_base): Same.
* include/ext/rope: Make derived classes match exception
specifications. Add copy constructors and assignment operators.
* include/debug/safe_base.h (_Safe_sequence_base): Declare copy
constructor and assignment operator protected.
(_Safe_iterator_base): Same.
* include/debug/formatter.h (_Error_formatter): Define copy
constructor and assignment operator.
* include/backward/strstream: Declare assignment operator and copy
constructor private.
2004-05-22 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/testsuite_hooks.h (func_callback): Declare copy * testsuite/testsuite_hooks.h (func_callback): Declare copy
constructor and assignment operator private. constructor and assignment operator private.
* testsuite/23_containers/deque/cons/clear_allocator.cc: Match * testsuite/23_containers/deque/cons/clear_allocator.cc: Match
......
...@@ -36,26 +36,19 @@ ...@@ -36,26 +36,19 @@
// Non-virtual member functions. // Non-virtual member functions.
template<typename _CharT> template<typename _CharT>
messages<_CharT>::messages(size_t __refs) messages<_CharT>::messages(size_t __refs)
: facet(__refs) : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
{ _M_name_messages(_S_get_c_name())
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) { }
_M_name_messages = _S_get_c_name();
#endif
_M_c_locale_messages = _S_get_c_locale();
}
template<typename _CharT> template<typename _CharT>
messages<_CharT>::messages(__c_locale __cloc, messages<_CharT>::messages(__c_locale __cloc, const char* __s,
const char* __s __attribute__ ((__unused__)),
size_t __refs) size_t __refs)
: facet(__refs) : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
_M_name_messages(__s)
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
char* __tmp = new char[std::strlen(__s) + 1]; char* __tmp = new char[std::strlen(__s) + 1];
std::strcpy(__tmp, __s); std::strcpy(__tmp, __s);
_M_name_messages = __tmp; _M_name_messages = __tmp;
#endif
_M_c_locale_messages = _S_clone_c_locale(__cloc);
} }
template<typename _CharT> template<typename _CharT>
...@@ -71,10 +64,8 @@ ...@@ -71,10 +64,8 @@
template<typename _CharT> template<typename _CharT>
messages<_CharT>::~messages() messages<_CharT>::~messages()
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
if (_M_name_messages != _S_get_c_name()) if (_M_name_messages != _S_get_c_name())
delete [] _M_name_messages; delete [] _M_name_messages;
#endif
_S_destroy_c_locale(_M_c_locale_messages); _S_destroy_c_locale(_M_c_locale_messages);
} }
...@@ -99,16 +90,15 @@ ...@@ -99,16 +90,15 @@
messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
: messages<_CharT>(__refs) : messages<_CharT>(__refs)
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
if (this->_M_name_messages != locale::facet::_S_get_c_name()) if (this->_M_name_messages != locale::facet::_S_get_c_name())
delete [] this->_M_name_messages; delete [] this->_M_name_messages;
char* __tmp = new char[std::strlen(__s) + 1]; char* __tmp = new char[std::strlen(__s) + 1];
std::strcpy(__tmp, __s); std::strcpy(__tmp, __s);
this->_M_name_messages = __tmp; this->_M_name_messages = __tmp;
#endif
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{ {
this->_S_destroy_c_locale(this->_M_c_locale_messages); this->_S_destroy_c_locale(this->_M_c_locale_messages);
this->_S_create_c_locale(this->_M_c_locale_messages, __s); this->_S_create_c_locale(this->_M_c_locale_messages, __s);
} }
} }
// std::time_get, std::time_put implementation, GNU version -*- C++ -*- // std::time_get, std::time_put implementation, GNU version -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -36,45 +36,33 @@ ...@@ -36,45 +36,33 @@
template<typename _CharT> template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs) __timepunct<_CharT>::__timepunct(size_t __refs)
: facet(__refs), _M_data(NULL) : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
{ _M_name_timepunct(_S_get_c_name())
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) { _M_initialize_timepunct(); }
_M_name_timepunct = _S_get_c_name();
#endif
_M_initialize_timepunct();
}
template<typename _CharT> template<typename _CharT>
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
: facet(__refs), _M_data(__cache) : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
{ _M_name_timepunct(_S_get_c_name())
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) { _M_initialize_timepunct(); }
_M_name_timepunct = _S_get_c_name();
#endif
_M_initialize_timepunct();
}
template<typename _CharT> template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
const char* __s __attribute__ ((__unused__)),
size_t __refs) size_t __refs)
: facet(__refs), _M_data(NULL) : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
_M_name_timepunct(__s)
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
char* __tmp = new char[std::strlen(__s) + 1]; char* __tmp = new char[std::strlen(__s) + 1];
std::strcpy(__tmp, __s); std::strcpy(__tmp, __s);
_M_name_timepunct = __tmp; _M_name_timepunct = __tmp;
#endif
_M_initialize_timepunct(__cloc); _M_initialize_timepunct(__cloc);
} }
template<typename _CharT> template<typename _CharT>
__timepunct<_CharT>::~__timepunct() __timepunct<_CharT>::~__timepunct()
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
if (_M_name_timepunct != _S_get_c_name()) if (_M_name_timepunct != _S_get_c_name())
delete [] _M_name_timepunct; delete [] _M_name_timepunct;
#endif
delete _M_data; delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct); _S_destroy_c_locale(_M_c_locale_timepunct);
} }
// Locale support -*- C++ -*- // Locale support -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -59,21 +59,21 @@ ...@@ -59,21 +59,21 @@
#if _GLIBCXX_C_LOCALE_GNU #if _GLIBCXX_C_LOCALE_GNU
ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del, ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del,
size_t __refs) size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del) : facet(__refs), _M_c_locale_ctype(_S_clone_c_locale(__cloc)),
_M_del(__table != 0 && __del),
_M_toupper(_M_c_locale_ctype->__ctype_toupper),
_M_tolower(_M_c_locale_ctype->__ctype_tolower),
_M_table(__table ? __table : _M_c_locale_ctype->__ctype_b),
_M_widen_ok(0), _M_narrow_ok(0)
{ {
_M_c_locale_ctype = _S_clone_c_locale(__cloc);
_M_toupper = _M_c_locale_ctype->__ctype_toupper;
_M_tolower = _M_c_locale_ctype->__ctype_tolower;
_M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;
memset(_M_widen, 0, sizeof(_M_widen)); memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow)); memset(_M_narrow, 0, sizeof(_M_narrow));
_M_narrow_ok = 0;
} }
#else #else
ctype<char>::ctype(__c_locale, const mask* __table, bool __del, ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
size_t __refs) size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del) : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
_M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
{ {
char* __old=strdup(setlocale(LC_CTYPE, NULL)); char* __old=strdup(setlocale(LC_CTYPE, NULL));
setlocale(LC_CTYPE, "C"); setlocale(LC_CTYPE, "C");
...@@ -88,30 +88,27 @@ ...@@ -88,30 +88,27 @@
#endif #endif
setlocale(LC_CTYPE, __old); setlocale(LC_CTYPE, __old);
free(__old); free(__old);
_M_c_locale_ctype = _S_get_c_locale();
memset(_M_widen, 0, sizeof(_M_widen)); memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow)); memset(_M_narrow, 0, sizeof(_M_narrow));
_M_narrow_ok = 0;
} }
#endif #endif
#if _GLIBCXX_C_LOCALE_GNU #if _GLIBCXX_C_LOCALE_GNU
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del) : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
_M_del(__table != 0 && __del),
_M_toupper(_M_c_locale_ctype->__ctype_toupper),
_M_tolower(_M_c_locale_ctype->__ctype_tolower),
_M_table(__table ? __table : _M_c_locale_ctype->__ctype_b),
_M_widen_ok(0), _M_narrow_ok(0)
{ {
_M_c_locale_ctype = _S_get_c_locale();
_M_toupper = _M_c_locale_ctype->__ctype_toupper;
_M_tolower = _M_c_locale_ctype->__ctype_tolower;
_M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;
memset(_M_widen, 0, sizeof(_M_widen)); memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow)); memset(_M_narrow, 0, sizeof(_M_narrow));
_M_narrow_ok = 0;
} }
#else #else
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del) : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
_M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
{ {
char* __old=strdup(setlocale(LC_CTYPE, NULL)); char* __old=strdup(setlocale(LC_CTYPE, NULL));
setlocale(LC_CTYPE, "C"); setlocale(LC_CTYPE, "C");
...@@ -126,11 +123,8 @@ ...@@ -126,11 +123,8 @@
#endif #endif
setlocale(LC_CTYPE, __old); setlocale(LC_CTYPE, __old);
free(__old); free(__old);
_M_c_locale_ctype = _S_get_c_locale();
memset(_M_widen, 0, sizeof(_M_widen)); memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow)); memset(_M_narrow, 0, sizeof(_M_narrow));
_M_narrow_ok = 0;
} }
#endif #endif
......
// Backward-compat support -*- C++ -*- // Backward-compat support -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -98,6 +98,11 @@ namespace std ...@@ -98,6 +98,11 @@ namespace std
= ios_base::in | ios_base::out); = ios_base::in | ios_base::out);
private: private:
strstreambuf&
operator=(const strstreambuf&);
strstreambuf(const strstreambuf&);
// Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
char* _M_alloc(size_t); char* _M_alloc(size_t);
void _M_free(char*); void _M_free(char*);
......
// Iostreams base classes -*- C++ -*- // Iostreams base classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003 // Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -254,7 +254,8 @@ namespace std ...@@ -254,7 +254,8 @@ namespace std
*/ */
explicit explicit
basic_ios(basic_streambuf<_CharT, _Traits>* __sb) basic_ios(basic_streambuf<_CharT, _Traits>* __sb)
: ios_base(), _M_ctype(0), _M_num_put(0), _M_num_get(0) : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0),
_M_ctype(0), _M_num_put(0), _M_num_get(0)
{ this->init(__sb); } { this->init(__sb); }
/** /**
...@@ -440,7 +441,9 @@ namespace std ...@@ -440,7 +441,9 @@ namespace std
* The default constructor does nothing and is not normally * The default constructor does nothing and is not normally
* accessible to users. * accessible to users.
*/ */
basic_ios() : ios_base(), _M_ctype(0), _M_num_put(0), _M_num_get(0) basic_ios()
: ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false),
_M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
{ } { }
/** /**
......
...@@ -418,14 +418,22 @@ namespace std ...@@ -418,14 +418,22 @@ namespace std
* @param str Source string. * @param str Source string.
*/ */
basic_string& basic_string&
operator=(const basic_string& __str) { return this->assign(__str); } operator=(const basic_string& __str)
{
this->assign(__str);
return *this;
}
/** /**
* @brief Copy contents of @a s into this string. * @brief Copy contents of @a s into this string.
* @param s Source null-terminated string. * @param s Source null-terminated string.
*/ */
basic_string& basic_string&
operator=(const _CharT* __s) { return this->assign(__s); } operator=(const _CharT* __s)
{
this->assign(__s);
return *this;
}
/** /**
* @brief Set value to string of length 1. * @brief Set value to string of length 1.
...@@ -435,7 +443,11 @@ namespace std ...@@ -435,7 +443,11 @@ namespace std
* (*this)[0] == @a c. * (*this)[0] == @a c.
*/ */
basic_string& basic_string&
operator=(_CharT __c) { return this->assign(1, __c); } operator=(_CharT __c)
{
this->assign(1, __c);
return *this;
}
// Iterators: // Iterators:
/** /**
......
...@@ -73,10 +73,10 @@ namespace std ...@@ -73,10 +73,10 @@ namespace std
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>:: basic_filebuf<_CharT, _Traits>::
basic_filebuf() : __streambuf_type(), _M_file(&_M_lock), basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),
_M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(), _M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(),
_M_state_last(), _M_buf(NULL), _M_buf_size(BUFSIZ), _M_state_last(), _M_buf(NULL), _M_buf_size(BUFSIZ),
_M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_pback(),
_M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false), _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false),
_M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0), _M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0),
_M_ext_end(0) _M_ext_end(0)
......
...@@ -44,14 +44,14 @@ namespace std ...@@ -44,14 +44,14 @@ namespace std
{ {
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>::sentry:: basic_istream<_CharT, _Traits>::sentry::
sentry(basic_istream<_CharT, _Traits>& __in, bool __noskipws) sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false)
{ {
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
if (__in.good()) if (__in.good())
{ {
if (__in.tie()) if (__in.tie())
__in.tie()->flush(); __in.tie()->flush();
if (!__noskipws && (__in.flags() & ios_base::skipws)) if (!__noskip && (__in.flags() & ios_base::skipws))
{ {
const __int_type __eof = traits_type::eof(); const __int_type __eof = traits_type::eof();
__streambuf_type* __sb = __in.rdbuf(); __streambuf_type* __sb = __in.rdbuf();
...@@ -59,7 +59,7 @@ namespace std ...@@ -59,7 +59,7 @@ namespace std
const __ctype_type& __ct = __check_facet(__in._M_ctype); const __ctype_type& __ct = __check_facet(__in._M_ctype);
while (!traits_type::eq_int_type(__c, __eof) while (!traits_type::eq_int_type(__c, __eof)
&& __ct.is(ctype_base::space, && __ct.is(ctype_base::space,
traits_type::to_char_type(__c))) traits_type::to_char_type(__c)))
__c = __sb->snextc(); __c = __sb->snextc();
...@@ -75,7 +75,6 @@ namespace std ...@@ -75,7 +75,6 @@ namespace std
_M_ok = true; _M_ok = true;
else else
{ {
_M_ok = false;
__err |= ios_base::failbit; __err |= ios_base::failbit;
__in.setstate(__err); __in.setstate(__err);
} }
......
...@@ -416,7 +416,7 @@ namespace std ...@@ -416,7 +416,7 @@ namespace std
facet(const facet&); // Not defined. facet(const facet&); // Not defined.
void facet&
operator=(const facet&); // Not defined. operator=(const facet&); // Not defined.
}; };
......
...@@ -1624,6 +1624,13 @@ namespace std ...@@ -1624,6 +1624,13 @@ namespace std
void void
_M_cache(const locale& __loc); _M_cache(const locale& __loc);
private:
__numpunct_cache&
operator=(const __numpunct_cache&);
explicit
__numpunct_cache(const __numpunct_cache&);
}; };
template<typename _CharT> template<typename _CharT>
...@@ -2487,8 +2494,8 @@ namespace std ...@@ -2487,8 +2494,8 @@ namespace std
*/ */
explicit explicit
collate(size_t __refs = 0) collate(size_t __refs = 0)
: facet(__refs) : facet(__refs), _M_c_locale_collate(_S_get_c_locale())
{ _M_c_locale_collate = _S_get_c_locale(); } { }
/** /**
* @brief Internal constructor. Not for general use. * @brief Internal constructor. Not for general use.
...@@ -2501,8 +2508,8 @@ namespace std ...@@ -2501,8 +2508,8 @@ namespace std
*/ */
explicit explicit
collate(__c_locale __cloc, size_t __refs = 0) collate(__c_locale __cloc, size_t __refs = 0)
: facet(__refs) : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc))
{ _M_c_locale_collate = _S_clone_c_locale(__cloc); } { }
/** /**
* @brief Compare two strings. * @brief Compare two strings.
...@@ -2757,6 +2764,13 @@ namespace std ...@@ -2757,6 +2764,13 @@ namespace std
void void
_M_cache(const locale& __loc); _M_cache(const locale& __loc);
private:
__timepunct_cache&
operator=(const __timepunct_cache&);
explicit
__timepunct_cache(const __timepunct_cache&);
}; };
template<typename _CharT> template<typename _CharT>
...@@ -3493,6 +3507,13 @@ namespace std ...@@ -3493,6 +3507,13 @@ namespace std
void void
_M_cache(const locale& __loc); _M_cache(const locale& __loc);
private:
__moneypunct_cache&
operator=(const __moneypunct_cache&);
explicit
__moneypunct_cache(const __moneypunct_cache&);
}; };
template<typename _CharT, bool _Intl> template<typename _CharT, bool _Intl>
......
...@@ -44,7 +44,7 @@ namespace std ...@@ -44,7 +44,7 @@ namespace std
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>::sentry:: basic_ostream<_CharT, _Traits>::sentry::
sentry(basic_ostream<_CharT, _Traits>& __os) sentry(basic_ostream<_CharT, _Traits>& __os)
: _M_os(__os) : _M_ok(false), _M_os(__os)
{ {
// XXX MT // XXX MT
if (__os.tie() && __os.good()) if (__os.tie() && __os.good())
...@@ -53,10 +53,7 @@ namespace std ...@@ -53,10 +53,7 @@ namespace std
if (__os.good()) if (__os.good())
_M_ok = true; _M_ok = true;
else else
{ __os.setstate(ios_base::failbit);
_M_ok = false;
__os.setstate(ios_base::failbit);
}
} }
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
......
...@@ -189,15 +189,17 @@ namespace __gnu_debug ...@@ -189,15 +189,17 @@ namespace __gnu_debug
} _M_string; } _M_string;
} _M_variant; } _M_variant;
_Parameter() : _M_kind(__unused_param) { } _Parameter() : _M_kind(__unused_param), _M_variant() { }
_Parameter(long __value, const char* __name) : _M_kind(__integer) _Parameter(long __value, const char* __name)
: _M_kind(__integer), _M_variant()
{ {
_M_variant._M_integer._M_name = __name; _M_variant._M_integer._M_name = __name;
_M_variant._M_integer._M_value = __value; _M_variant._M_integer._M_value = __value;
} }
_Parameter(const char* __value, const char* __name) : _M_kind(__string) _Parameter(const char* __value, const char* __name)
: _M_kind(__string), _M_variant()
{ {
_M_variant._M_string._M_name = __name; _M_variant._M_string._M_name = __name;
_M_variant._M_string._M_value = __value; _M_variant._M_string._M_value = __value;
...@@ -206,7 +208,7 @@ namespace __gnu_debug ...@@ -206,7 +208,7 @@ namespace __gnu_debug
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
_Parameter(const _Safe_iterator<_Iterator, _Sequence>& __it, _Parameter(const _Safe_iterator<_Iterator, _Sequence>& __it,
const char* __name, _Is_iterator) const char* __name, _Is_iterator)
: _M_kind(__iterator) : _M_kind(__iterator), _M_variant()
{ {
_M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_name = __name;
_M_variant._M_iterator._M_address = &__it; _M_variant._M_iterator._M_address = &__it;
...@@ -235,7 +237,7 @@ namespace __gnu_debug ...@@ -235,7 +237,7 @@ namespace __gnu_debug
template<typename _Type> template<typename _Type>
_Parameter(const _Type*& __it, const char* __name, _Is_iterator) _Parameter(const _Type*& __it, const char* __name, _Is_iterator)
: _M_kind(__iterator) : _M_kind(__iterator), _M_variant()
{ {
_M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_name = __name;
_M_variant._M_iterator._M_address = &__it; _M_variant._M_iterator._M_address = &__it;
...@@ -248,7 +250,7 @@ namespace __gnu_debug ...@@ -248,7 +250,7 @@ namespace __gnu_debug
template<typename _Type> template<typename _Type>
_Parameter(_Type*& __it, const char* __name, _Is_iterator) _Parameter(_Type*& __it, const char* __name, _Is_iterator)
: _M_kind(__iterator) : _M_kind(__iterator), _M_variant()
{ {
_M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_name = __name;
_M_variant._M_iterator._M_address = &__it; _M_variant._M_iterator._M_address = &__it;
...@@ -261,7 +263,7 @@ namespace __gnu_debug ...@@ -261,7 +263,7 @@ namespace __gnu_debug
template<typename _Iterator> template<typename _Iterator>
_Parameter(const _Iterator& __it, const char* __name, _Is_iterator) _Parameter(const _Iterator& __it, const char* __name, _Is_iterator)
: _M_kind(__iterator) : _M_kind(__iterator), _M_variant()
{ {
_M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_name = __name;
_M_variant._M_iterator._M_address = &__it; _M_variant._M_iterator._M_address = &__it;
...@@ -276,7 +278,7 @@ namespace __gnu_debug ...@@ -276,7 +278,7 @@ namespace __gnu_debug
template<typename _Sequence> template<typename _Sequence>
_Parameter(const _Safe_sequence<_Sequence>& __seq, _Parameter(const _Safe_sequence<_Sequence>& __seq,
const char* __name, _Is_sequence) const char* __name, _Is_sequence)
: _M_kind(__sequence) : _M_kind(__sequence), _M_variant()
{ {
_M_variant._M_sequence._M_name = __name; _M_variant._M_sequence._M_name = __name;
_M_variant._M_sequence._M_address = _M_variant._M_sequence._M_address =
...@@ -286,7 +288,7 @@ namespace __gnu_debug ...@@ -286,7 +288,7 @@ namespace __gnu_debug
template<typename _Sequence> template<typename _Sequence>
_Parameter(const _Sequence& __seq, const char* __name, _Is_sequence) _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence)
: _M_kind(__sequence) : _M_kind(__sequence), _M_variant()
{ {
_M_variant._M_sequence._M_name = __name; _M_variant._M_sequence._M_name = __name;
_M_variant._M_sequence._M_address = &__seq; _M_variant._M_sequence._M_address = &__seq;
...@@ -356,6 +358,30 @@ namespace __gnu_debug ...@@ -356,6 +358,30 @@ namespace __gnu_debug
_M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false) _M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false)
{ } { }
_Error_formatter(const _Error_formatter& __o)
: _M_file(__o._M_file), _M_line(__o._M_line),
_M_num_parameters(__o._M_num_parameters), _M_text(__o._M_text),
_M_max_length(__o._M_max_length), _M_column(__o._M_column),
_M_first_line(__o._M_first_line), _M_wordwrap(__o._M_wordwrap)
{ }
_Error_formatter&
operator=(const _Error_formatter& __o)
{
if (&__o != this)
{
_M_file = __o._M_file;
_M_line = __o._M_line;
_M_num_parameters = __o._M_num_parameters;
_M_text = __o._M_text;
_M_max_length = __o._M_max_length;
_M_column = __o._M_column;
_M_first_line = __o._M_first_line;
_M_wordwrap = __o._M_wordwrap;
}
return *this;
}
template<typename _Tp> template<typename _Tp>
void void
_M_format_word(char*, int, const char*, _Tp) const; _M_format_word(char*, int, const char*, _Tp) const;
......
// Safe sequence/iterator base implementation -*- C++ -*- // Safe sequence/iterator base implementation -*- C++ -*-
// Copyright (C) 2003 // Copyright (C) 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -95,6 +95,12 @@ namespace __gnu_debug ...@@ -95,6 +95,12 @@ namespace __gnu_debug
: _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
{ this->_M_attach(__x._M_sequence, __constant); } { this->_M_attach(__x._M_sequence, __constant); }
_Safe_iterator_base&
operator=(const _Safe_iterator_base&);
explicit
_Safe_iterator_base(const _Safe_iterator_base&);
~_Safe_iterator_base() { this->_M_detach(); } ~_Safe_iterator_base() { this->_M_detach(); }
public: public:
...@@ -158,6 +164,12 @@ namespace __gnu_debug ...@@ -158,6 +164,12 @@ namespace __gnu_debug
: _M_iterators(0), _M_const_iterators(0), _M_version(1) : _M_iterators(0), _M_const_iterators(0), _M_version(1)
{ } { }
explicit
_Safe_sequence_base(const _Safe_sequence_base&);
_Safe_sequence_base&
operator=(const _Safe_sequence_base&);
/** Notify all iterators that reference this sequence that the /** Notify all iterators that reference this sequence that the
sequence is being destroyed. */ sequence is being destroyed. */
~_Safe_sequence_base() ~_Safe_sequence_base()
......
...@@ -215,7 +215,7 @@ class sequence_buffer : public iterator<std::output_iterator_tag,void,void,void, ...@@ -215,7 +215,7 @@ class sequence_buffer : public iterator<std::output_iterator_tag,void,void,void,
} }
sequence_buffer& operator*() { return *this; } sequence_buffer& operator*() { return *this; }
sequence_buffer& operator++() { return *this; } sequence_buffer& operator++() { return *this; }
sequence_buffer& operator++(int) { return *this; } sequence_buffer operator++(int) { return *this; }
}; };
// The following should be treated as private, at least for now. // The following should be treated as private, at least for now.
...@@ -359,7 +359,7 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>) ...@@ -359,7 +359,7 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
// Constructor // Constructor
__gthread_mutex_t _M_ref_count_lock; __gthread_mutex_t _M_ref_count_lock;
_Refcount_Base(_RC_t __n) : _M_ref_count(__n) _Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock()
{ {
#ifdef __GTHREAD_MUTEX_INIT #ifdef __GTHREAD_MUTEX_INIT
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
...@@ -547,7 +547,11 @@ struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc> ...@@ -547,7 +547,11 @@ struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc>
static void _S_ref(_Rope_RopeRep*) {} static void _S_ref(_Rope_RopeRep*) {}
static void _S_free_if_unref(_Rope_RopeRep*) {} static void _S_free_if_unref(_Rope_RopeRep*) {}
# endif # endif
protected:
_Rope_RopeRep&
operator=(const _Rope_RopeRep&);
_Rope_RopeRep(const _Rope_RopeRep&);
}; };
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
...@@ -593,13 +597,18 @@ struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { ...@@ -593,13 +597,18 @@ struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
// the proper allocator and the properly padded size. // the proper allocator and the properly padded size.
// In contrast, the destructor deallocates the data: // In contrast, the destructor deallocates the data:
# ifndef __GC # ifndef __GC
~_Rope_RopeLeaf() { ~_Rope_RopeLeaf() throw() {
if (_M_data != this->_M_c_string) { if (_M_data != this->_M_c_string) {
this->_M_free_c_string(); this->_M_free_c_string();
} }
__STL_FREE_STRING(_M_data, this->_M_size, this->get_allocator()); __STL_FREE_STRING(_M_data, this->_M_size, this->get_allocator());
} }
# endif # endif
protected:
_Rope_RopeLeaf&
operator=(const _Rope_RopeLeaf&);
_Rope_RopeLeaf(const _Rope_RopeLeaf&);
}; };
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
...@@ -620,12 +629,17 @@ struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> { ...@@ -620,12 +629,17 @@ struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> {
_M_left(__l), _M_right(__r) _M_left(__l), _M_right(__r)
{} {}
# ifndef __GC # ifndef __GC
~_Rope_RopeConcatenation() { ~_Rope_RopeConcatenation() throw() {
this->_M_free_c_string(); this->_M_free_c_string();
_M_left->_M_unref_nonnil(); _M_left->_M_unref_nonnil();
_M_right->_M_unref_nonnil(); _M_right->_M_unref_nonnil();
} }
# endif # endif
protected:
_Rope_RopeConcatenation&
operator=(const _Rope_RopeConcatenation&);
_Rope_RopeConcatenation(const _Rope_RopeConcatenation&);
}; };
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
...@@ -666,13 +680,18 @@ struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> { ...@@ -666,13 +680,18 @@ struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> {
# endif # endif
} }
# ifndef __GC # ifndef __GC
~_Rope_RopeFunction() { ~_Rope_RopeFunction() throw() {
this->_M_free_c_string(); this->_M_free_c_string();
if (_M_delete_when_done) { if (_M_delete_when_done) {
delete _M_fn; delete _M_fn;
} }
} }
# endif # endif
protected:
_Rope_RopeFunction&
operator=(const _Rope_RopeFunction&);
_Rope_RopeFunction(const _Rope_RopeFunction&);
}; };
// Substring results are usually represented using just // Substring results are usually represented using just
// concatenation nodes. But in the case of very long flat ropes // concatenation nodes. But in the case of very long flat ropes
...@@ -725,7 +744,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>, ...@@ -725,7 +744,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>,
# endif # endif
this->_M_tag = _Rope_constants::_S_substringfn; this->_M_tag = _Rope_constants::_S_substringfn;
} }
virtual ~_Rope_RopeSubstring() virtual ~_Rope_RopeSubstring() throw()
{ {
# ifndef __GC # ifndef __GC
_M_base->_M_unref_nonnil(); _M_base->_M_unref_nonnil();
...@@ -787,13 +806,16 @@ class _Rope_char_ref_proxy { ...@@ -787,13 +806,16 @@ class _Rope_char_ref_proxy {
_My_rope* _M_root; // The whole rope. _My_rope* _M_root; // The whole rope.
public: public:
_Rope_char_ref_proxy(_My_rope* __r, size_t __p) _Rope_char_ref_proxy(_My_rope* __r, size_t __p)
: _M_pos(__p), _M_current_valid(false), _M_root(__r) {} : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) {}
_Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x) _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)
: _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {} : _M_pos(__x._M_pos), _M_current(__x._M_current), _M_current_valid(false),
// Don't preserve cache if the reference can outlive the _M_root(__x._M_root) {}
// expression. We claim that's not possible without calling
// a copy constructor or generating reference to a proxy // Don't preserve cache if the reference can outlive the
// reference. We declare the latter to have undefined semantics. // expression. We claim that's not possible without calling
// a copy constructor or generating reference to a proxy
// reference. We declare the latter to have undefined semantics.
_Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c) _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
: _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {} : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
inline operator _CharT () const; inline operator _CharT () const;
...@@ -1194,6 +1216,12 @@ struct _Rope_base ...@@ -1194,6 +1216,12 @@ struct _Rope_base
{ __name##Alloc().deallocate(__p, __n); } { __name##Alloc().deallocate(__p, __n); }
__ROPE_DEFINE_ALLOCS(_Alloc) __ROPE_DEFINE_ALLOCS(_Alloc)
# undef __ROPE_DEFINE_ALLOC # undef __ROPE_DEFINE_ALLOC
protected:
_Rope_base&
operator=(const _Rope_base&);
_Rope_base(const _Rope_base&);
}; };
...@@ -1546,10 +1574,8 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1546,10 +1574,8 @@ class rope : public _Rope_base<_CharT,_Alloc> {
_S_ref(this->_M_tree_ptr); _S_ref(this->_M_tree_ptr);
} }
~rope() ~rope() throw()
{ { _S_unref(this->_M_tree_ptr); }
_S_unref(this->_M_tree_ptr);
}
rope& operator=(const rope& __x) rope& operator=(const rope& __x)
{ {
...@@ -1557,7 +1583,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1557,7 +1583,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
this->_M_tree_ptr = __x._M_tree_ptr; this->_M_tree_ptr = __x._M_tree_ptr;
_S_ref(this->_M_tree_ptr); _S_ref(this->_M_tree_ptr);
_S_unref(__old); _S_unref(__old);
return(*this); return *this;
} }
void clear() void clear()
......
// String based streams -*- C++ -*- // String based streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. // Copyright (C) 1997, 1998, 1999, 2002, 2003, 2004
// Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -110,7 +111,7 @@ namespace std ...@@ -110,7 +111,7 @@ namespace std
*/ */
explicit explicit
basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out) basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
: __streambuf_type(), _M_string() : __streambuf_type(), _M_mode(), _M_string()
{ _M_stringbuf_init(__mode); } { _M_stringbuf_init(__mode); }
/** /**
...@@ -124,7 +125,7 @@ namespace std ...@@ -124,7 +125,7 @@ namespace std
explicit explicit
basic_stringbuf(const __string_type& __str, basic_stringbuf(const __string_type& __str,
ios_base::openmode __mode = ios_base::in | ios_base::out) ios_base::openmode __mode = ios_base::in | ios_base::out)
: __streambuf_type(), _M_string(__str.data(), __str.size()) : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size())
{ _M_stringbuf_init(__mode); } { _M_stringbuf_init(__mode); }
// Get and set: // Get and set:
......
// Stream buffer classes -*- C++ -*- // Stream buffer classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -762,10 +762,15 @@ namespace std ...@@ -762,10 +762,15 @@ namespace std
} }
#endif #endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// Side effect of DR 50.
private: private:
basic_streambuf(const __streambuf_type&) { }; // _GLIBCXX_RESOLVE_LIB_DEFECTS
// Side effect of DR 50.
basic_streambuf(const __streambuf_type& __sb)
: _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
_M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
_M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur),
_M_buf_locale(__sb._M_buf_locale)
{ }
__streambuf_type& __streambuf_type&
operator=(const __streambuf_type&) { return *this; }; operator=(const __streambuf_type&) { return *this; };
......
...@@ -45,13 +45,15 @@ namespace std ...@@ -45,13 +45,15 @@ namespace std
codecvt<char, char, mbstate_t>:: codecvt<char, char, mbstate_t>::
codecvt(size_t __refs) codecvt(size_t __refs)
: __codecvt_abstract_base<char, char, mbstate_t>(__refs) : __codecvt_abstract_base<char, char, mbstate_t>(__refs),
{ _M_c_locale_codecvt = _S_get_c_locale(); } _M_c_locale_codecvt(_S_get_c_locale())
{ }
codecvt<char, char, mbstate_t>:: codecvt<char, char, mbstate_t>::
codecvt(__c_locale __cloc, size_t __refs) codecvt(__c_locale __cloc, size_t __refs)
: __codecvt_abstract_base<char, char, mbstate_t>(__refs) : __codecvt_abstract_base<char, char, mbstate_t>(__refs),
{ _M_c_locale_codecvt = _S_clone_c_locale(__cloc); } _M_c_locale_codecvt(_S_clone_c_locale(__cloc))
{ }
codecvt<char, char, mbstate_t>:: codecvt<char, char, mbstate_t>::
~codecvt() ~codecvt()
...@@ -123,13 +125,15 @@ namespace std ...@@ -123,13 +125,15 @@ namespace std
// codecvt<wchar_t, char, mbstate_t> required specialization // codecvt<wchar_t, char, mbstate_t> required specialization
codecvt<wchar_t, char, mbstate_t>:: codecvt<wchar_t, char, mbstate_t>::
codecvt(size_t __refs) codecvt(size_t __refs)
: __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs) : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs),
{ _M_c_locale_codecvt = _S_get_c_locale(); } _M_c_locale_codecvt(_S_get_c_locale())
{ }
codecvt<wchar_t, char, mbstate_t>:: codecvt<wchar_t, char, mbstate_t>::
codecvt(__c_locale __cloc, size_t __refs) codecvt(__c_locale __cloc, size_t __refs)
: __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs) : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs),
{ _M_c_locale_codecvt = _S_clone_c_locale(__cloc); } _M_c_locale_codecvt(_S_clone_c_locale(__cloc))
{ }
codecvt<wchar_t, char, mbstate_t>:: codecvt<wchar_t, char, mbstate_t>::
~codecvt() ~codecvt()
......
...@@ -86,18 +86,14 @@ namespace std ...@@ -86,18 +86,14 @@ namespace std
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::ctype(size_t __refs) ctype<wchar_t>::ctype(size_t __refs)
: __ctype_abstract_base<wchar_t>(__refs) : __ctype_abstract_base<wchar_t>(__refs),
{ _M_c_locale_ctype(_S_get_c_locale()), _M_narrow_ok(false)
_M_c_locale_ctype = _S_get_c_locale(); { _M_initialize_ctype(); }
_M_initialize_ctype();
}
ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs) ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs)
: __ctype_abstract_base<wchar_t>(__refs) : __ctype_abstract_base<wchar_t>(__refs),
{ _M_c_locale_ctype(_S_clone_c_locale(__cloc)), _M_narrow_ok(false)
_M_c_locale_ctype = _S_clone_c_locale(__cloc); { _M_initialize_ctype(); }
_M_initialize_ctype();
}
ctype<wchar_t>::~ctype() ctype<wchar_t>::~ctype()
{ _S_destroy_c_locale(_M_c_locale_ctype); } { _S_destroy_c_locale(_M_c_locale_ctype); }
......
...@@ -112,7 +112,9 @@ namespace std ...@@ -112,7 +112,9 @@ namespace std
bool ios_base::Init::_S_synced_with_stdio = true; bool ios_base::Init::_S_synced_with_stdio = true;
ios_base::ios_base() ios_base::ios_base()
: _M_callbacks(0), _M_word_size(_S_local_word_size), _M_word(_M_local_word) : _M_precision(), _M_width(), _M_flags(), _M_exception(),
_M_streambuf_state(), _M_callbacks(0), _M_word_zero(),
_M_word_size(_S_local_word_size), _M_word(_M_local_word), _M_ios_locale()
{ {
// Do nothing: basic_ios::init() does it. // Do nothing: basic_ios::init() does it.
// NB: _M_callbacks and _M_word must be zero for non-initialized // NB: _M_callbacks and _M_word must be zero for non-initialized
......
...@@ -56,7 +56,8 @@ namespace std ...@@ -56,7 +56,8 @@ namespace std
#endif #endif
locale::locale(const locale& __other) throw() locale::locale(const locale& __other) throw()
{ (_M_impl = __other._M_impl)->_M_add_reference(); } : _M_impl(__other._M_impl)
{ _M_impl->_M_add_reference(); }
// This is used to initialize global and classic locales, and // This is used to initialize global and classic locales, and
// assumes that the _Impl objects are constructed correctly. // assumes that the _Impl objects are constructed correctly.
...@@ -227,10 +228,9 @@ namespace std ...@@ -227,10 +228,9 @@ namespace std
// Clone existing _Impl object. // Clone existing _Impl object.
locale::_Impl:: locale::_Impl::
_Impl(const _Impl& __imp, size_t __refs) _Impl(const _Impl& __imp, size_t __refs)
: _M_refcount(__refs), _M_facets_size(__imp._M_facets_size) : _M_refcount(__refs), _M_facets(0), _M_facets_size(__imp._M_facets_size),
_M_caches(0), _M_names(0)
{ {
_M_facets = _M_caches = 0;
_M_names = 0;
try try
{ {
_M_facets = new const facet*[_M_facets_size]; _M_facets = new const facet*[_M_facets_size];
......
...@@ -98,7 +98,7 @@ namespace std ...@@ -98,7 +98,7 @@ namespace std
{ {
using namespace __gnu_internal; using namespace __gnu_internal;
locale::locale() throw() locale::locale() throw() : _M_impl(0)
{ {
_S_initialize(); _S_initialize();
__glibcxx_mutex_lock(__gnu_internal::locale_cons_mutex); __glibcxx_mutex_lock(__gnu_internal::locale_cons_mutex);
...@@ -249,7 +249,8 @@ namespace std ...@@ -249,7 +249,8 @@ namespace std
// Construct "C" _Impl. // Construct "C" _Impl.
locale::_Impl:: locale::_Impl::
_Impl(size_t __refs) throw() _Impl(size_t __refs) throw()
: _M_refcount(__refs), _M_facets_size(_GLIBCXX_NUM_FACETS) : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
_M_caches(0), _M_names(0)
{ {
_M_facets = new (&facet_vec) const facet*[_M_facets_size]; _M_facets = new (&facet_vec) const facet*[_M_facets_size];
_M_caches = new (&cache_vec) const facet*[_M_facets_size]; _M_caches = new (&cache_vec) const facet*[_M_facets_size];
......
...@@ -34,7 +34,7 @@ namespace std ...@@ -34,7 +34,7 @@ namespace std
{ {
using namespace __gnu_cxx; using namespace __gnu_cxx;
locale::locale(const char* __s) locale::locale(const char* __s) : _M_impl(0)
{ {
if (__s) if (__s)
{ {
...@@ -148,6 +148,7 @@ namespace std ...@@ -148,6 +148,7 @@ namespace std
} }
locale::locale(const locale& __base, const char* __s, category __cat) locale::locale(const locale& __base, const char* __s, category __cat)
: _M_impl(0)
{ {
// NB: There are complicated, yet more efficient ways to do // NB: There are complicated, yet more efficient ways to do
// this. Building up locales on a per-category way is tedious, so // this. Building up locales on a per-category way is tedious, so
...@@ -157,6 +158,7 @@ namespace std ...@@ -157,6 +158,7 @@ namespace std
} }
locale::locale(const locale& __base, const locale& __add, category __cat) locale::locale(const locale& __base, const locale& __add, category __cat)
: _M_impl(0)
{ _M_coalesce(__base, __add, __cat); } { _M_coalesce(__base, __add, __cat); }
void void
...@@ -178,15 +180,14 @@ namespace std ...@@ -178,15 +180,14 @@ namespace std
// Construct named _Impl. // Construct named _Impl.
locale::_Impl:: locale::_Impl::
_Impl(const char* __s, size_t __refs) _Impl(const char* __s, size_t __refs)
: _M_refcount(__refs), _M_facets_size(_GLIBCXX_NUM_FACETS) : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
_M_caches(0), _M_names(0)
{ {
// Initialize the underlying locale model, which also checks to // Initialize the underlying locale model, which also checks to
// see if the given name is valid. // see if the given name is valid.
__c_locale __cloc; __c_locale __cloc;
locale::facet::_S_create_c_locale(__cloc, __s); locale::facet::_S_create_c_locale(__cloc, __s);
_M_facets = _M_caches = 0;
_M_names = 0;
try try
{ {
_M_facets = new const facet*[_M_facets_size]; _M_facets = new const facet*[_M_facets_size];
......
...@@ -53,7 +53,7 @@ void test01() ...@@ -53,7 +53,7 @@ void test01()
iterator_type is_it01(iss); iterator_type is_it01(iss);
string result1; string result1;
ios_base::iostate err01 = ios_base::goodbit; ios_base::iostate err01 = ios_base::goodbit;
mon_get.get(is_it01, end, true, iss, err01, result1); mon_get.get(is_it01, end, true, iss, err01, result1); // xxx
VERIFY( result1 == digits1 ); VERIFY( result1 == digits1 );
VERIFY( err01 == ios_base::eofbit ); VERIFY( err01 == ios_base::eofbit );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment