summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/include
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-12-04 16:53:59 +0000
committerobrien <obrien@FreeBSD.org>2002-12-04 16:53:59 +0000
commitee820e9f244fb13f3dd7773478f525ddcbeac501 (patch)
tree23d47b19d8ecbb91f1615f358dbb41e09e05fc12 /contrib/libstdc++/include
parent7a1080fa5c329ea8a9505e51ce151719955bcfa2 (diff)
downloadFreeBSD-src-ee820e9f244fb13f3dd7773478f525ddcbeac501.zip
FreeBSD-src-ee820e9f244fb13f3dd7773478f525ddcbeac501.tar.gz
Gcc 3.2.1 release virgin vendor import. (19-Nov-2002)
Diffstat (limited to 'contrib/libstdc++/include')
-rw-r--r--contrib/libstdc++/include/bits/basic_ios.tcc3
-rw-r--r--contrib/libstdc++/include/bits/basic_string.tcc19
-rw-r--r--contrib/libstdc++/include/bits/c++config5
-rw-r--r--contrib/libstdc++/include/bits/fstream.tcc9
-rw-r--r--contrib/libstdc++/include/bits/ios_base.h3
-rw-r--r--contrib/libstdc++/include/bits/istream.tcc80
-rw-r--r--contrib/libstdc++/include/bits/locale_facets.h70
-rw-r--r--contrib/libstdc++/include/bits/locale_facets.tcc150
-rw-r--r--contrib/libstdc++/include/bits/localefwd.h45
-rw-r--r--contrib/libstdc++/include/bits/sstream.tcc9
-rw-r--r--contrib/libstdc++/include/bits/streambuf.tcc31
-rw-r--r--contrib/libstdc++/include/bits/stringfwd.h18
-rw-r--r--contrib/libstdc++/include/std/std_iomanip.h16
-rw-r--r--contrib/libstdc++/include/std/std_iosfwd.h2
-rw-r--r--contrib/libstdc++/include/std/std_iostream.h1
-rw-r--r--contrib/libstdc++/include/std/std_limits.h4
-rw-r--r--contrib/libstdc++/include/std/std_sstream.h3
17 files changed, 255 insertions, 213 deletions
diff --git a/contrib/libstdc++/include/bits/basic_ios.tcc b/contrib/libstdc++/include/bits/basic_ios.tcc
index a38a95b..7ee8015 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 6d646ad..4a22d89 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 41c3ba8..4315bae 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 18dbaf1..66cb9a1 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 f5b0269..a56475c 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 58e2caf..a6e49a9 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 f99562f..660bad3 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 f21054e..ce6f3d7 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 028c412..d8d742b 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 99eb6af..606705c 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 2f790e9..c8084ee 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 b7418a6..db40bef 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
diff --git a/contrib/libstdc++/include/std/std_iomanip.h b/contrib/libstdc++/include/std/std_iomanip.h
index e046c82..23237ce 100644
--- a/contrib/libstdc++/include/std/std_iomanip.h
+++ b/contrib/libstdc++/include/std/std_iomanip.h
@@ -225,25 +225,27 @@ namespace std
extern template ostream& operator<<(ostream&, _Setbase);
extern template ostream& operator<<(ostream&, _Setprecision);
extern template ostream& operator<<(ostream&, _Setw);
- extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
- extern template wostream& operator<<(wostream&, _Setiosflags);
- extern template wostream& operator<<(wostream&, _Resetiosflags);
- extern template wostream& operator<<(wostream&, _Setbase);
- extern template wostream& operator<<(wostream&, _Setprecision);
- extern template wostream& operator<<(wostream&, _Setw);
-
extern template istream& operator>>(istream&, _Setfill<char>);
extern template istream& operator>>(istream&, _Setiosflags);
extern template istream& operator>>(istream&, _Resetiosflags);
extern template istream& operator>>(istream&, _Setbase);
extern template istream& operator>>(istream&, _Setprecision);
extern template istream& operator>>(istream&, _Setw);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
+ extern template wostream& operator<<(wostream&, _Setiosflags);
+ extern template wostream& operator<<(wostream&, _Resetiosflags);
+ extern template wostream& operator<<(wostream&, _Setbase);
+ extern template wostream& operator<<(wostream&, _Setprecision);
+ extern template wostream& operator<<(wostream&, _Setw);
extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
extern template wistream& operator>>(wistream&, _Setiosflags);
extern template wistream& operator>>(wistream&, _Resetiosflags);
extern template wistream& operator>>(wistream&, _Setbase);
extern template wistream& operator>>(wistream&, _Setprecision);
extern template wistream& operator>>(wistream&, _Setw);
+#endif
} // namespace std
#endif
diff --git a/contrib/libstdc++/include/std/std_iosfwd.h b/contrib/libstdc++/include/std/std_iosfwd.h
index f76ca7c..797f493 100644
--- a/contrib/libstdc++/include/std/std_iosfwd.h
+++ b/contrib/libstdc++/include/std/std_iosfwd.h
@@ -116,6 +116,7 @@ namespace std
typedef basic_ofstream<char> ofstream;
typedef basic_fstream<char> fstream;
+#ifdef _GLIBCPP_USE_WCHAR_T
typedef basic_ios<wchar_t> wios;
typedef basic_streambuf<wchar_t> wstreambuf;
typedef basic_istream<wchar_t> wistream;
@@ -129,6 +130,7 @@ namespace std
typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
+#endif
} // namespace std
#endif
diff --git a/contrib/libstdc++/include/std/std_iostream.h b/contrib/libstdc++/include/std/std_iostream.h
index 5b3da9c..d0736b8 100644
--- a/contrib/libstdc++/include/std/std_iostream.h
+++ b/contrib/libstdc++/include/std/std_iostream.h
@@ -51,6 +51,7 @@ namespace std
extern ostream cout;
extern ostream cerr;
extern ostream clog;
+
#ifdef _GLIBCPP_USE_WCHAR_T
extern wistream wcin;
extern wostream wcout;
diff --git a/contrib/libstdc++/include/std/std_limits.h b/contrib/libstdc++/include/std/std_limits.h
index 64d8a9b..5f70dda 100644
--- a/contrib/libstdc++/include/std/std_limits.h
+++ b/contrib/libstdc++/include/std/std_limits.h
@@ -292,12 +292,12 @@
#define __glibcpp_char_min (char)__glibcpp_signed_char_min
#define __glibcpp_char_max (char)__glibcpp_signed_char_max
#define __glibcpp_char_digits __glibcpp_signed_char_digits
-#define __glibcpp_char_digits10 __glibcpp_signed_char_digits
+#define __glibcpp_char_digits10 __glibcpp_signed_char_digits10
#else
#define __glibcpp_char_min (char)__glibcpp_unsigned_char_min
#define __glibcpp_char_max (char)__glibcpp_unsigned_char_max
#define __glibcpp_char_digits __glibcpp_unsigned_char_digits
-#define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits
+#define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits10
#endif
// short
diff --git a/contrib/libstdc++/include/std/std_sstream.h b/contrib/libstdc++/include/std/std_sstream.h
index 07e47b5..6ee7505 100644
--- a/contrib/libstdc++/include/std/std_sstream.h
+++ b/contrib/libstdc++/include/std/std_sstream.h
@@ -105,7 +105,8 @@ namespace std
void
str(const __string_type& __s)
{
- _M_string = __s;
+ // Cannot use _M_string = __s, since v3 strings are COW.
+ _M_string.assign(__s.data(), __s.size());
_M_stringbuf_init(_M_mode);
}
OpenPOWER on IntegriCloud