summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-31 12:14:56 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-31 12:14:56 +0000
commit8878d5e46d4edcc706701f66d12dff79a5f51c0d (patch)
treeceaaac0bdc60dd79d70b07301e7aa375cd843bb4 /libstdc++-v3/include/bits
parent9e8f09c322891cc1b2e3c187d3fcb24fe9e432e0 (diff)
downloadgcc-8878d5e46d4edcc706701f66d12dff79a5f51c0d.tar.gz
2001-05-30 Benjamin Kosnik <bkoz@redat.com>
* acconfig.h (_GLIBCPP_BUGGY_FLOAT_COMPLEX): Remove. (_GLIBCPP_BUGGY_COMPLEX): Remove. * config.h.in: Regenerate. * acinclude.m4 (GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT): Remove. * aclocal.m4: Regenerate. * configure.in: Don't call it. * configure: Regenerate. libstdc++/2970 * src/complex_io.cc (operator<<(ostream&, const complex&): Fix. * testsuite/26_numerics/complex_inserters_extractors.cc (test01): New test. libstdc++/2985 * include/bits/std_complex.h: Include sstream. Put definitions for complex inserters and extractors here, and remove them from... * src/complex_io.cc: ...here. * include/bits/basic_ios.h (basic_ios::__numput_type): Add _Traits parameter. (basic_ios::__numget_type): Same. * include/bits/std_istream.h: Same. * include/bits/std_ostream.h: Same. * include/bits/sbuf_iter.h (ostreambuf_iterator): Fix typo in base class iterator template arguments. * src/locale-inst.cc: Add explicit has_facet instantiations. * include/bits/basic_ios.h (basic_ios::_M_get_fctype_ios): Remove. (_M_get_fnumput): Remove. (_M_get_fnumget): Remove. (basic_ios::_M_check_facet): New function. (basic_ios::_M_cache_facets): New function. * include/bits/basic_ios.tcc: Definition for _M_cache_facets. (basic_ios::imbue): Call _M_cache_facets. (basic_ios::init): Same. * include/bits/istream.tcc: Format, use _M_check_facet. * include/bits/ostream.tcc: Same. * include/bits/locale_facets.tcc (__output_float): Change signature, add _Traits. * testsuite/26_numerics/complex_inserters_extractors.cc (test02): New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42743 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/basic_ios.h36
-rw-r--r--libstdc++-v3/include/bits/basic_ios.tcc22
-rw-r--r--libstdc++-v3/include/bits/istream.tcc1029
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc14
-rw-r--r--libstdc++-v3/include/bits/ostream.tcc76
-rw-r--r--libstdc++-v3/include/bits/sbuf_iter.h2
-rw-r--r--libstdc++-v3/include/bits/std_complex.h43
-rw-r--r--libstdc++-v3/include/bits/std_iosfwd.h5
-rw-r--r--libstdc++-v3/include/bits/std_istream.h9
-rw-r--r--libstdc++-v3/include/bits/std_ostream.h5
-rw-r--r--libstdc++-v3/include/bits/std_streambuf.h1
11 files changed, 685 insertions, 557 deletions
diff --git a/libstdc++-v3/include/bits/basic_ios.h b/libstdc++-v3/include/bits/basic_ios.h
index efaf2c7e0ac..7eb6d7a2244 100644
--- a/libstdc++-v3/include/bits/basic_ios.h
+++ b/libstdc++-v3/include/bits/basic_ios.h
@@ -35,14 +35,13 @@
#include <bits/sbuf_iter.h>
#include <bits/locale_facets.h>
-namespace std {
-
+namespace std
+{
// 27.4.5 Template class basic_ios
template<typename _CharT, typename _Traits>
class basic_ios : public ios_base
{
public:
-
// Types:
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
@@ -51,11 +50,10 @@ namespace std {
typedef _Traits traits_type;
// Non-standard Types:
- typedef ctype<_CharT> __ctype_type;
- // From ostream
- typedef ostreambuf_iterator<_CharT> __ostreambuf_iter;
+ typedef ctype<_CharT> __ctype_type;
+ typedef ostreambuf_iterator<_CharT, _Traits> __ostreambuf_iter;
typedef num_put<_CharT, __ostreambuf_iter> __numput_type;
- typedef istreambuf_iterator<_CharT> __istreambuf_iter;
+ typedef istreambuf_iterator<_CharT, _Traits> __istreambuf_iter;
typedef num_get<_CharT, __istreambuf_iter> __numget_type;
// Data members:
@@ -76,19 +74,10 @@ namespace std {
const __numget_type* _M_fnumget;
public:
-
inline const __ctype_type*
_M_get_fctype_ios(void)
{ return _M_ios_fctype; }
- inline const __numget_type*
- _M_get_fnumget(void)
- { return _M_fnumget; }
-
- inline const __numput_type*
- _M_get_fnumput(void)
- { return _M_fnumput; }
-
operator void*() const
{ return this->fail() ? 0 : const_cast<basic_ios*>(this); }
@@ -202,8 +191,21 @@ namespace std {
void
init(basic_streambuf<_CharT, _Traits>* __sb);
+
+ bool
+ _M_check_facet(const locale::facet* __f)
+ {
+ bool __ret = false;
+ if (__f)
+ __ret = true;
+ else
+ __throw_bad_cast();
+ return __ret;
+ }
+
+ void
+ _M_cache_facets(const locale& __loc);
};
-
} // namespace std
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
diff --git a/libstdc++-v3/include/bits/basic_ios.tcc b/libstdc++-v3/include/bits/basic_ios.tcc
index f1b634744c8..6a3db778c20 100644
--- a/libstdc++-v3/include/bits/basic_ios.tcc
+++ b/libstdc++-v3/include/bits/basic_ios.tcc
@@ -105,9 +105,7 @@ namespace std {
{
locale __old(this->getloc());
ios_base::imbue(__loc);
- _M_ios_fctype = &use_facet<__ctype_type>(__loc);
- _M_fnumput = &use_facet<__numput_type>(__loc);
- _M_fnumget = &use_facet<__numget_type>(__loc);
+ _M_cache_facets(__loc);
if (this->rdbuf() != 0)
this->rdbuf()->pubimbue(__loc);
return __old;
@@ -119,10 +117,7 @@ namespace std {
{
// NB: This may be called more than once on the same object.
ios_base::_M_init();
- _M_ios_fctype = &use_facet<__ctype_type>(_M_ios_locale);
- // Should be filled in by ostream and istream, respectively.
- _M_fnumput = &use_facet<__numput_type>(_M_ios_locale);
- _M_fnumget = &use_facet<__numget_type>(_M_ios_locale);
+ _M_cache_facets(_M_ios_locale);
_M_tie = 0;
_M_fill = this->widen(' ');
_M_exception = goodbit;
@@ -130,8 +125,21 @@ namespace std {
_M_streambuf_state = __sb ? goodbit : badbit;
}
+ template<typename _CharT, typename _Traits>
+ void
+ basic_ios<_CharT, _Traits>::_M_cache_facets(const locale& __loc)
+ {
+ if (has_facet<__ctype_type>(__loc))
+ _M_ios_fctype = &use_facet<__ctype_type>(__loc);
+ // Should be filled in by ostream and istream, respectively.
+ if (has_facet<__numput_type>(__loc))
+ _M_fnumput = &use_facet<__numput_type>(__loc);
+ if (has_facet<__numget_type>(__loc))
+ _M_fnumget = &use_facet<__numget_type>(__loc);
+ }
} // namespace std
#endif // _CPP_BITS_BASICIOS_TCC
+
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index 4f3ff9688d0..45f8ed2267c 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -31,8 +31,8 @@
#include <bits/std_locale.h>
-namespace std {
-
+namespace std
+{
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>::sentry::
sentry(basic_istream<_CharT, _Traits>& __in, bool __noskipws)
@@ -103,18 +103,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -127,18 +130,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -151,18 +157,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -175,18 +184,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -199,18 +211,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -223,18 +238,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -247,18 +265,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -272,18 +293,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // Turn this on without causing an ios::failure to be thrown.
- this->setstate(ios_base::badbit);
- if ((this->exceptions() & ios_base::badbit) != 0)
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -296,18 +320,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -321,18 +348,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -345,18 +375,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -369,18 +402,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -393,18 +429,21 @@ namespace std {
sentry __cerb(*this, false);
if (__cerb)
{
- try {
- ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
- _M_fnumget->get(*this, 0, *this, __err, __n);
- this->setstate(__err);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // 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;
- }
+ try
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (_M_check_facet(_M_fnumget))
+ _M_fnumget->get(*this, 0, *this, __err, __n);
+ this->setstate(__err);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // 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;
}
@@ -435,21 +474,23 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
- __c = this->rdbuf()->sbumpc();
- // 27.6.1.1 paragraph 3
- if (__c != __eof)
- _M_gcount = 1;
- else
- this->setstate(ios_base::eofbit | ios_base::failbit);
- }
- 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;
- }
+ try
+ {
+ __c = this->rdbuf()->sbumpc();
+ // 27.6.1.1 paragraph 3
+ if (__c != __eof)
+ _M_gcount = 1;
+ else
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ }
+ 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 __c;
}
@@ -463,25 +504,27 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
- const int_type __eof = traits_type::eof();
- int_type __bufval = this->rdbuf()->sbumpc();
- // 27.6.1.1 paragraph 3
- if (__bufval != __eof)
- {
- _M_gcount = 1;
- __c = traits_type::to_char_type(__bufval);
- }
- else
- this->setstate(ios_base::eofbit | ios_base::failbit);
- }
- 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;
- }
+ try
+ {
+ const int_type __eof = traits_type::eof();
+ int_type __bufval = this->rdbuf()->sbumpc();
+ // 27.6.1.1 paragraph 3
+ if (__bufval != __eof)
+ {
+ _M_gcount = 1;
+ __c = traits_type::to_char_type(__bufval);
+ }
+ else
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ }
+ 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;
}
@@ -495,34 +538,36 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb && __n > 1)
{
- try {
- const int_type __idelim = traits_type::to_int_type(__delim);
- const int_type __eof = traits_type::eof();
- __streambuf_type* __sb = this->rdbuf();
- int_type __c = __sb->sbumpc();
- bool __testdelim = __c == __idelim;
- bool __testeof = __c == __eof;
-
- while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
- {
- *__s++ = traits_type::to_char_type(__c);
- ++_M_gcount;
- __c = __sb->sbumpc();
- __testeof = __c == __eof;
- __testdelim = __c == __idelim;
- }
- if (__testdelim || _M_gcount == __n - 1)
- __sb->sputbackc(__c);
- if (__testeof)
- this->setstate(ios_base::eofbit);
- }
- 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;
- }
+ try
+ {
+ const int_type __idelim = traits_type::to_int_type(__delim);
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+
+ while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if (__testdelim || _M_gcount == __n - 1)
+ __sb->sputbackc(__c);
+ if (__testeof)
+ this->setstate(ios_base::eofbit);
+ }
+ 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;
+ }
}
*__s = char_type(NULL);
if (!_M_gcount)
@@ -541,32 +586,34 @@ namespace std {
{
int_type __c;
__streambuf_type* __this_sb = this->rdbuf();
- try {
- const int_type __idelim = traits_type::to_int_type(__delim);
- const int_type __eof = traits_type::eof();
- __c = __this_sb->sbumpc();
- bool __testdelim = __c == __idelim;
- bool __testeof = __c == __eof;
- bool __testput = true;
-
- while (!__testeof && !__testdelim
- && (__testput = __sb.sputc(traits_type::to_char_type(__c))
- != __eof))
- {
- ++_M_gcount;
- __c = __this_sb->sbumpc();
- __testeof = __c == __eof;
- __testdelim = __c == __idelim;
- }
- if (__testdelim || !__testput)
+ try
+ {
+ const int_type __idelim = traits_type::to_int_type(__delim);
+ const int_type __eof = traits_type::eof();
+ __c = __this_sb->sbumpc();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+ bool __testput = true;
+
+ while (!__testeof && !__testdelim
+ && (__testput = __sb.sputc(traits_type::to_char_type(__c))
+ != __eof))
+ {
+ ++_M_gcount;
+ __c = __this_sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if (__testdelim || !__testput)
+ __this_sb->sputbackc(traits_type::to_char_type(__c));
+ if (__testeof)
+ this->setstate(ios_base::eofbit);
+ }
+ catch(exception& __fail)
+ {
+ // Exception may result from sputc->overflow.
__this_sb->sputbackc(traits_type::to_char_type(__c));
- if (__testeof)
- this->setstate(ios_base::eofbit);
- }
- catch(exception& __fail){
- // Exception may result from sputc->overflow.
- __this_sb->sputbackc(traits_type::to_char_type(__c));
- }
+ }
}
if (!_M_gcount)
this->setstate(ios_base::failbit);
@@ -582,43 +629,45 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
- __streambuf_type* __sb = this->rdbuf();
- int_type __c = __sb->sbumpc();
- ++_M_gcount;
- const int_type __idelim = traits_type::to_int_type(__delim);
- const int_type __eof = traits_type::eof();
- bool __testdelim = __c == __idelim;
- bool __testeof = __c == __eof;
-
- while (_M_gcount < __n && !__testeof && !__testdelim)
- {
- *__s++ = traits_type::to_char_type(__c);
- __c = __sb->sbumpc();
- ++_M_gcount;
- __testeof = __c == __eof;
- __testdelim = __c == __idelim;
- }
+ try
+ {
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ ++_M_gcount;
+ const int_type __idelim = traits_type::to_int_type(__delim);
+ const int_type __eof = traits_type::eof();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
- if (__testeof)
- {
- --_M_gcount;
- this->setstate(ios_base::eofbit);
- }
- else if (!__testdelim)
- {
- --_M_gcount;
- __sb->sputbackc(traits_type::to_char_type(__c));
- this->setstate(ios_base::failbit);
- }
- }
- 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;
- }
+ while (_M_gcount < __n && !__testeof && !__testdelim)
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ __c = __sb->sbumpc();
+ ++_M_gcount;
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+
+ if (__testeof)
+ {
+ --_M_gcount;
+ this->setstate(ios_base::eofbit);
+ }
+ else if (!__testdelim)
+ {
+ --_M_gcount;
+ __sb->sputbackc(traits_type::to_char_type(__c));
+ this->setstate(ios_base::failbit);
+ }
+ }
+ 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;
+ }
}
*__s = char_type(NULL);
if (!_M_gcount)
@@ -635,34 +684,36 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb && __n > 0)
{
- try {
- const int_type __idelim = traits_type::to_int_type(__delim);
- const int_type __eof = traits_type::eof();
- __streambuf_type* __sb = this->rdbuf();
- int_type __c = __sb->sbumpc();
- bool __testdelim = __c == __idelim;
- bool __testeof = __c == __eof;
-
- __n = min(__n, numeric_limits<streamsize>::max());
- while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
- {
+ try
+ {
+ const int_type __idelim = traits_type::to_int_type(__delim);
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ bool __testdelim = __c == __idelim;
+ bool __testeof = __c == __eof;
+
+ __n = min(__n, numeric_limits<streamsize>::max());
+ while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
+ {
+ ++_M_gcount;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testdelim = __c == __idelim;
+ }
+ if ((_M_gcount == __n - 1 && !__testeof) || __testdelim)
++_M_gcount;
- __c = __sb->sbumpc();
- __testeof = __c == __eof;
- __testdelim = __c == __idelim;
- }
- if ((_M_gcount == __n - 1 && !__testeof) || __testdelim)
- ++_M_gcount;
- if (__testeof)
- this->setstate(ios_base::eofbit);
- }
- 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 (__testeof)
+ this->setstate(ios_base::eofbit);
+ }
+ 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;
}
@@ -677,16 +728,16 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
- __c = this->rdbuf()->sgetc();
- }
- 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;
- }
+ try
+ { __c = this->rdbuf()->sgetc(); }
+ 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 __c;
}
@@ -702,35 +753,37 @@ namespace std {
{
if (__n > 0)
{
- try {
- const int_type __eof = traits_type::eof();
- __streambuf_type* __sb = this->rdbuf();
- int_type __c = __sb->sbumpc();
- bool __testeof = __c == __eof;
-
- while (_M_gcount < __n - 1 && !__testeof)
- {
- *__s++ = traits_type::to_char_type(__c);
- ++_M_gcount;
- __c = __sb->sbumpc();
- __testeof = __c == __eof;
- }
- if (__testeof)
- this->setstate(ios_base::eofbit | ios_base::failbit);
- else
- {
- // _M_gcount == __n - 1
- *__s++ = traits_type::to_char_type(__c);
- ++_M_gcount;
- }
- }
- 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;
- }
+ try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sbumpc();
+ bool __testeof = __c == __eof;
+
+ while (_M_gcount < __n - 1 && !__testeof)
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ }
+ if (__testeof)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ else
+ {
+ // _M_gcount == __n - 1
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ }
+ }
+ 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;
+ }
}
}
else
@@ -750,24 +803,25 @@ namespace std {
{
if (__n > 0)
{
- try {
- streamsize __num = this->rdbuf()->in_avail();
- if (__num != static_cast<streamsize>(__eof))
- {
- __num = min(__num, __n);
- _M_gcount = this->rdbuf()->sgetn(__s, __num);
- }
- else
- this->setstate(ios_base::eofbit);
- }
-
- 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;
- }
+ try
+ {
+ streamsize __num = this->rdbuf()->in_avail();
+ if (__num != static_cast<streamsize>(__eof))
+ {
+ __num = min(__num, __n);
+ _M_gcount = this->rdbuf()->sgetn(__s, __num);
+ }
+ else
+ this->setstate(ios_base::eofbit);
+ }
+ 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;
+ }
}
}
else
@@ -783,19 +837,21 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
- const int_type __eof = traits_type::eof();
- __streambuf_type* __sb = this->rdbuf();
- if (!__sb || __sb->sputbackc(__c) == __eof)
- this->setstate(ios_base::badbit);
- }
- 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;
- }
+ try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb || __sb->sputbackc(__c) == __eof)
+ this->setstate(ios_base::badbit);
+ }
+ 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;
+ }
}
else
this->setstate(ios_base::failbit);
@@ -811,19 +867,21 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
- const int_type __eof = traits_type::eof();
- __streambuf_type* __sb = this->rdbuf();
- if (!__sb || __eof == __sb->sungetc())
- this->setstate(ios_base::badbit);
- }
- 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;
- }
+ try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb || __eof == __sb->sungetc())
+ this->setstate(ios_base::badbit);
+ }
+ 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;
+ }
}
else
this->setstate(ios_base::failbit);
@@ -840,20 +898,22 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
- __streambuf_type* __sb = this->rdbuf();
- if (!__sb || __ret == __sb->pubsync())
- this->setstate(ios_base::badbit);
- else
- __ret = 0;
- }
- 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;
- }
+ try
+ {
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb || __ret == __sb->pubsync())
+ this->setstate(ios_base::badbit);
+ else
+ __ret = 0;
+ }
+ 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 __ret;
}
@@ -868,16 +928,18 @@ namespace std {
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;
- }
+ 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;
+ }
}
return __ret;
}
@@ -892,19 +954,21 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
+ try
+ {
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 136. seekp, seekg setting wrong streams?
- this->rdbuf()->pubseekpos(__pos, ios_base::in);
+ this->rdbuf()->pubseekpos(__pos, ios_base::in);
#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;
- }
+ }
+ 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;
}
@@ -918,19 +982,21 @@ namespace std {
sentry __cerb(*this, true);
if (__cerb)
{
- try {
+ try
+ {
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 136. seekp, seekg setting wrong streams?
- this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
+ this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
#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;
- }
+ }
+ 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;
}
@@ -944,16 +1010,16 @@ namespace std {
typename __istream_type::sentry __cerb(__in, false);
if (__cerb)
{
- try {
- __in.get(__c);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // Turn this on without causing an ios::failure to be thrown.
- __in.setstate(ios_base::badbit);
- if ((__in.exceptions() & ios_base::badbit) != 0)
- __throw_exception_again;
- }
+ try
+ { __in.get(__c); }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __in.setstate(ios_base::badbit);
+ if ((__in.exceptions() & ios_base::badbit) != 0)
+ __throw_exception_again;
+ }
}
else
__in.setstate(ios_base::failbit);
@@ -974,46 +1040,48 @@ namespace std {
typename __istream_type::sentry __cerb(__in, false);
if (__cerb)
{
- try {
- // Figure out how many characters to extract.
- streamsize __num = __in.width();
- if (__num == 0)
- __num = numeric_limits<streamsize>::max();
-
- __streambuf_type* __sb = __in.rdbuf();
- const __ctype_type* __ctype = __in._M_get_fctype_ios();
- int_type __c = __sb->sbumpc();
- const int_type __eof = _Traits::eof();
- bool __testsp = __ctype->is(ctype_base::space, __c);
- bool __testeof = __c == __eof;
-
- while (__extracted < __num - 1 && !__testeof && !__testsp)
- {
- *__s++ = __c;
- ++__extracted;
- __c = __sb->sbumpc();
- __testeof = __c == __eof;
- __testsp = __ctype->is(ctype_base::space, __c);
- }
-
- if (!__testeof)
- __sb->sputbackc(__c);
- else
- __in.setstate(ios_base::eofbit);
+ try
+ {
+ // Figure out how many characters to extract.
+ streamsize __num = __in.width();
+ if (__num == 0)
+ __num = numeric_limits<streamsize>::max();
+
+ __streambuf_type* __sb = __in.rdbuf();
+ const __ctype_type* __ctype = __in._M_get_fctype_ios();
+ int_type __c = __sb->sbumpc();
+ const int_type __eof = _Traits::eof();
+ bool __testsp = __ctype->is(ctype_base::space, __c);
+ bool __testeof = __c == __eof;
+
+ while (__extracted < __num - 1 && !__testeof && !__testsp)
+ {
+ *__s++ = __c;
+ ++__extracted;
+ __c = __sb->sbumpc();
+ __testeof = __c == __eof;
+ __testsp = __ctype->is(ctype_base::space, __c);
+ }
+
+ if (!__testeof)
+ __sb->sputbackc(__c);
+ else
+ __in.setstate(ios_base::eofbit);
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
//68. Extractors for char* should store null at end
- *__s = char_type();
+ *__s = char_type();
#endif
- __in.width(0);
- }
- catch(exception& __fail){
- // 27.6.1.2.1 Common requirements.
- // Turn this on without causing an ios::failure to be thrown.
- __in.setstate(ios_base::badbit);
- if ((__in.exceptions() & ios_base::badbit) != 0)
- __throw_exception_again;
- }
+ __in.width(0);
+ }
+ catch(exception& __fail)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ __in.setstate(ios_base::badbit);
+ if ((__in.exceptions() & ios_base::badbit) != 0)
+ __throw_exception_again;
+ }
}
if (!__extracted)
__in.setstate(ios_base::failbit);
@@ -1153,7 +1221,6 @@ namespace std {
getline(basic_istream<_CharT, _Traits>& __in,
basic_string<_CharT,_Traits,_Alloc>& __str)
{ return getline(__in, __str, __in.widen('\n')); }
-
} // namespace std
// Local Variables:
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 482ed9fe5fa..1b7ff88895e 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -964,7 +964,7 @@ namespace std
#endif
// Generic helper function
- template<typename _CharT, typename _OutIter>
+ template<typename _CharT, typename _Traits, typename _OutIter>
_OutIter
__output_float(_OutIter __s, ios_base& __io, _CharT __fill,
const char* __sptr, size_t __slen)
@@ -974,10 +974,10 @@ namespace std
}
// Partial specialization for ostreambuf_iterator.
- template<typename _CharT>
- ostreambuf_iterator<_CharT>
- __output_float(ostreambuf_iterator<_CharT> __s, ios_base& __io,
- _CharT __fill, const char* __sptr, size_t __slen)
+ template<typename _CharT, typename _Traits>
+ ostreambuf_iterator<_CharT, _Traits>
+ __output_float(ostreambuf_iterator<_CharT, _Traits> __s, ios_base& __io,
+ _CharT __fill, const char* __sptr, size_t __slen)
{
size_t __padding = __io.width() > streamsize(__slen) ?
__io.width() -__slen : 0;
@@ -1037,7 +1037,7 @@ namespace std
if (__prec > __max_prec)
__prec = __max_prec;
// The *2 provides for signs, exp, 'E', and pad.
- char __sbuf[__max_prec*2];
+ char __sbuf[__max_prec * 2];
size_t __slen;
// Long enough for the max format spec.
char __fbuf[16];
@@ -1061,7 +1061,7 @@ namespace std
if (__prec > __max_prec)
__prec = __max_prec;
// The *2 provides for signs, exp, 'E', and pad.
- char __sbuf[__max_prec*2];
+ char __sbuf[__max_prec * 2];
size_t __slen;
// Long enough for the max format spec.
char __fbuf[16];
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc
index 1c4c521d060..60294c308fc 100644
--- a/libstdc++-v3/include/bits/ostream.tcc
+++ b/libstdc++-v3/include/bits/ostream.tcc
@@ -118,8 +118,9 @@ namespace std
{
try
{
- if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
}
catch(exception& __fail)
{
@@ -142,16 +143,21 @@ namespace std
{
try
{
- bool __f;
+ char_type __c = this->fill();
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
- if (__fmt & ios_base::oct || __fmt & ios_base::hex)
- __f = _M_fnumput->put(*this, *this, this->fill(),
- static_cast<unsigned long>(__n)).failed();
- else
- __f = _M_fnumput->put(*this, *this, this->fill(), __n).failed();
-
- if (__f)
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ {
+ bool __b = false;
+ if (__fmt & ios_base::oct || __fmt & ios_base::hex)
+ {
+ unsigned long __l = static_cast<unsigned long>(__n);
+ __b = _M_fnumput->put(*this, *this, __c, __l).failed();
+ }
+ else
+ __b = _M_fnumput->put(*this, *this, __c, __n).failed();
+ if (__b)
+ this->setstate(ios_base::badbit);
+ }
}
catch(exception& __fail)
{
@@ -174,8 +180,9 @@ namespace std
{
try
{
- if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
}
catch(exception& __fail)
{
@@ -199,15 +206,22 @@ namespace std
{
try
{
- bool __f;
+ char_type __c = this->fill();
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
- if (__fmt & ios_base::oct || __fmt & ios_base::hex)
- __f = _M_fnumput->put(*this, *this, this->fill(),
- static_cast<unsigned long long>(__n)).failed();
- else
- __f = _M_fnumput->put(*this, *this, this->fill(), __n).failed();
- if (__f)
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ {
+ bool __b = false;
+ if (__fmt & ios_base::oct || __fmt & ios_base::hex)
+ {
+ unsigned long long __l;
+ __l = static_cast<unsigned long long>(__n);
+ __b = _M_fnumput->put(*this, *this, __c, __l).failed();
+ }
+ else
+ __b = _M_fnumput->put(*this, *this, __c, __n).failed();
+ if (__b)
+ this->setstate(ios_base::badbit);
+ }
}
catch(exception& __fail)
{
@@ -230,8 +244,9 @@ namespace std
{
try
{
- if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
}
catch(exception& __fail)
{
@@ -255,8 +270,9 @@ namespace std
{
try
{
- if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
}
catch(exception& __fail)
{
@@ -279,8 +295,9 @@ namespace std
{
try
{
- if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
}
catch(exception& __fail)
{
@@ -303,8 +320,9 @@ namespace std
{
try
{
- if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
- this->setstate(ios_base::badbit);
+ if (_M_check_facet(_M_fnumput))
+ if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit);
}
catch(exception& __fail)
{
diff --git a/libstdc++-v3/include/bits/sbuf_iter.h b/libstdc++-v3/include/bits/sbuf_iter.h
index 4d69b587f7e..0f2c36db30a 100644
--- a/libstdc++-v3/include/bits/sbuf_iter.h
+++ b/libstdc++-v3/include/bits/sbuf_iter.h
@@ -38,7 +38,7 @@ namespace std
{
template<typename _CharT, typename _Traits>
class ostreambuf_iterator
- : public iterator<output_iterator_tag, _CharT, void, void, void>
+ : public iterator<output_iterator_tag, void, void, void, void>
{
public:
// Types:
diff --git a/libstdc++-v3/include/bits/std_complex.h b/libstdc++-v3/include/bits/std_complex.h
index 463cd6c06f6..e16a3bd2c80 100644
--- a/libstdc++-v3/include/bits/std_complex.h
+++ b/libstdc++-v3/include/bits/std_complex.h
@@ -41,11 +41,10 @@
#include <bits/c++config.h>
#include <bits/std_cmath.h>
-#include <bits/std_iosfwd.h>
+#include <bits/std_sstream.h>
namespace std
{
-
// Forward declarations
template<typename _Tp> class complex;
template<> class complex<float>;
@@ -346,11 +345,47 @@ namespace std
template<typename _Tp, typename _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&);
+ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
+ {
+ _Tp __re_x, __im_x;
+ _CharT __ch;
+ __is >> __ch;
+ if (__ch == '(')
+ {
+ __is >> __re_x >> __ch;
+ if (__ch == ',')
+ {
+ __is >> __im_x >> __ch;
+ if (__ch == ')')
+ __x = complex<_Tp>(__re_x, __im_x);
+ else
+ __is.setstate(ios_base::failbit);
+ }
+ else if (__ch == ')')
+ __x = complex<_Tp>(__re_x, _Tp(0));
+ else
+ __is.setstate(ios_base::failbit);
+ }
+ else
+ {
+ __is.putback(__ch);
+ __is >> __re_x;
+ __x = complex<_Tp>(__re_x, _Tp(0));
+ }
+ return __is;
+ }
template<typename _Tp, typename _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>&, const complex<_Tp>&);
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
+ {
+ basic_ostringstream<_CharT, _Traits> __s;
+ __s.flags(__os.flags());
+ __s.imbue(__os.getloc());
+ __s.precision(__os.precision());
+ __s << '(' << __x.real() << "," << __x.imag() << ')';
+ return __os << __s.str();
+ }
// Values
template<typename _Tp>
diff --git a/libstdc++-v3/include/bits/std_iosfwd.h b/libstdc++-v3/include/bits/std_iosfwd.h
index 3a3152cc082..9d2dbc2a2d1 100644
--- a/libstdc++-v3/include/bits/std_iosfwd.h
+++ b/libstdc++-v3/include/bits/std_iosfwd.h
@@ -129,3 +129,8 @@ namespace std
} // namespace std
#endif // _CPP_IOSFWD
+
+
+
+
+
diff --git a/libstdc++-v3/include/bits/std_istream.h b/libstdc++-v3/include/bits/std_istream.h
index bfaec7033c6..ec3791e24d6 100644
--- a/libstdc++-v3/include/bits/std_istream.h
+++ b/libstdc++-v3/include/bits/std_istream.h
@@ -41,7 +41,6 @@
namespace std
{
-
// 27.6.1.1 Template class basic_istream
template<typename _CharT, typename _Traits>
class basic_istream : virtual public basic_ios<_CharT, _Traits>
@@ -59,7 +58,7 @@ namespace std
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
typedef basic_ios<_CharT, _Traits> __ios_type;
typedef basic_istream<_CharT, _Traits> __istream_type;
- typedef istreambuf_iterator<_CharT> __istreambuf_iter;
+ typedef istreambuf_iterator<_CharT, _Traits> __istreambuf_iter;
typedef num_get<_CharT, __istreambuf_iter> __numget_type;
typedef ctype<_CharT> __ctype_type;
@@ -78,10 +77,7 @@ namespace std
virtual
~basic_istream()
- {
- _M_gcount = streamsize(0);
- _M_fnumget = NULL;
- }
+ { _M_gcount = streamsize(0); }
// 27.6.1.1.2 Prefix/suffix:
class sentry;
@@ -289,7 +285,6 @@ namespace std
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
ws(basic_istream<_CharT, _Traits>& __is);
-
} // namespace std
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
diff --git a/libstdc++-v3/include/bits/std_ostream.h b/libstdc++-v3/include/bits/std_ostream.h
index 5719854ea54..e8efb3b249e 100644
--- a/libstdc++-v3/include/bits/std_ostream.h
+++ b/libstdc++-v3/include/bits/std_ostream.h
@@ -57,7 +57,7 @@ namespace std
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
typedef basic_ios<_CharT, _Traits> __ios_type;
typedef basic_ostream<_CharT, _Traits> __ostream_type;
- typedef ostreambuf_iterator<_CharT> __ostreambuf_iter;
+ typedef ostreambuf_iterator<_CharT, _Traits> __ostreambuf_iter;
typedef num_put<_CharT, __ostreambuf_iter> __numput_type;
typedef ctype<_CharT> __ctype_type;
@@ -67,8 +67,7 @@ namespace std
{ this->init(__sb); }
virtual
- ~basic_ostream()
- { _M_fnumput = NULL; }
+ ~basic_ostream() { }
// 27.6.2.3 Prefix/suffix:
class sentry;
diff --git a/libstdc++-v3/include/bits/std_streambuf.h b/libstdc++-v3/include/bits/std_streambuf.h
index 678c140b3d7..8cc674d7039 100644
--- a/libstdc++-v3/include/bits/std_streambuf.h
+++ b/libstdc++-v3/include/bits/std_streambuf.h
@@ -277,7 +277,6 @@ namespace std
_M_buf_size_opt = 0;
_M_mode = ios_base::openmode(0);
_M_buf_locale_init = false;
-
}
// Locales: