From: bkoz Date: Sat, 22 May 2004 23:46:34 +0000 (+0000) Subject: 2004-05-22 Benjamin Kosnik X-Git-Tag: upstream/4.9.2~71098 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c183af9a5879e3cbc8153a00ad34895771eea90b;p=platform%2Fupstream%2Flinaro-gcc.git 2004-05-22 Benjamin Kosnik 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82153 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2e99412..9f31df1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,51 @@ 2004-05-22 Benjamin Kosnik + 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 + * testsuite/testsuite_hooks.h (func_callback): Declare copy constructor and assignment operator private. * testsuite/23_containers/deque/cons/clear_allocator.cc: Match diff --git a/libstdc++-v3/config/locale/gnu/messages_members.h b/libstdc++-v3/config/locale/gnu/messages_members.h index c036a70..a7cd1cd 100644 --- a/libstdc++-v3/config/locale/gnu/messages_members.h +++ b/libstdc++-v3/config/locale/gnu/messages_members.h @@ -36,26 +36,19 @@ // Non-virtual member functions. template messages<_CharT>::messages(size_t __refs) - : facet(__refs) - { -#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) - _M_name_messages = _S_get_c_name(); -#endif - _M_c_locale_messages = _S_get_c_locale(); - } + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), + _M_name_messages(_S_get_c_name()) + { } template - messages<_CharT>::messages(__c_locale __cloc, - const char* __s __attribute__ ((__unused__)), + messages<_CharT>::messages(__c_locale __cloc, const char* __s, 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]; std::strcpy(__tmp, __s); _M_name_messages = __tmp; -#endif - _M_c_locale_messages = _S_clone_c_locale(__cloc); } template @@ -71,10 +64,8 @@ template messages<_CharT>::~messages() { -#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) if (_M_name_messages != _S_get_c_name()) delete [] _M_name_messages; -#endif _S_destroy_c_locale(_M_c_locale_messages); } @@ -99,16 +90,15 @@ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) : messages<_CharT>(__refs) { -#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) if (this->_M_name_messages != locale::facet::_S_get_c_name()) delete [] this->_M_name_messages; char* __tmp = new char[std::strlen(__s) + 1]; std::strcpy(__tmp, __s); this->_M_name_messages = __tmp; -#endif - if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) - { - this->_S_destroy_c_locale(this->_M_c_locale_messages); - this->_S_create_c_locale(this->_M_c_locale_messages, __s); - } + + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) + { + this->_S_destroy_c_locale(this->_M_c_locale_messages); + this->_S_create_c_locale(this->_M_c_locale_messages, __s); + } } diff --git a/libstdc++-v3/config/locale/gnu/time_members.h b/libstdc++-v3/config/locale/gnu/time_members.h index 142ed2b..9cb3594 100644 --- a/libstdc++-v3/config/locale/gnu/time_members.h +++ b/libstdc++-v3/config/locale/gnu/time_members.h @@ -1,6 +1,6 @@ // 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 // software; you can redistribute it and/or modify it under the @@ -36,45 +36,33 @@ template __timepunct<_CharT>::__timepunct(size_t __refs) - : facet(__refs), _M_data(NULL) - { -#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) - _M_name_timepunct = _S_get_c_name(); -#endif - _M_initialize_timepunct(); - } + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), + _M_name_timepunct(_S_get_c_name()) + { _M_initialize_timepunct(); } template __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) - : facet(__refs), _M_data(__cache) - { -#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) - _M_name_timepunct = _S_get_c_name(); -#endif - _M_initialize_timepunct(); - } + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), + _M_name_timepunct(_S_get_c_name()) + { _M_initialize_timepunct(); } template - __timepunct<_CharT>::__timepunct(__c_locale __cloc, - const char* __s __attribute__ ((__unused__)), + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, 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]; std::strcpy(__tmp, __s); _M_name_timepunct = __tmp; -#endif _M_initialize_timepunct(__cloc); } template __timepunct<_CharT>::~__timepunct() { -#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) if (_M_name_timepunct != _S_get_c_name()) delete [] _M_name_timepunct; -#endif delete _M_data; _S_destroy_c_locale(_M_c_locale_timepunct); } diff --git a/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h b/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h index ae4c14d..925a5d0 100644 --- a/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h +++ b/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -59,21 +59,21 @@ #if _GLIBCXX_C_LOCALE_GNU ctype::ctype(__c_locale __cloc, const mask* __table, bool __del, 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)); - _M_widen_ok = 0; memset(_M_narrow, 0, sizeof(_M_narrow)); - _M_narrow_ok = 0; } #else ctype::ctype(__c_locale, 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)); setlocale(LC_CTYPE, "C"); @@ -88,30 +88,27 @@ #endif setlocale(LC_CTYPE, __old); free(__old); - _M_c_locale_ctype = _S_get_c_locale(); memset(_M_widen, 0, sizeof(_M_widen)); - _M_widen_ok = 0; memset(_M_narrow, 0, sizeof(_M_narrow)); - _M_narrow_ok = 0; } #endif #if _GLIBCXX_C_LOCALE_GNU ctype::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)); - _M_widen_ok = 0; memset(_M_narrow, 0, sizeof(_M_narrow)); - _M_narrow_ok = 0; } #else ctype::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)); setlocale(LC_CTYPE, "C"); @@ -126,11 +123,8 @@ #endif setlocale(LC_CTYPE, __old); free(__old); - _M_c_locale_ctype = _S_get_c_locale(); memset(_M_widen, 0, sizeof(_M_widen)); - _M_widen_ok = 0; memset(_M_narrow, 0, sizeof(_M_narrow)); - _M_narrow_ok = 0; } #endif diff --git a/libstdc++-v3/include/backward/strstream b/libstdc++-v3/include/backward/strstream index 695d797..a5b95c5 100644 --- a/libstdc++-v3/include/backward/strstream +++ b/libstdc++-v3/include/backward/strstream @@ -1,6 +1,6 @@ // 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 // software; you can redistribute it and/or modify it under the @@ -98,6 +98,11 @@ namespace std = ios_base::in | ios_base::out); private: + strstreambuf& + operator=(const strstreambuf&); + + strstreambuf(const strstreambuf&); + // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. char* _M_alloc(size_t); void _M_free(char*); diff --git a/libstdc++-v3/include/bits/basic_ios.h b/libstdc++-v3/include/bits/basic_ios.h index 8e0b31e..7ffe40e 100644 --- a/libstdc++-v3/include/bits/basic_ios.h +++ b/libstdc++-v3/include/bits/basic_ios.h @@ -1,6 +1,6 @@ // 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. // // This file is part of the GNU ISO C++ Library. This library is free @@ -254,7 +254,8 @@ namespace std */ explicit 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); } /** @@ -440,7 +441,9 @@ namespace std * The default constructor does nothing and is not normally * 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) { } /** diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 6837e01..16fe5ac 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -418,14 +418,22 @@ namespace std * @param str Source 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. * @param s Source null-terminated 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. @@ -435,7 +443,11 @@ namespace std * (*this)[0] == @a c. */ basic_string& - operator=(_CharT __c) { return this->assign(1, __c); } + operator=(_CharT __c) + { + this->assign(1, __c); + return *this; + } // Iterators: /** diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 9f46279..6c2e182 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -73,10 +73,10 @@ namespace std template 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_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_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0), _M_ext_end(0) diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index b9dd0b1..52deb6e 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -44,14 +44,14 @@ namespace std { template 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); if (__in.good()) { if (__in.tie()) __in.tie()->flush(); - if (!__noskipws && (__in.flags() & ios_base::skipws)) + if (!__noskip && (__in.flags() & ios_base::skipws)) { const __int_type __eof = traits_type::eof(); __streambuf_type* __sb = __in.rdbuf(); @@ -59,7 +59,7 @@ namespace std const __ctype_type& __ct = __check_facet(__in._M_ctype); while (!traits_type::eq_int_type(__c, __eof) - && __ct.is(ctype_base::space, + && __ct.is(ctype_base::space, traits_type::to_char_type(__c))) __c = __sb->snextc(); @@ -75,7 +75,6 @@ namespace std _M_ok = true; else { - _M_ok = false; __err |= ios_base::failbit; __in.setstate(__err); } diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h index 5366d65..3748342 100644 --- a/libstdc++-v3/include/bits/locale_classes.h +++ b/libstdc++-v3/include/bits/locale_classes.h @@ -416,7 +416,7 @@ namespace std facet(const facet&); // Not defined. - void + facet& operator=(const facet&); // Not defined. }; diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index c1d430d..60db8a4 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -1624,6 +1624,13 @@ namespace std void _M_cache(const locale& __loc); + + private: + __numpunct_cache& + operator=(const __numpunct_cache&); + + explicit + __numpunct_cache(const __numpunct_cache&); }; template @@ -2487,8 +2494,8 @@ namespace std */ explicit collate(size_t __refs = 0) - : facet(__refs) - { _M_c_locale_collate = _S_get_c_locale(); } + : facet(__refs), _M_c_locale_collate(_S_get_c_locale()) + { } /** * @brief Internal constructor. Not for general use. @@ -2501,8 +2508,8 @@ namespace std */ explicit collate(__c_locale __cloc, size_t __refs = 0) - : facet(__refs) - { _M_c_locale_collate = _S_clone_c_locale(__cloc); } + : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc)) + { } /** * @brief Compare two strings. @@ -2757,6 +2764,13 @@ namespace std void _M_cache(const locale& __loc); + + private: + __timepunct_cache& + operator=(const __timepunct_cache&); + + explicit + __timepunct_cache(const __timepunct_cache&); }; template @@ -3493,6 +3507,13 @@ namespace std void _M_cache(const locale& __loc); + + private: + __moneypunct_cache& + operator=(const __moneypunct_cache&); + + explicit + __moneypunct_cache(const __moneypunct_cache&); }; template diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index 5510ea3..2d1b5b4 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -44,7 +44,7 @@ namespace std template basic_ostream<_CharT, _Traits>::sentry:: sentry(basic_ostream<_CharT, _Traits>& __os) - : _M_os(__os) + : _M_ok(false), _M_os(__os) { // XXX MT if (__os.tie() && __os.good()) @@ -53,10 +53,7 @@ namespace std if (__os.good()) _M_ok = true; else - { - _M_ok = false; - __os.setstate(ios_base::failbit); - } + __os.setstate(ios_base::failbit); } template diff --git a/libstdc++-v3/include/debug/formatter.h b/libstdc++-v3/include/debug/formatter.h index 7022fa7..9b5fb1b 100644 --- a/libstdc++-v3/include/debug/formatter.h +++ b/libstdc++-v3/include/debug/formatter.h @@ -189,15 +189,17 @@ namespace __gnu_debug } _M_string; } _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_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_value = __value; @@ -206,7 +208,7 @@ namespace __gnu_debug template _Parameter(const _Safe_iterator<_Iterator, _Sequence>& __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_address = &__it; @@ -235,7 +237,7 @@ namespace __gnu_debug template _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_address = &__it; @@ -248,7 +250,7 @@ namespace __gnu_debug template _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_address = &__it; @@ -261,7 +263,7 @@ namespace __gnu_debug template _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_address = &__it; @@ -276,7 +278,7 @@ namespace __gnu_debug template _Parameter(const _Safe_sequence<_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_address = @@ -286,7 +288,7 @@ namespace __gnu_debug template _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_address = &__seq; @@ -356,6 +358,30 @@ namespace __gnu_debug _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 void _M_format_word(char*, int, const char*, _Tp) const; diff --git a/libstdc++-v3/include/debug/safe_base.h b/libstdc++-v3/include/debug/safe_base.h index 07bc3b3..10f9ec7 100644 --- a/libstdc++-v3/include/debug/safe_base.h +++ b/libstdc++-v3/include/debug/safe_base.h @@ -1,6 +1,6 @@ // Safe sequence/iterator base implementation -*- C++ -*- -// Copyright (C) 2003 +// Copyright (C) 2003, 2004 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -95,6 +95,12 @@ namespace __gnu_debug : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) { 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(); } public: @@ -158,6 +164,12 @@ namespace __gnu_debug : _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 sequence is being destroyed. */ ~_Safe_sequence_base() diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope index 22a1797..142c40e 100644 --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -215,7 +215,7 @@ class sequence_buffer : public iterator) // Constructor __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 __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; @@ -547,7 +547,11 @@ struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc> static void _S_ref(_Rope_RopeRep*) {} static void _S_free_if_unref(_Rope_RopeRep*) {} # endif +protected: + _Rope_RopeRep& + operator=(const _Rope_RopeRep&); + _Rope_RopeRep(const _Rope_RopeRep&); }; template @@ -593,13 +597,18 @@ struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { // the proper allocator and the properly padded size. // In contrast, the destructor deallocates the data: # ifndef __GC - ~_Rope_RopeLeaf() { + ~_Rope_RopeLeaf() throw() { if (_M_data != this->_M_c_string) { this->_M_free_c_string(); } __STL_FREE_STRING(_M_data, this->_M_size, this->get_allocator()); } # endif +protected: + _Rope_RopeLeaf& + operator=(const _Rope_RopeLeaf&); + + _Rope_RopeLeaf(const _Rope_RopeLeaf&); }; template @@ -620,12 +629,17 @@ struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> { _M_left(__l), _M_right(__r) {} # ifndef __GC - ~_Rope_RopeConcatenation() { + ~_Rope_RopeConcatenation() throw() { this->_M_free_c_string(); _M_left->_M_unref_nonnil(); _M_right->_M_unref_nonnil(); } # endif +protected: + _Rope_RopeConcatenation& + operator=(const _Rope_RopeConcatenation&); + + _Rope_RopeConcatenation(const _Rope_RopeConcatenation&); }; template @@ -666,13 +680,18 @@ struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> { # endif } # ifndef __GC - ~_Rope_RopeFunction() { + ~_Rope_RopeFunction() throw() { this->_M_free_c_string(); if (_M_delete_when_done) { delete _M_fn; } } # endif +protected: + _Rope_RopeFunction& + operator=(const _Rope_RopeFunction&); + + _Rope_RopeFunction(const _Rope_RopeFunction&); }; // Substring results are usually represented using just // concatenation nodes. But in the case of very long flat ropes @@ -725,7 +744,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>, # endif this->_M_tag = _Rope_constants::_S_substringfn; } - virtual ~_Rope_RopeSubstring() + virtual ~_Rope_RopeSubstring() throw() { # ifndef __GC _M_base->_M_unref_nonnil(); @@ -787,13 +806,16 @@ class _Rope_char_ref_proxy { _My_rope* _M_root; // The whole rope. public: _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) - : _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {} - // Don't preserve cache if the reference can outlive the - // 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. + : _M_pos(__x._M_pos), _M_current(__x._M_current), _M_current_valid(false), + _M_root(__x._M_root) {} + + // Don't preserve cache if the reference can outlive the + // 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) : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {} inline operator _CharT () const; @@ -1194,6 +1216,12 @@ struct _Rope_base { __name##Alloc().deallocate(__p, __n); } __ROPE_DEFINE_ALLOCS(_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> { _S_ref(this->_M_tree_ptr); } - ~rope() - { - _S_unref(this->_M_tree_ptr); - } + ~rope() throw() + { _S_unref(this->_M_tree_ptr); } rope& operator=(const rope& __x) { @@ -1557,7 +1583,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { this->_M_tree_ptr = __x._M_tree_ptr; _S_ref(this->_M_tree_ptr); _S_unref(__old); - return(*this); + return *this; } void clear() diff --git a/libstdc++-v3/include/std/std_sstream.h b/libstdc++-v3/include/std/std_sstream.h index a2ffcef..6b5728b 100644 --- a/libstdc++-v3/include/std/std_sstream.h +++ b/libstdc++-v3/include/std/std_sstream.h @@ -1,6 +1,7 @@ // 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 // software; you can redistribute it and/or modify it under the @@ -110,7 +111,7 @@ namespace std */ explicit 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); } /** @@ -124,7 +125,7 @@ namespace std explicit basic_stringbuf(const __string_type& __str, 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); } // Get and set: diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h index fe82b3b..42b3d78 100644 --- a/libstdc++-v3/include/std/std_streambuf.h +++ b/libstdc++-v3/include/std/std_streambuf.h @@ -1,6 +1,6 @@ // 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. // // This file is part of the GNU ISO C++ Library. This library is free @@ -762,10 +762,15 @@ namespace std } #endif - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // Side effect of DR 50. 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& operator=(const __streambuf_type&) { return *this; }; diff --git a/libstdc++-v3/src/codecvt.cc b/libstdc++-v3/src/codecvt.cc index 73d9f3f..2010593 100644 --- a/libstdc++-v3/src/codecvt.cc +++ b/libstdc++-v3/src/codecvt.cc @@ -45,13 +45,15 @@ namespace std codecvt:: codecvt(size_t __refs) - : __codecvt_abstract_base(__refs) - { _M_c_locale_codecvt = _S_get_c_locale(); } + : __codecvt_abstract_base(__refs), + _M_c_locale_codecvt(_S_get_c_locale()) + { } codecvt:: codecvt(__c_locale __cloc, size_t __refs) - : __codecvt_abstract_base(__refs) - { _M_c_locale_codecvt = _S_clone_c_locale(__cloc); } + : __codecvt_abstract_base(__refs), + _M_c_locale_codecvt(_S_clone_c_locale(__cloc)) + { } codecvt:: ~codecvt() @@ -123,13 +125,15 @@ namespace std // codecvt required specialization codecvt:: codecvt(size_t __refs) - : __codecvt_abstract_base(__refs) - { _M_c_locale_codecvt = _S_get_c_locale(); } + : __codecvt_abstract_base(__refs), + _M_c_locale_codecvt(_S_get_c_locale()) + { } codecvt:: codecvt(__c_locale __cloc, size_t __refs) - : __codecvt_abstract_base(__refs) - { _M_c_locale_codecvt = _S_clone_c_locale(__cloc); } + : __codecvt_abstract_base(__refs), + _M_c_locale_codecvt(_S_clone_c_locale(__cloc)) + { } codecvt:: ~codecvt() diff --git a/libstdc++-v3/src/ctype.cc b/libstdc++-v3/src/ctype.cc index b9a6447..777ff41 100644 --- a/libstdc++-v3/src/ctype.cc +++ b/libstdc++-v3/src/ctype.cc @@ -86,18 +86,14 @@ namespace std #ifdef _GLIBCXX_USE_WCHAR_T ctype::ctype(size_t __refs) - : __ctype_abstract_base(__refs) - { - _M_c_locale_ctype = _S_get_c_locale(); - _M_initialize_ctype(); - } + : __ctype_abstract_base(__refs), + _M_c_locale_ctype(_S_get_c_locale()), _M_narrow_ok(false) + { _M_initialize_ctype(); } ctype::ctype(__c_locale __cloc, size_t __refs) - : __ctype_abstract_base(__refs) - { - _M_c_locale_ctype = _S_clone_c_locale(__cloc); - _M_initialize_ctype(); - } + : __ctype_abstract_base(__refs), + _M_c_locale_ctype(_S_clone_c_locale(__cloc)), _M_narrow_ok(false) + { _M_initialize_ctype(); } ctype::~ctype() { _S_destroy_c_locale(_M_c_locale_ctype); } diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc index 0dfa482..12ffe2f 100644 --- a/libstdc++-v3/src/ios.cc +++ b/libstdc++-v3/src/ios.cc @@ -112,7 +112,9 @@ namespace std bool ios_base::Init::_S_synced_with_stdio = true; 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. // NB: _M_callbacks and _M_word must be zero for non-initialized diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index d28d39a..a9d0b2c 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -56,7 +56,8 @@ namespace std #endif 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 // assumes that the _Impl objects are constructed correctly. @@ -227,10 +228,9 @@ namespace std // Clone existing _Impl object. locale::_Impl:: _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 { _M_facets = new const facet*[_M_facets_size]; diff --git a/libstdc++-v3/src/locale_init.cc b/libstdc++-v3/src/locale_init.cc index 175ece6..8383c2f 100644 --- a/libstdc++-v3/src/locale_init.cc +++ b/libstdc++-v3/src/locale_init.cc @@ -98,7 +98,7 @@ namespace std { using namespace __gnu_internal; - locale::locale() throw() + locale::locale() throw() : _M_impl(0) { _S_initialize(); __glibcxx_mutex_lock(__gnu_internal::locale_cons_mutex); @@ -249,7 +249,8 @@ namespace std // Construct "C" _Impl. locale::_Impl:: _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_caches = new (&cache_vec) const facet*[_M_facets_size]; diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc index 1600b2c..e90e847 100644 --- a/libstdc++-v3/src/localename.cc +++ b/libstdc++-v3/src/localename.cc @@ -34,7 +34,7 @@ namespace std { using namespace __gnu_cxx; - locale::locale(const char* __s) + locale::locale(const char* __s) : _M_impl(0) { if (__s) { @@ -148,6 +148,7 @@ namespace std } locale::locale(const locale& __base, const char* __s, category __cat) + : _M_impl(0) { // NB: There are complicated, yet more efficient ways to do // this. Building up locales on a per-category way is tedious, so @@ -157,6 +158,7 @@ namespace std } locale::locale(const locale& __base, const locale& __add, category __cat) + : _M_impl(0) { _M_coalesce(__base, __add, __cat); } void @@ -178,15 +180,14 @@ namespace std // Construct named _Impl. locale::_Impl:: _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 // see if the given name is valid. __c_locale __cloc; locale::facet::_S_create_c_locale(__cloc, __s); - _M_facets = _M_caches = 0; - _M_names = 0; try { _M_facets = new const facet*[_M_facets_size]; diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc index 08e47d8..1275040 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/1.cc @@ -53,7 +53,7 @@ void test01() iterator_type is_it01(iss); string result1; 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( err01 == ios_base::eofbit );