This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[v3] istream fixes for libstdc++/2181
- To: gcc-bugs at gcc dot gnu dot org
- Subject: [v3] istream fixes for libstdc++/2181
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Tue, 6 Mar 2001 18:08:34 -0800
ugh...
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.
Index: include/bits/istream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/istream.tcc,v
retrieving revision 1.9
diff -c -p -r1.9 istream.tcc
*** istream.tcc 2001/03/04 21:34:00 1.9
--- istream.tcc 2001/03/07 02:06:57
*************** namespace std {
*** 81,100 ****
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;
! }
! }
return *this;
}
--- 81,87 ----
basic_istream<_CharT, _Traits>::
operator>>(__istream_type& (*__pf)(__istream_type&))
{
! __pf(*this);
return *this;
}
*************** namespace std {
*** 103,122 ****
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;
! }
! }
return *this;
}
--- 90,96 ----
basic_istream<_CharT, _Traits>::
operator>>(__ios_type& (*__pf)(__ios_type&))
{
! __pf(*this);
return *this;
}
*************** namespace std {
*** 125,144 ****
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;
! }
! }
return *this;
}
--- 99,105 ----
basic_istream<_CharT, _Traits>::
operator>>(ios_base& (*__pf)(ios_base&))
{
! __pf(*this);
return *this;
}
Index: testsuite/27_io/istream_extractor_other.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc,v
retrieving revision 1.3
diff -c -p -r1.3 istream_extractor_other.cc
*** istream_extractor_other.cc 2001/01/25 04:09:21 1.3
--- istream_extractor_other.cc 2001/03/07 02:06:59
***************
*** 1,6 ****
// 1999-07-28 bkoz
! // Copyright (C) 1999 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
--- 1,6 ----
// 1999-07-28 bkoz
! // 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
*************** bool test01() {
*** 55,70 ****
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*)
// null istream to empty in_buf
--- 55,62 ----
*************** bool test02() {
*** 184,193 ****
--- 176,209 ----
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;
}
Index: testsuite/27_io/istream_manip.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/istream_manip.cc,v
retrieving revision 1.3
diff -c -p -r1.3 istream_manip.cc
*** istream_manip.cc 2001/01/16 07:55:26 1.3
--- istream_manip.cc 2001/03/07 02:06:59
*************** bool test01(void)
*** 70,76 ****
VERIFY( !iss02.eof() );
iss01 >> std::ws;
! VERIFY( iss01.fail() );
VERIFY( iss01.eof() );
#ifdef DEBUG_ASSERT
--- 70,76 ----
VERIFY( !iss02.eof() );
iss01 >> std::ws;
! VERIFY( !iss01.fail() );
VERIFY( iss01.eof() );
#ifdef DEBUG_ASSERT