diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2004-05-22 23:46:34 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2004-05-22 23:46:34 +0000 |
commit | 26c691a88b8a403e7a92ce049368cc7efe3567ce (patch) | |
tree | 4eb79935bc90f022040e5aed4af6bec9bdfa0b5f /libstdc++-v3/config | |
parent | d6dc556b315b8e1b99922eda0319548ecb5233e9 (diff) | |
download | gcc-26c691a88b8a403e7a92ce049368cc7efe3567ce.zip gcc-26c691a88b8a403e7a92ce049368cc7efe3567ce.tar.gz gcc-26c691a88b8a403e7a92ce049368cc7efe3567ce.tar.bz2 |
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
Diffstat (limited to 'libstdc++-v3/config')
-rw-r--r-- | libstdc++-v3/config/locale/gnu/messages_members.h | 34 | ||||
-rw-r--r-- | libstdc++-v3/config/locale/gnu/time_members.h | 32 | ||||
-rw-r--r-- | libstdc++-v3/config/os/gnu-linux/ctype_noninline.h | 40 |
3 files changed, 39 insertions, 67 deletions
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<typename _CharT> 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<typename _CharT> - 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<typename _CharT> @@ -71,10 +64,8 @@ template<typename _CharT> 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<typename _CharT> __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<typename _CharT> __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<typename _CharT> - __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<typename _CharT> __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<char>::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<char>::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<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)); - _M_widen_ok = 0; memset(_M_narrow, 0, sizeof(_M_narrow)); - _M_narrow_ok = 0; } #else 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)); 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 |