diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2001-03-07 02:08:59 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2001-03-07 02:08:59 +0000 |
commit | 2077a6c51e0d1727dd870b272d61c83a6753d39c (patch) | |
tree | 5c3b34994cdbab2491f915a7b256d1346ed31d41 | |
parent | cc937581390c3aebf39e5f36b61f6b6098b8a236 (diff) | |
download | gcc-2077a6c51e0d1727dd870b272d61c83a6753d39c.zip gcc-2077a6c51e0d1727dd870b272d61c83a6753d39c.tar.gz gcc-2077a6c51e0d1727dd870b272d61c83a6753d39c.tar.bz2 |
istream.tcc (basic_istream<_CharT, [...]): Don't use sentry.
2001-03-06 Benjamin Kosnik <bkoz@redhat.com>
libstdc++/2181
* include/bits/istream.tcc (basic_istream<_CharT, _Traits>::
operator>>(__istream_type& (*__pf)(__istream_type&)): Don't use
sentry.
(basic_istream<_CharT, _Traits>:: operator>>(__ios_type&
(*__pf)(__ios_type&)): Same.
(basic_istream<_CharT, _Traits>:: operator>>(ios_base&
(*__pf)(ios_base&))): Same.
* testsuite/27_io/istream_extractor_other.cc: Add tests.
* testsuite/27_io/istream_manip.cc (test01): Fix.
From-SVN: r40281
-rw-r--r-- | libstdc++-v3/ChangeLog | 13 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/istream.tcc | 45 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/istream_extractor_other.cc | 34 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/istream_manip.cc | 2 |
4 files changed, 42 insertions, 52 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 116a974..2e6b71d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2001-03-06 Benjamin Kosnik <bkoz@redhat.com> + + libstdc++/2181 + * include/bits/istream.tcc (basic_istream<_CharT, _Traits>:: + operator>>(__istream_type& (*__pf)(__istream_type&)): Don't use + sentry. + (basic_istream<_CharT, _Traits>:: operator>>(__ios_type& + (*__pf)(__ios_type&)): Same. + (basic_istream<_CharT, _Traits>:: operator>>(ios_base& + (*__pf)(ios_base&))): Same. + * testsuite/27_io/istream_extractor_other.cc: Add tests. + * testsuite/27_io/istream_manip.cc (test01): Fix. + 2001-03-06 Nathan Myers <ncm@cantrip.org> Benjamin Kosnik <bkoz@redhat.com> diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index 121dee2..faee226 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -81,20 +81,7 @@ namespace std { basic_istream<_CharT, _Traits>:: operator>>(__istream_type& (*__pf)(__istream_type&)) { - sentry __cerb(*this, false); - if (__cerb) - { - try { - __pf(*this); - } - 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; - } - } + __pf(*this); return *this; } @@ -103,20 +90,7 @@ namespace std { basic_istream<_CharT, _Traits>:: operator>>(__ios_type& (*__pf)(__ios_type&)) { - sentry __cerb(*this, false); - if (__cerb) - { - try { - __pf(*this); - } - 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; - } - } + __pf(*this); return *this; } @@ -125,20 +99,7 @@ namespace std { basic_istream<_CharT, _Traits>:: operator>>(ios_base& (*__pf)(ios_base&)) { - sentry __cerb(*this, false); - if (__cerb) - { - try { - __pf(*this); - } - 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; - } - } + __pf(*this); return *this; } diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc index 2bd878f..4925c29 100644 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc +++ b/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc @@ -1,6 +1,6 @@ // 1999-07-28 bkoz -// Copyright (C) 1999 Free Software Foundation +// Copyright (C) 1999, 2001 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -55,14 +55,6 @@ bool test01() { statefail = std::ios_base::failbit; stateeof = std::ios_base::eofbit; - // template<_CharT, _Traits> - // basic_istream& operator>>(basic_istream& (*pf) (basic_istream&)) - - // template<_CharT, _Traits> - // basic_istream& operator>>(basic_ios& (*pf) (basic_ios&)) - - // template<_CharT, _Traits> - // basic_istream& operator>>(ios_base& (*pf) (ios_base&)) // template<_CharT, _Traits> // basic_istream& operator>>(basic_streambuf*) @@ -184,10 +176,34 @@ bool test02() { return test; } +void test03() +{ + using namespace std; + bool test = true; + + // template<_CharT, _Traits> + // basic_istream& operator>>(ios_base& (*pf) (ios_base&)) + { + int i = 0; + std::istringstream iss(" 43"); + iss >> std::noskipws >> i; + std::ios::iostate i3 = iss.rdstate(); + VERIFY ( !iss ); //should set failbit + } + + // template<_CharT, _Traits> + // basic_istream& operator>>(basic_ios& (*pf) (basic_ios&)) + + // template<_CharT, _Traits> + // basic_istream& operator>>(basic_istream& (*pf) (basic_istream&)) +} + + int main() { test01(); test02(); + test03(); return 0; } diff --git a/libstdc++-v3/testsuite/27_io/istream_manip.cc b/libstdc++-v3/testsuite/27_io/istream_manip.cc index ba3826c..68f83ab 100644 --- a/libstdc++-v3/testsuite/27_io/istream_manip.cc +++ b/libstdc++-v3/testsuite/27_io/istream_manip.cc @@ -70,7 +70,7 @@ bool test01(void) VERIFY( !iss02.eof() ); iss01 >> std::ws; - VERIFY( iss01.fail() ); + VERIFY( !iss01.fail() ); VERIFY( iss01.eof() ); #ifdef DEBUG_ASSERT |