diff options
Diffstat (limited to 'contrib/libstdc++/include/bits')
| -rw-r--r-- | contrib/libstdc++/include/bits/basic_ios.tcc | 3 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/basic_string.tcc | 19 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/c++config | 5 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/fstream.tcc | 9 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/ios_base.h | 3 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/istream.tcc | 80 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/locale_facets.h | 70 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/locale_facets.tcc | 150 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/localefwd.h | 45 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/sstream.tcc | 9 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/streambuf.tcc | 31 | ||||
| -rw-r--r-- | contrib/libstdc++/include/bits/stringfwd.h | 18 | 
12 files changed, 239 insertions, 203 deletions
| diff --git a/contrib/libstdc++/include/bits/basic_ios.tcc b/contrib/libstdc++/include/bits/basic_ios.tcc index a38a95b58a0f..7ee8015e29f6 100644 --- a/contrib/libstdc++/include/bits/basic_ios.tcc +++ b/contrib/libstdc++/include/bits/basic_ios.tcc @@ -187,7 +187,10 @@ namespace std    // which are defined via explicit instantiations elsewhere.      // NB:  This syntax is a GNU extension.    extern template class basic_ios<char>; + +#ifdef _GLIBCPP_USE_WCHAR_T    extern template class basic_ios<wchar_t>; +#endif  } // namespace std  #endif  diff --git a/contrib/libstdc++/include/bits/basic_string.tcc b/contrib/libstdc++/include/bits/basic_string.tcc index 6d646ad2a105..4a22d8967929 100644 --- a/contrib/libstdc++/include/bits/basic_string.tcc +++ b/contrib/libstdc++/include/bits/basic_string.tcc @@ -139,13 +139,13 @@ namespace std        {  	size_type __dnew = static_cast<size_type>(distance(__beg, __end)); +	if (__beg == __end && __a == _Alloc()) +	  return _S_empty_rep()._M_refcopy(); +  	// NB: Not required, but considered best practice.  	if (__builtin_expect(__beg == _InIter(), 0))  	  __throw_logic_error("attempt to create string with null pointer"); -	if (__beg == __end && __a == _Alloc()) -	  return _S_empty_rep()._M_refcopy(); -  	// Check for out_of_range and length_error exceptions.  	_Rep* __r = _Rep::_S_create(__dnew, __a);  	try  @@ -223,8 +223,8 @@ namespace std    template<typename _CharT, typename _Traits, typename _Alloc>      basic_string<_CharT, _Traits, _Alloc>::      basic_string(const _CharT* __s, const _Alloc& __a) -    : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : 0,  -			       __a), __a) +    : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : +			       __s + npos, __a), __a)      { }    template<typename _CharT, typename _Traits, typename _Alloc> @@ -497,7 +497,6 @@ namespace std  	this->erase(__n);        // else nothing (in particular, avoid calling _M_mutate() unnecessarily.)      } -      // This is the general replace helper, which currently gets instantiated both    // for input iterators and reverse iterators. It buffers internally and then @@ -885,9 +884,11 @@ namespace std      compare(const _CharT* __s) const      {        size_type __size = this->size(); -      int __r = traits_type::compare(_M_data(), __s, __size); +      size_type __osize = traits_type::length(__s); +      size_type __len = min(__size, __osize); +      int __r = traits_type::compare(_M_data(), __s, __len);        if (!__r) -	__r = __size - traits_type::length(__s); +	__r = __size - __osize;        return __r;      } @@ -958,6 +959,7 @@ namespace std      basic_istream<char>&       getline(basic_istream<char>&, string&); +#ifdef _GLIBCPP_USE_WCHAR_T    extern template class basic_string<wchar_t>;    extern template       basic_istream<wchar_t>&  @@ -971,6 +973,7 @@ namespace std    extern template       basic_istream<wchar_t>&       getline(basic_istream<wchar_t>&, wstring&); +#endif  } // namespace std  #endif diff --git a/contrib/libstdc++/include/bits/c++config b/contrib/libstdc++/include/bits/c++config index 41c3ba80b1ad..4315bae912b8 100644 --- a/contrib/libstdc++/include/bits/c++config +++ b/contrib/libstdc++/include/bits/c++config @@ -34,7 +34,7 @@  #include <bits/os_defines.h>  // The current version of the C++ library in compressed ISO date format. -#define __GLIBCPP__ 20021009 +#define __GLIBCPP__ 20021119  // This is necessary until GCC supports separate template  // compilation.   @@ -55,6 +55,9 @@  // Use corrected code from the committee library group's issues list.  #define _GLIBCPP_RESOLVE_LIB_DEFECTS 1 +// Hopefully temporary workaround to autoconf/m4 issue with quoting '@'. +#define _GLIBCPP_AT_AT "@@" +  // In those parts of the standard C++ library that use a mutex instead  // of a spin-lock, we now unconditionally use GCC's gthr.h mutex  // abstraction layer.  All support to directly map to various diff --git a/contrib/libstdc++/include/bits/fstream.tcc b/contrib/libstdc++/include/bits/fstream.tcc index 18dbaf1caae8..66cb9a1b179f 100644 --- a/contrib/libstdc++/include/bits/fstream.tcc +++ b/contrib/libstdc++/include/bits/fstream.tcc @@ -477,13 +477,16 @@ namespace std    // which are defined via explicit instantiations elsewhere.      // NB:  This syntax is a GNU extension.    extern template class basic_filebuf<char>; -  extern template class basic_filebuf<wchar_t>;    extern template class basic_ifstream<char>; -  extern template class basic_ifstream<wchar_t>;    extern template class basic_ofstream<char>; -  extern template class basic_ofstream<wchar_t>;    extern template class basic_fstream<char>; + +#ifdef _GLIBCPP_USE_WCHAR_T +  extern template class basic_filebuf<wchar_t>; +  extern template class basic_ifstream<wchar_t>; +  extern template class basic_ofstream<wchar_t>;    extern template class basic_fstream<wchar_t>; +#endif  } // namespace std  #endif  diff --git a/contrib/libstdc++/include/bits/ios_base.h b/contrib/libstdc++/include/bits/ios_base.h index f5b026900f60..a56475ccef60 100644 --- a/contrib/libstdc++/include/bits/ios_base.h +++ b/contrib/libstdc++/include/bits/ios_base.h @@ -220,6 +220,9 @@ namespace std      typedef int io_state;      typedef int open_mode;      typedef int seek_dir; +     +    typedef std::streampos streampos; +    typedef std::streamoff streamoff;  #endif      // Callbacks; diff --git a/contrib/libstdc++/include/bits/istream.tcc b/contrib/libstdc++/include/bits/istream.tcc index 58e2caf02cdf..a6e49a923bd2 100644 --- a/contrib/libstdc++/include/bits/istream.tcc +++ b/contrib/libstdc++/include/bits/istream.tcc @@ -811,8 +811,9 @@ namespace std  	{  	  try   	    { +	      // Cannot compare int_type with streamsize generically.  	      streamsize __num = this->rdbuf()->in_avail(); -	      if (__num > 0) +	      if (__num >= 0)  		{  		  __num = min(__num, __n);  		  if (__num) @@ -935,23 +936,8 @@ namespace std      tellg(void)      {        pos_type __ret = pos_type(-1); -      _M_gcount = 0; -      sentry __cerb(*this, true); -      if (__cerb)  -	{ -	  try  -	    { -	     __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); -	    } -	  catch(exception& __fail) -	    { -	      // 27.6.1.3 paragraph 1 -	      // Turn this on without causing an ios::failure to be thrown. -	      this->setstate(ios_base::badbit); -	      if ((this->exceptions() & ios_base::badbit) != 0) -		__throw_exception_again; -	    } -	} +      if (!this->fail()) +	__ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);        return __ret;      } @@ -962,28 +948,16 @@ namespace std      seekg(pos_type __pos)      {        _M_gcount = 0; -      sentry __cerb(*this, true); -      if (__cerb)  +      if (!this->fail())  	{ -	  try  -	    {  #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS  // 136.  seekp, seekg setting wrong streams? -	      pos_type __err = this->rdbuf()->pubseekpos(__pos, ios_base::in); +	  pos_type __err = this->rdbuf()->pubseekpos(__pos, ios_base::in);  // 129. Need error indication from seekp() and seekg() -	      if (__err == pos_type(off_type(-1))) -		this->setstate(ios_base::failbit); +	  if (__err == pos_type(off_type(-1))) +	    this->setstate(ios_base::failbit);  #endif -	    } -	  catch(exception& __fail) -	    { -	      // 27.6.1.3 paragraph 1 -	      // Turn this on without causing an ios::failure to be thrown. -	      this->setstate(ios_base::badbit); -	      if ((this->exceptions() & ios_base::badbit) != 0) -		__throw_exception_again; -	    }  	}        return *this;      } @@ -994,29 +968,17 @@ namespace std      seekg(off_type __off, ios_base::seekdir __dir)      {        _M_gcount = 0; -      sentry __cerb(*this, true); -      if (__cerb)  +      if (!this->fail())  	{ -	  try  -	    {  #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS  // 136.  seekp, seekg setting wrong streams? -	      pos_type __err = this->rdbuf()->pubseekoff(__off, __dir,  -							 ios_base::in); +	  pos_type __err = this->rdbuf()->pubseekoff(__off, __dir,  +						     ios_base::in);  // 129. Need error indication from seekp() and seekg() -	      if (__err == pos_type(off_type(-1))) -		this->setstate(ios_base::failbit); +	  if (__err == pos_type(off_type(-1))) +	    this->setstate(ios_base::failbit);  #endif -	    } -	  catch(exception& __fail) -	    { -	      // 27.6.1.3 paragraph 1 -	      // Turn this on without causing an ios::failure to be thrown. -	      this->setstate(ios_base::badbit); -	      if ((this->exceptions() & ios_base::badbit) != 0) -		__throw_exception_again; -	    }  	}        return *this;      } @@ -1073,13 +1035,14 @@ namespace std  	      int_type __c = __sb->sgetc();  	      while (__extracted < __num - 1  -		     && __c != __eof && !__ctype.is(ctype_base::space, __c)) +		     && !_Traits::eq_int_type(__c, __eof) +		     && !__ctype.is(ctype_base::space, __c))  		{  		  *__s++ = __c;  		  ++__extracted;  		  __c = __sb->snextc();  		} -	      if (__c == __eof) +	      if (_Traits::eq_int_type(__c, __eof))  		__in.setstate(ios_base::eofbit);  #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS @@ -1117,9 +1080,11 @@ namespace std        __streambuf_type* __sb = __in.rdbuf();        __int_type __c = __sb->sgetc(); -      while (__c != __eof && __ctype.is(ctype_base::space, __c)) +      while (!_Traits::eq_int_type(__c, __eof)  +	     && __ctype.is(ctype_base::space, __c))  	__c = __sb->snextc(); -      if (__c == __eof) + +       if (_Traits::eq_int_type(__c, __eof))  	__in.setstate(ios_base::eofbit);        return __in; @@ -1153,13 +1118,14 @@ namespace std  	  __int_type __c = __sb->sgetc();  	  while (__extracted < __n  -		 && __c != __eof && !__ctype.is(ctype_base::space, __c)) +		 && !_Traits::eq_int_type(__c, __eof) +		 && !__ctype.is(ctype_base::space, __c))  	    {  	      __str += _Traits::to_char_type(__c);  	      ++__extracted;  	      __c = __sb->snextc();  	    } -	  if (__c == __eof) +	  if (_Traits::eq_int_type(__c, __eof))  	    __in.setstate(ios_base::eofbit);  	  __in.width(0);  	} diff --git a/contrib/libstdc++/include/bits/locale_facets.h b/contrib/libstdc++/include/bits/locale_facets.h index f99562fac49e..660bad3c11a9 100644 --- a/contrib/libstdc++/include/bits/locale_facets.h +++ b/contrib/libstdc++/include/bits/locale_facets.h @@ -525,7 +525,7 @@ namespace std        // For use at construction time only.        void  -      _M_initialize_numpunct(__c_locale __cloc = _S_c_locale); +      _M_initialize_numpunct(__c_locale __cloc = NULL);      };    template<typename _CharT> @@ -875,10 +875,7 @@ namespace std    protected:        virtual        ~collate()  -      { -	if (_M_c_locale_collate != _S_c_locale) -	  _S_destroy_c_locale(_M_c_locale_collate);  -      } +      { _S_destroy_c_locale(_M_c_locale_collate); }        virtual int          do_compare(const _CharT* __lo1, const _CharT* __hi1, @@ -924,8 +921,7 @@ namespace std        collate_byname(const char* __s, size_t __refs = 0)        : collate<_CharT>(__refs)         {  -	if (_M_c_locale_collate != _S_c_locale) -	  _S_destroy_c_locale(_M_c_locale_collate); +	_S_destroy_c_locale(_M_c_locale_collate);  	_S_create_c_locale(_M_c_locale_collate, __s);         } @@ -956,7 +952,7 @@ namespace std      protected:        __c_locale			_M_c_locale_timepunct; -      const char*			_M_name_timepunct; +      char*				_M_name_timepunct;        const _CharT* 			_M_date_format;        const _CharT* 			_M_date_era_format;        const _CharT* 			_M_time_format; @@ -1016,13 +1012,21 @@ namespace std      public:        explicit         __timepunct(size_t __refs = 0)  -      : locale::facet(__refs), _M_name_timepunct("C") -      { _M_initialize_timepunct(); } +      : locale::facet(__refs) +      {  +	_M_name_timepunct = new char[2]; +	strcpy(_M_name_timepunct, "C"); +	_M_initialize_timepunct();  +      }        explicit         __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0)  -      : locale::facet(__refs), _M_name_timepunct(__s) -      { _M_initialize_timepunct(__cloc); } +      : locale::facet(__refs) +      {  +	_M_name_timepunct = new char[strlen(__s) + 1]; +	strcpy(_M_name_timepunct, __s); +	_M_initialize_timepunct(__cloc);  +      }        void        _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format,  @@ -1119,20 +1123,21 @@ namespace std      protected:        virtual  -      ~__timepunct(); +      ~__timepunct() +      {  +	delete [] _M_name_timepunct; +	_S_destroy_c_locale(_M_c_locale_timepunct);  +      }        // For use at construction time only.        void  -      _M_initialize_timepunct(__c_locale __cloc = _S_c_locale); +      _M_initialize_timepunct(__c_locale __cloc = NULL);      };    template<typename _CharT>      locale::id __timepunct<_CharT>::id;    // Specializations. -  template<> -    __timepunct<char>::~__timepunct(); -    template<>       const char*      __timepunct<char>::_S_timezones[14]; @@ -1146,9 +1151,6 @@ namespace std      __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const;  #ifdef _GLIBCPP_USE_WCHAR_T -  template<> -    __timepunct<wchar_t>::~__timepunct(); -    template<>       const wchar_t*      __timepunct<wchar_t>::_S_timezones[14]; @@ -1459,7 +1461,7 @@ namespace std        // For use at construction time only.         void  -       _M_initialize_moneypunct(__c_locale __cloc = _S_c_locale,  +       _M_initialize_moneypunct(__c_locale __cloc = NULL,   				const char* __name = NULL);      }; @@ -1628,7 +1630,7 @@ namespace std        __c_locale			_M_c_locale_messages;  #if 1        // Only needed if glibc < 2.3 -      const char*			_M_name_messages; +      char*				_M_name_messages;  #endif      public: @@ -1636,15 +1638,20 @@ namespace std        explicit         messages(size_t __refs = 0)  -      : locale::facet(__refs), _M_name_messages("C") -      { _M_c_locale_messages = _S_c_locale; } +      : locale::facet(__refs) +      {  +	_M_name_messages = new char[2]; +	strcpy(_M_name_messages, "C"); +	_M_c_locale_messages = _S_c_locale;  +      }        // Non-standard.        explicit  -      messages(__c_locale __cloc, const char* __name, size_t __refs = 0)  +      messages(__c_locale __cloc, const char* __s, size_t __refs = 0)         : locale::facet(__refs)        {  -	_M_name_messages = __name; +	_M_name_messages = new char[strlen(__s) + 1]; +	strcpy(_M_name_messages, __s);  	_M_c_locale_messages = _S_clone_c_locale(__cloc);         } @@ -1668,8 +1675,8 @@ namespace std        virtual         ~messages()         {  -	 if (_M_c_locale_messages != _S_c_locale) -	   _S_destroy_c_locale(_M_c_locale_messages);  +	 delete [] _M_name_messages; +	 _S_destroy_c_locale(_M_c_locale_messages);          }        virtual catalog  @@ -1758,9 +1765,10 @@ namespace std        messages_byname(const char* __s, size_t __refs = 0)        : messages<_CharT>(__refs)         {  -	_M_name_messages = __s; -	if (_M_c_locale_messages != _S_c_locale) -	  _S_destroy_c_locale(_M_c_locale_messages); +	delete [] _M_name_messages; +	_M_name_messages = new char[strlen(__s) + 1]; +	strcpy(_M_name_messages, __s); +	_S_destroy_c_locale(_M_c_locale_messages);  	_S_create_c_locale(_M_c_locale_messages, __s);         } diff --git a/contrib/libstdc++/include/bits/locale_facets.tcc b/contrib/libstdc++/include/bits/locale_facets.tcc index f21054e29663..ce6f3d7d5ffa 100644 --- a/contrib/libstdc++/include/bits/locale_facets.tcc +++ b/contrib/libstdc++/include/bits/locale_facets.tcc @@ -2140,42 +2140,21 @@ namespace std    extern template class moneypunct_byname<char, true>;    extern template class money_get<char>;    extern template class money_put<char>; -  extern template class moneypunct<wchar_t, false>; -  extern template class moneypunct<wchar_t, true>; -  extern template class moneypunct_byname<wchar_t, false>; -  extern template class moneypunct_byname<wchar_t, true>; -  extern template class money_get<wchar_t>; -  extern template class money_put<wchar_t>;    extern template class numpunct<char>;    extern template class numpunct_byname<char>;    extern template class num_get<char>;    extern template class num_put<char>;  -  extern template class numpunct<wchar_t>; -  extern template class numpunct_byname<wchar_t>; -  extern template class num_get<wchar_t>; -  extern template class num_put<wchar_t>;    extern template class __timepunct<char>;    extern template class time_put<char>;    extern template class time_put_byname<char>;    extern template class time_get<char>;    extern template class time_get_byname<char>; -  extern template class __timepunct<wchar_t>; -  extern template class time_put<wchar_t>; -  extern template class time_put_byname<wchar_t>; -  extern template class time_get<wchar_t>; -  extern template class time_get_byname<wchar_t>;    extern template class messages<char>;    extern template class messages_byname<char>; -  extern template class messages<wchar_t>; -  extern template class messages_byname<wchar_t>;    extern template class ctype_byname<char>; -  extern template class ctype_byname<wchar_t>;    extern template class codecvt_byname<char, char, mbstate_t>; -  extern template class codecvt_byname<wchar_t, char, mbstate_t>;    extern template class collate<char>;    extern template class collate_byname<char>; -  extern template class collate<wchar_t>; -  extern template class collate_byname<wchar_t>;    extern template      const codecvt<char, char, mbstate_t>&  @@ -2229,59 +2208,6 @@ namespace std      const messages<char>&       use_facet<messages<char> >(const locale&); -  extern template -    const codecvt<wchar_t, char, mbstate_t>&  -    use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&); - -  extern template -    const collate<wchar_t>&  -    use_facet<collate<wchar_t> >(const locale&); - -  extern template -    const numpunct<wchar_t>&  -    use_facet<numpunct<wchar_t> >(const locale&); - -  extern template  -    const num_put<wchar_t>&  -    use_facet<num_put<wchar_t> >(const locale&); - -  extern template  -    const num_get<wchar_t>&  -    use_facet<num_get<wchar_t> >(const locale&); - -  extern template -    const moneypunct<wchar_t, true>&  -    use_facet<moneypunct<wchar_t, true> >(const locale&); - -  extern template -    const moneypunct<wchar_t, false>&  -    use_facet<moneypunct<wchar_t, false> >(const locale&); -  -  extern template  -    const money_put<wchar_t>&  -    use_facet<money_put<wchar_t> >(const locale&); - -  extern template  -    const money_get<wchar_t>&  -    use_facet<money_get<wchar_t> >(const locale&); - -  extern template -    const __timepunct<wchar_t>&  -    use_facet<__timepunct<wchar_t> >(const locale&); - -  extern template  -    const time_put<wchar_t>&  -    use_facet<time_put<wchar_t> >(const locale&); - -  extern template  -    const time_get<wchar_t>&  -    use_facet<time_get<wchar_t> >(const locale&); - -  extern template  -    const messages<wchar_t>&  -    use_facet<messages<wchar_t> >(const locale&); - -    extern template       bool      has_facet<ctype<char> >(const locale&); @@ -2334,6 +2260,81 @@ namespace std      bool      has_facet<messages<char> >(const locale&); +#ifdef _GLIBCPP_USE_WCHAR_T +  extern template class moneypunct<wchar_t, false>; +  extern template class moneypunct<wchar_t, true>; +  extern template class moneypunct_byname<wchar_t, false>; +  extern template class moneypunct_byname<wchar_t, true>; +  extern template class money_get<wchar_t>; +  extern template class money_put<wchar_t>; +  extern template class numpunct<wchar_t>; +  extern template class numpunct_byname<wchar_t>; +  extern template class num_get<wchar_t>; +  extern template class num_put<wchar_t>; +  extern template class __timepunct<wchar_t>; +  extern template class time_put<wchar_t>; +  extern template class time_put_byname<wchar_t>; +  extern template class time_get<wchar_t>; +  extern template class time_get_byname<wchar_t>; +  extern template class messages<wchar_t>; +  extern template class messages_byname<wchar_t>; +  extern template class ctype_byname<wchar_t>; +  extern template class codecvt_byname<wchar_t, char, mbstate_t>; +  extern template class collate<wchar_t>; +  extern template class collate_byname<wchar_t>; + +  extern template +    const codecvt<wchar_t, char, mbstate_t>&  +    use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&); + +  extern template +    const collate<wchar_t>&  +    use_facet<collate<wchar_t> >(const locale&); + +  extern template +    const numpunct<wchar_t>&  +    use_facet<numpunct<wchar_t> >(const locale&); + +  extern template  +    const num_put<wchar_t>&  +    use_facet<num_put<wchar_t> >(const locale&); + +  extern template  +    const num_get<wchar_t>&  +    use_facet<num_get<wchar_t> >(const locale&); + +  extern template +    const moneypunct<wchar_t, true>&  +    use_facet<moneypunct<wchar_t, true> >(const locale&); + +  extern template +    const moneypunct<wchar_t, false>&  +    use_facet<moneypunct<wchar_t, false> >(const locale&); +  +  extern template  +    const money_put<wchar_t>&  +    use_facet<money_put<wchar_t> >(const locale&); + +  extern template  +    const money_get<wchar_t>&  +    use_facet<money_get<wchar_t> >(const locale&); + +  extern template +    const __timepunct<wchar_t>&  +    use_facet<__timepunct<wchar_t> >(const locale&); + +  extern template  +    const time_put<wchar_t>&  +    use_facet<time_put<wchar_t> >(const locale&); + +  extern template  +    const time_get<wchar_t>&  +    use_facet<time_get<wchar_t> >(const locale&); + +  extern template  +    const messages<wchar_t>&  +    use_facet<messages<wchar_t> >(const locale&); +   extern template       bool      has_facet<ctype<wchar_t> >(const locale&); @@ -2385,6 +2386,7 @@ namespace std    extern template       bool      has_facet<messages<wchar_t> >(const locale&); +#endif  } // namespace std  #endif diff --git a/contrib/libstdc++/include/bits/localefwd.h b/contrib/libstdc++/include/bits/localefwd.h index 028c4126b85e..d8d742b4c592 100644 --- a/contrib/libstdc++/include/bits/localefwd.h +++ b/contrib/libstdc++/include/bits/localefwd.h @@ -207,8 +207,8 @@ namespace std      static const category time 		= 1L << 3;      static const category monetary 	= 1L << 4;      static const category messages 	= 1L << 5; -    static const category all 		= (collate | ctype | monetary | -				 	   numeric | time  | messages); +    static const category all 		= (ctype | numeric | collate | +				 	   time  | monetary | messages);      // Construct/copy/destroy:      locale() throw(); @@ -267,7 +267,26 @@ namespace std      // Current global reference locale      static _Impl* 	_S_global;   -    static const size_t	_S_num_categories = 6; +    // Number of standard categories. For C++, these categories are +    // collate, ctype, monetary, numeric, time, and messages. These +    // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE, +    // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE +    // 1003.1-2001) specifies LC_MESSAGES. +    static const size_t	_S_categories_size = 6; + +    // In addition to the standard categories, the underlying +    // operating system is allowed to define extra LC_* +    // macros. For GNU systems, the following are also valid: +    // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, +    // and LC_IDENTIFICATION. +    static const size_t	_S_extra_categories_size = _GLIBCPP_NUM_CATEGORIES; + +    // Names of underlying locale categories.   +    // NB: locale::global() has to know how to modify all the +    // underlying categories, not just the ones required by the C++ +    // standard. +    static const char* 	_S_categories[_S_categories_size  +				      + _S_extra_categories_size];      explicit       locale(_Impl*) throw(); @@ -308,7 +327,9 @@ namespace std      _Atomic_word			_M_references;      facet** 				_M_facets;      size_t 				_M_facets_size; -    const char* 			_M_names[_S_num_categories]; + +    char* 				_M_names[_S_categories_size +						 + _S_extra_categories_size];      static const locale::id* const 	_S_id_ctype[];      static const locale::id* const 	_S_id_numeric[];      static const locale::id* const 	_S_id_collate[]; @@ -348,8 +369,10 @@ namespace std      _M_check_same_name()      {        bool __ret = true; -      for (size_t i = 0; __ret && i < _S_num_categories - 1; ++i) -	__ret &= (strcmp(_M_names[i], _M_names[i + 1]) == 0); +      for (size_t __i = 0;  +	   __ret && __i < _S_categories_size + _S_extra_categories_size - 1;  +	   ++__i) +	__ret &= (strcmp(_M_names[__i], _M_names[__i + 1]) == 0);        return __ret;      } @@ -376,8 +399,14 @@ namespace std      {        _M_impl = new _Impl(*__other._M_impl, 1);        _M_impl->_M_install_facet(&_Facet::id, __f); -      for (size_t __i = 0; __i < _S_num_categories; ++__i) -	_M_impl->_M_names[__i] = "*"; +      for (size_t __i = 0;  +	   __i < _S_categories_size + _S_extra_categories_size; ++__i) +	{ +	  delete [] _M_impl->_M_names[__i]; +	  char* __new = new char[2]; +	  strcpy(__new, "*"); +	  _M_impl->_M_names[__i] = __new; +	}      }    // 22.1.1.1.2  Class locale::facet diff --git a/contrib/libstdc++/include/bits/sstream.tcc b/contrib/libstdc++/include/bits/sstream.tcc index 99eb6af125f5..606705c02e91 100644 --- a/contrib/libstdc++/include/bits/sstream.tcc +++ b/contrib/libstdc++/include/bits/sstream.tcc @@ -226,13 +226,16 @@ namespace std    // which are defined via explicit instantiations elsewhere.      // NB:  This syntax is a GNU extension.    extern template class basic_stringbuf<char>; -  extern template class basic_stringbuf<wchar_t>;    extern template class basic_istringstream<char>; -  extern template class basic_istringstream<wchar_t>;    extern template class basic_ostringstream<char>; -  extern template class basic_ostringstream<wchar_t>;    extern template class basic_stringstream<char>; + +#ifdef _GLIBCPP_USE_WCHAR_T +  extern template class basic_stringbuf<wchar_t>; +  extern template class basic_istringstream<wchar_t>; +  extern template class basic_ostringstream<wchar_t>;    extern template class basic_stringstream<wchar_t>; +#endif  } // namespace std  #endif diff --git a/contrib/libstdc++/include/bits/streambuf.tcc b/contrib/libstdc++/include/bits/streambuf.tcc index 2f790e902cb7..c8084ee68ada 100644 --- a/contrib/libstdc++/include/bits/streambuf.tcc +++ b/contrib/libstdc++/include/bits/streambuf.tcc @@ -208,19 +208,28 @@ namespace std        try   	{  	  while (__testput && __bufsize != -1) -	    { -	      __xtrct = __sbout->sputn(__sbin->gptr(), __bufsize); -	      __ret += __xtrct; -	      __sbin->_M_in_cur_move(__xtrct); -	      if (__xtrct == __bufsize) +  	    { + 	      if (__bufsize != 0 && __sbin->gptr() != NULL)   		{ -		  if (_Traits::eq_int_type(__sbin->sgetc(), _Traits::eof())) +		  __xtrct = __sbout->sputn(__sbin->gptr(), __bufsize); +		  __ret += __xtrct; +		  __sbin->_M_in_cur_move(__xtrct); +		  if (__xtrct != __bufsize)  		    break; -		  __bufsize = __sbin->in_avail();  		} -	      else -		break; -	    } + 	      else  +		{ +		  _CharT __buf[256]; +		  streamsize __charsread = __sbin->sgetn(__buf, sizeof(__buf)); +		  __xtrct = __sbout->sputn(__buf, __charsread); +		  __ret += __xtrct; +		  if (__xtrct != __charsread) +		    break; +		} + 	      if (_Traits::eq_int_type(__sbin->sgetc(), _Traits::eof())) +  		break; + 	      __bufsize = __sbin->in_avail(); +  	    }  	}        catch(exception& __fail)   	{ @@ -240,11 +249,13 @@ namespace std      __copy_streambufs(basic_ios<char>&, basic_streambuf<char>*,  		      basic_streambuf<char>*);  +#ifdef _GLIBCPP_USE_WCHAR_T    extern template class basic_streambuf<wchar_t>;    extern template      streamsize      __copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*,  		      basic_streambuf<wchar_t>*);  +#endif  } // namespace std  #endif  diff --git a/contrib/libstdc++/include/bits/stringfwd.h b/contrib/libstdc++/include/bits/stringfwd.h index b7418a67a7ea..db40befdab6a 100644 --- a/contrib/libstdc++/include/bits/stringfwd.h +++ b/contrib/libstdc++/include/bits/stringfwd.h @@ -45,23 +45,25 @@  namespace std  { -  template<class _CharT> -    struct char_traits; -   -  template<> struct char_traits<char>; -#ifdef _GLIBCPP_USE_WCHAR_T -  template<> struct char_traits<wchar_t>; -#endif -    template<typename _Alloc>       class allocator; +  template<class _CharT> +    struct char_traits; +    template<typename _CharT, typename _Traits = char_traits<_CharT>,              typename _Alloc = allocator<_CharT> >      class basic_string; +   +  template<> struct char_traits<char>;    typedef basic_string<char>    string; + +#ifdef _GLIBCPP_USE_WCHAR_T +  template<> struct char_traits<wchar_t>; +    typedef basic_string<wchar_t> wstring; +#endif  } // namespace std  #endif	// _CPP_BITS_STRINGFWD_H | 
