From: Louis Dionne Date: Tue, 2 Apr 2019 22:21:27 +0000 (+0000) Subject: Revert "[libc++] Fix error flags and exceptions propagated from input stream operations" X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38b7e74836e314ec15c16d9106d2e2cf295e349a;p=platform%2Fupstream%2Fllvm.git Revert "[libc++] Fix error flags and exceptions propagated from input stream operations" This reverts commits r357533 and r357531, which broke the LLDB data formatters. I'll hold off until we know how to fix the data formatters accordingly. llvm-svn: 357536 --- diff --git a/libcxx/include/ios b/libcxx/include/ios index ce4e176..96e84eb 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -330,15 +330,6 @@ public: void __set_badbit_and_consider_rethrow(); void __set_failbit_and_consider_rethrow(); - _LIBCPP_INLINE_VISIBILITY - void __setstate_nothrow(iostate __state) - { - if (__rdbuf_) - __rdstate_ |= __state; - else - __rdstate_ |= __state | ios_base::badbit; - } - protected: _LIBCPP_INLINE_VISIBILITY ios_base() {// purposefully does no initialization diff --git a/libcxx/include/istream b/libcxx/include/istream index d6217bb..14a5fe1 100644 --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -362,31 +362,26 @@ template _LIBCPP_INLINE_VISIBILITY basic_istream<_CharT, _Traits>& __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __s(__is); - if (__s) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __s(__is); + if (__s) + { typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; - use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n); -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } + ios_base::iostate __err = ios_base::goodbit; + use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __n); + __is.setstate(__err); } -#endif - __is.setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } @@ -471,46 +466,39 @@ template _LIBCPP_INLINE_VISIBILITY basic_istream<_CharT, _Traits>& __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __s(__is); - if (__s) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __s(__is); + if (__s) + { typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; + ios_base::iostate __err = ios_base::goodbit; long __temp; - use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp); + use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __temp); if (__temp < numeric_limits<_Tp>::min()) { - __state |= ios_base::failbit; + __err |= ios_base::failbit; __n = numeric_limits<_Tp>::min(); } else if (__temp > numeric_limits<_Tp>::max()) { - __state |= ios_base::failbit; + __err |= ios_base::failbit; __n = numeric_limits<_Tp>::max(); } else - { __n = static_cast<_Tp>(__temp); - } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } + __is.setstate(__err); } -#endif // _LIBCPP_NO_EXCEPTIONS - __is.setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } @@ -533,22 +521,22 @@ _LIBCPP_INLINE_VISIBILITY basic_istream<_CharT, _Traits>& __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __sen(__is); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) { -#endif _CharT* __s = __p; const ctype<_CharT>& __ct = use_facet >(__is.getloc()); + ios_base::iostate __err = ios_base::goodbit; while (__s != __p + (__n-1)) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } _CharT __ch = _Traits::to_char_type(__i); @@ -560,21 +548,16 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) *__s = _CharT(); __is.width(0); if (__s == __p) - __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } + __err |= ios_base::failbit; + __is.setstate(__err); } -#endif - __is.setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } @@ -642,33 +625,26 @@ template basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __sen(__is); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) { -#endif typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); if (_Traits::eq_int_type(__i, _Traits::eof())) - __state |= ios_base::eofbit | ios_base::failbit; + __is.setstate(ios_base::eofbit | ios_base::failbit); else __c = _Traits::to_char_type(__i); -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } } -#endif - __is.setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } @@ -692,56 +668,58 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(basic_streambuf* __sb) { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; - sentry __s(*this, true); - if (__s) +#ifndef _LIBCPP_NO_EXCEPTIONS + try { - if (__sb) +#endif // _LIBCPP_NO_EXCEPTIONS + sentry __s(*this, true); + if (__s) { -#ifndef _LIBCPP_NO_EXCEPTIONS - try + if (__sb) { -#endif // _LIBCPP_NO_EXCEPTIONS - while (true) +#ifndef _LIBCPP_NO_EXCEPTIONS + try { - typename traits_type::int_type __i = this->rdbuf()->sgetc(); - if (traits_type::eq_int_type(__i, _Traits::eof())) +#endif // _LIBCPP_NO_EXCEPTIONS + ios_base::iostate __err = ios_base::goodbit; + while (true) { - __state |= ios_base::eofbit; - break; + typename traits_type::int_type __i = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__i, _Traits::eof())) + { + __err |= ios_base::eofbit; + break; + } + if (traits_type::eq_int_type( + __sb->sputc(traits_type::to_char_type(__i)), + traits_type::eof())) + break; + ++__gc_; + this->rdbuf()->sbumpc(); } - if (traits_type::eq_int_type( - __sb->sputc(traits_type::to_char_type(__i)), - traits_type::eof())) - break; - ++__gc_; - this->rdbuf()->sbumpc(); - } - if (__gc_ == 0) - __state |= ios_base::failbit; + if (__gc_ == 0) + __err |= ios_base::failbit; + this->setstate(__err); #ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - if (__gc_ == 0) - __state |= ios_base::failbit; - - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit) + } + catch (...) { - throw; + if (__gc_ == 0) + this->__set_failbit_and_consider_rethrow(); } - } #endif // _LIBCPP_NO_EXCEPTIONS + } + else + this->setstate(ios_base::failbit); } - else - { - __state |= ios_base::failbit; - } - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -749,34 +727,28 @@ template typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::get() { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; int_type __r = traits_type::eof(); - sentry __s(*this, true); - if (__s) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + sentry __s(*this, true); + if (__s) { -#endif __r = this->rdbuf()->sbumpc(); if (traits_type::eq_int_type(__r, traits_type::eof())) - __state |= ios_base::failbit | ios_base::eofbit; + this->setstate(ios_base::failbit | ios_base::eofbit); else __gc_ = 1; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - this->__setstate_nothrow(this->rdstate() | ios_base::badbit); - if (this->exceptions() & ios_base::badbit) - { - throw; - } } -#endif - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return __r; } @@ -784,23 +756,23 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm) { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; - sentry __sen(*this, true); - if (__sen) +#ifndef _LIBCPP_NO_EXCEPTIONS + try { - if (__n > 0) +#endif // _LIBCPP_NO_EXCEPTIONS + sentry __sen(*this, true); + if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS - try + if (__n > 0) { -#endif + ios_base::iostate __err = ios_base::goodbit; while (__gc_ < __n-1) { int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } char_type __ch = traits_type::to_char_type(__i); @@ -811,33 +783,23 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __ this->rdbuf()->sbumpc(); } if (__gc_ == 0) - __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - if (__n > 0) - *__s = char_type(); - throw; - } + __err |= ios_base::failbit; + this->setstate(__err); } -#endif - } - else - { - __state |= ios_base::failbit; + else + this->setstate(ios_base::failbit); } - if (__n > 0) *__s = char_type(); - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + if (__n > 0) + *__s = char_type(); + this->__set_badbit_and_consider_rethrow(); } - if (__n > 0) - *__s = char_type(); +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -846,43 +808,52 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(basic_streambuf& __sb, char_type __dlm) { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS - while (true) + sentry __sen(*this, true); + if (__sen) + { + ios_base::iostate __err = ios_base::goodbit; +#ifndef _LIBCPP_NO_EXCEPTIONS + try { - typename traits_type::int_type __i = this->rdbuf()->sgetc(); - if (traits_type::eq_int_type(__i, traits_type::eof())) +#endif // _LIBCPP_NO_EXCEPTIONS + while (true) { - __state |= ios_base::eofbit; - break; + typename traits_type::int_type __i = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__i, traits_type::eof())) + { + __err |= ios_base::eofbit; + break; + } + char_type __ch = traits_type::to_char_type(__i); + if (traits_type::eq(__ch, __dlm)) + break; + if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof())) + break; + ++__gc_; + this->rdbuf()->sbumpc(); } - char_type __ch = traits_type::to_char_type(__i); - if (traits_type::eq(__ch, __dlm)) - break; - if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof())) - break; - ++__gc_; - this->rdbuf()->sbumpc(); - } #ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - // according to the spec, exceptions here are caught but not rethrown - } + } + catch (...) + { + } #endif // _LIBCPP_NO_EXCEPTIONS - if (__gc_ == 0) - __state |= ios_base::failbit; - this->setstate(__state); + if (__gc_ == 0) + __err |= ios_base::failbit; + this->setstate(__err); + } +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -890,21 +861,21 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm) { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + sentry __sen(*this, true); + if (__sen) + { + ios_base::iostate __err = ios_base::goodbit; while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } char_type __ch = traits_type::to_char_type(__i); @@ -916,35 +887,28 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ } if (__gc_ >= __n-1) { - __state |= ios_base::failbit; + __err |= ios_base::failbit; break; } *__s++ = __ch; this->rdbuf()->sbumpc(); ++__gc_; } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - if (__n > 0) - *__s = char_type(); - if (__gc_ == 0) - __state |= ios_base::failbit; - throw; - } + if (__gc_ == 0) + __err |= ios_base::failbit; + this->setstate(__err); } -#endif // _LIBCPP_NO_EXCEPTIONS + if (__n > 0) + *__s = char_type(); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + if (__n > 0) + *__s = char_type(); + this->__set_badbit_and_consider_rethrow(); } - if (__n > 0) - *__s = char_type(); - if (__gc_ == 0) - __state |= ios_base::failbit; - this->setstate(__state); +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -952,15 +916,15 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + sentry __sen(*this, true); + if (__sen) + { + ios_base::iostate __err = ios_base::goodbit; if (__n == numeric_limits::max()) { while (true) @@ -968,7 +932,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) typename traits_type::int_type __i = this->rdbuf()->sbumpc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } ++__gc_; @@ -983,7 +947,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) typename traits_type::int_type __i = this->rdbuf()->sbumpc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } ++__gc_; @@ -991,20 +955,15 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) break; } } -#ifndef _LIBCPP_NO_EXCEPTIONS + this->setstate(__err); } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } - } -#endif // _LIBCPP_NO_EXCEPTIONS - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -1012,33 +971,26 @@ template typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::peek() { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; int_type __r = traits_type::eof(); - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + sentry __sen(*this, true); + if (__sen) + { __r = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__r, traits_type::eof())) - __state |= ios_base::eofbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } + this->setstate(ios_base::eofbit); } -#endif // _LIBCPP_NO_EXCEPTIONS - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return __r; } @@ -1046,36 +998,27 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + sentry __sen(*this, true); + if (__sen) + { __gc_ = this->rdbuf()->sgetn(__s, __n); if (__gc_ != __n) - __state |= ios_base::failbit | ios_base::eofbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } + this->setstate(ios_base::failbit | ios_base::eofbit); } -#endif // _LIBCPP_NO_EXCEPTIONS + else + this->setstate(ios_base::failbit); +#ifndef _LIBCPP_NO_EXCEPTIONS } - else + catch (...) { - __state |= ios_base::failbit; + this->__set_badbit_and_consider_rethrow(); } - this->setstate(__state); +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -1083,48 +1026,36 @@ template streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) { - ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + sentry __sen(*this, true); + if (__sen) + { streamsize __c = this->rdbuf()->in_avail(); switch (__c) { case -1: - __state |= ios_base::eofbit; + this->setstate(ios_base::eofbit); break; case 0: break; default: - __n = _VSTD::min(__c, __n); - __gc_ = this->rdbuf()->sgetn(__s, __n); - if (__gc_ != __n) - __state |= ios_base::failbit | ios_base::eofbit; + read(__s, _VSTD::min(__c, __n)); break; } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } } -#endif // _LIBCPP_NO_EXCEPTIONS + else + this->setstate(ios_base::failbit); +#ifndef _LIBCPP_NO_EXCEPTIONS } - else + catch (...) { - __state |= ios_base::failbit; + this->__set_badbit_and_consider_rethrow(); } - this->setstate(__state); +#endif // _LIBCPP_NO_EXCEPTIONS return __gc_; } @@ -1132,36 +1063,27 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_type __c) { - ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; __gc_ = 0; - this->clear(__state); - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS - if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof()) - __state |= ios_base::badbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __sen(*this, true); + if (__sen) { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } + if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof()) + this->setstate(ios_base::badbit); } -#endif // _LIBCPP_NO_EXCEPTIONS + else + this->setstate(ios_base::failbit); +#ifndef _LIBCPP_NO_EXCEPTIONS } - else + catch (...) { - __state |= ios_base::failbit; + this->__set_badbit_and_consider_rethrow(); } - this->setstate(__state); +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -1169,36 +1091,27 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() { - ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; __gc_ = 0; - this->clear(__state); - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS - if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof()) - __state |= ios_base::badbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __sen(*this, true); + if (__sen) { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } + if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof()) + this->setstate(ios_base::badbit); } -#endif // _LIBCPP_NO_EXCEPTIONS + else + this->setstate(ios_base::failbit); +#ifndef _LIBCPP_NO_EXCEPTIONS } - else + catch (...) { - __state |= ios_base::failbit; + this->__set_badbit_and_consider_rethrow(); } - this->setstate(__state); +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -1206,36 +1119,29 @@ template int basic_istream<_CharT, _Traits>::sync() { - ios_base::iostate __state = ios_base::goodbit; int __r = 0; - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + sentry __sen(*this, true); + if (__sen) + { if (this->rdbuf() == 0) return -1; if (this->rdbuf()->pubsync() == -1) { - __state |= ios_base::badbit; + this->setstate(ios_base::badbit); return -1; } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } } -#endif // _LIBCPP_NO_EXCEPTIONS - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return __r; } @@ -1243,30 +1149,21 @@ template typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>::tellg() { - ios_base::iostate __state = ios_base::goodbit; pos_type __r(-1); - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS - __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); + sentry __sen(*this, true); + if (__sen) + __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); #ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } - } -#endif // _LIBCPP_NO_EXCEPTIONS - this->setstate(__state); } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return __r; } @@ -1274,31 +1171,24 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type __pos) { - ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; - this->clear(__state); - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS - if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) - __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __sen(*this, true); + if (__sen) { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } + if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) + this->setstate(ios_base::failbit); } -#endif // _LIBCPP_NO_EXCEPTIONS - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -1306,31 +1196,24 @@ template basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) { - ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; - this->clear(__state); - sentry __sen(*this, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS - if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1)) - __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __sen(*this, true); + if (__sen) { - __state |= ios_base::badbit; - this->__setstate_nothrow(__state); - if (this->exceptions() & ios_base::badbit) - { - throw; - } + if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1)) + this->setstate(ios_base::failbit); } -#endif // _LIBCPP_NO_EXCEPTIONS - this->setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + this->__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return *this; } @@ -1338,41 +1221,34 @@ template basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __is) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try - { + try + { #endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); + if (__sen) + { const ctype<_CharT>& __ct = use_facet >(__is.getloc()); while (true) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { - __state |= ios_base::eofbit; + __is.setstate(ios_base::eofbit); break; } if (!__ct.is(__ct.space, _Traits::to_char_type(__i))) break; __is.rdbuf()->sbumpc(); } -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } } -#endif // _LIBCPP_NO_EXCEPTIONS - __is.setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } @@ -1451,14 +1327,13 @@ basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __sen(__is); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) { -#endif __str.clear(); streamsize __n = __is.width(); if (__n <= 0) @@ -1467,12 +1342,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, __n = numeric_limits::max(); streamsize __c = 0; const ctype<_CharT>& __ct = use_facet >(__is.getloc()); + ios_base::iostate __err = ios_base::goodbit; while (__c < __n) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } _CharT __ch = _Traits::to_char_type(__i); @@ -1484,21 +1360,18 @@ operator>>(basic_istream<_CharT, _Traits>& __is, } __is.width(0); if (__c == 0) - __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } + __err |= ios_base::failbit; + __is.setstate(__err); } -#endif - __is.setstate(__state); + else + __is.setstate(ios_base::failbit); +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } @@ -1507,22 +1380,22 @@ basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); + if (__sen) { -#endif __str.clear(); + ios_base::iostate __err = ios_base::goodbit; streamsize __extr = 0; while (true) { typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } ++__extr; @@ -1532,26 +1405,21 @@ getline(basic_istream<_CharT, _Traits>& __is, __str.push_back(__ch); if (__str.size() == __str.max_size()) { - __state |= ios_base::failbit; + __err |= ios_base::failbit; break; } } if (__extr == 0) - __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS + __err |= ios_base::failbit; + __is.setstate(__err); } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } - } -#endif - __is.setstate(__state); +#ifndef _LIBCPP_NO_EXCEPTIONS + } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } @@ -1590,17 +1458,17 @@ template basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) { - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __sen(__is); - if (__sen) - { #ifndef _LIBCPP_NO_EXCEPTIONS - try + try + { +#endif // _LIBCPP_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) { -#endif basic_string<_CharT, _Traits> __str; const ctype<_CharT>& __ct = use_facet >(__is.getloc()); size_t __c = 0; + ios_base::iostate __err = ios_base::goodbit; _CharT __zero = __ct.widen('0'); _CharT __one = __ct.widen('1'); while (__c < _Size) @@ -1608,7 +1476,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { - __state |= ios_base::eofbit; + __err |= ios_base::eofbit; break; } _CharT __ch = _Traits::to_char_type(__i); @@ -1620,21 +1488,18 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) } __x = bitset<_Size>(__str); if (__c == 0) - __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS - } - catch (...) - { - __state |= ios_base::badbit; - __is.__setstate_nothrow(__state); - if (__is.exceptions() & ios_base::badbit) - { - throw; - } + __err |= ios_base::failbit; + __is.setstate(__err); } -#endif - __is.setstate(__state); + else + __is.setstate(ios_base::failbit); +#ifndef _LIBCPP_NO_EXCEPTIONS } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCPP_NO_EXCEPTIONS return __is; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp index e9df54f..799ec5e 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - bool n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - bool n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp index 615765c..9f9872d 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp index 72fd7ed..c2b937a 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - float n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - float n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp index d099fa8..702287b 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp @@ -16,7 +16,6 @@ #include #include #include -#include "test_macros.h" template struct testbuf @@ -77,44 +76,6 @@ int main(int, char**) assert(!is.eof()); assert( is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp index a517406..9f9118c 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp index 769e9a3..bdd3019 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - long double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - long double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp index dff93d1..1612468 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp index f88be1b..0893d8c 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp @@ -19,7 +19,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -98,44 +97,6 @@ int main(int, char**) assert( is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - void* n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - void* n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp index 56ab584..a0d96c3 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp @@ -16,7 +16,6 @@ #include #include #include -#include "test_macros.h" template struct testbuf @@ -77,44 +76,6 @@ int main(int, char**) assert(!is.eof()); assert( is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp index 79d3dcb..578cfcf 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp index 10e2fab..f1c150d7 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp index 9a73e87..068d31a 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp index c4d95f5..9906bbe 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp index 15f26fc..cbb606c 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -84,80 +83,6 @@ int main(int, char**) assert(!is.fail()); assert(c == L'c'); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - wchar_t n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - wchar_t n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp index d5ae909..bd06de6 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -67,44 +66,6 @@ int main(int, char**) assert(!is.fail()); assert(c == 'c'); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - signed char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - signed char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp index 64ff48d..d512833 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -104,46 +103,6 @@ int main(int, char**) assert(std::string((char*)s) == ""); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - signed char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - signed char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp index bf244e1..9feb826 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp @@ -11,13 +11,11 @@ // template > // class basic_istream; -// basic_istream& operator>>(basic_streambuf* sb); +// basic_istream& operator<<(basic_streambuf* sb); #include #include -#include "test_macros.h" - template class testbuf : public std::basic_streambuf @@ -67,104 +65,6 @@ int main(int, char**) assert(sb2.str() == "testing..."); assert(is.gcount() == 10); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb(" "); - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::istream::eofbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf sb(L" "); - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::istream::eofbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - - { - testbuf sb; - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> static_cast*>(0); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> static_cast*>(0); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp index 8d86d11..3eceaae 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -67,44 +66,6 @@ int main(int, char**) assert(!is.fail()); assert(c == 'c'); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp index 7e4bf41..14b29931 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -104,46 +103,6 @@ int main(int, char**) assert(std::string((char*)s) == ""); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp index 117a0ba..f0a9e07 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -115,84 +114,6 @@ int main(int, char**) assert(std::string(s) == ""); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::wistream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - wchar_t s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf sb; - std::wistream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - wchar_t s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp index 0eaf58b..6786ebf 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp @@ -14,7 +14,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -76,42 +75,6 @@ int main(int, char**) assert(is.eof()); assert(is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb(" "); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - std::ws(is); - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - } - { - testbuf sb(L" "); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - std::ws(is); - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp index 788e215..40a0417 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp @@ -12,7 +12,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -97,50 +96,6 @@ int main(int, char**) assert(c == L'c'); assert(is.gcount() == 1); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb("rrrrrrrrr"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - is.get(); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } - { - testbuf sb(L"rrrrrrrrr"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - is.get(); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp index 7b5e56d..ae31c9b 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp @@ -12,7 +12,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -100,52 +99,6 @@ int main(int, char**) assert(c == L'c'); assert(is.gcount() == 1); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb("rrrrrrrrr"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - char c; - is.get(c); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } - { - testbuf sb(L"rrrrrrrrr"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - wchar_t c; - is.get(c); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp index 2a88b72..149392c 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp @@ -84,6 +84,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.get(s, 5); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf sb(L" \n \n "); std::wistream is(&sb); @@ -120,77 +140,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf sb(" "); - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::string(s) == " "); - assert(is.gcount() == 1); - } - { testbuf sb(L" "); - std::basic_istream is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::wstring(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf sb; - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf sb; - std::basic_istream is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { - is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp index df8ccc8..e7c96d6 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp @@ -84,6 +84,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.get(s, 5, '*'); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf sb(L" * * "); std::wistream is(&sb); @@ -120,77 +140,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf sb(" "); - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string(s) == " "); - assert(is.gcount() == 1); - } - { testbuf sb(L" "); - std::basic_istream is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.get(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf sb; - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { - is.get(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf sb; - std::basic_istream is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { - is.get(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp index f34873c..dda59d7 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp @@ -13,8 +13,6 @@ #include #include -#include "test_macros.h" - template class testbuf : public std::basic_streambuf @@ -86,73 +84,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 3); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb(" "); - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf sb(L" "); - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - - { - testbuf sb; - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp index adef49b..a1e46c2 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" template class testbuf @@ -86,73 +85,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 3); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb(" "); - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf sb(L" "); - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - - { - testbuf sb; - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - testbuf sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp index de54bf4..9c91053 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp @@ -76,6 +76,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.getline(s, 5); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf sb(L" \n \n "); std::wistream is(&sb); @@ -104,77 +124,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf sb(" "); - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string(s) == " "); - assert(is.gcount() == 1); - } - { testbuf sb(L" "); - std::basic_istream is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf sb; - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf sb; - std::basic_istream is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp index de19167..bee1976 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp @@ -76,6 +76,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.getline(s, 5, '*'); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf sb(L" * * "); std::wistream is(&sb); @@ -104,77 +124,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf sb(" "); - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string(s) == " "); - assert(is.gcount() == 1); - } - { testbuf sb(L" "); - std::basic_istream is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.getline(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf sb; - std::basic_istream is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf sb; - std::basic_istream is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp index 6283162..7f6348b 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp @@ -14,8 +14,6 @@ #include #include -#include "test_macros.h" - template struct testbuf : public std::basic_streambuf @@ -74,38 +72,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 6); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb(" "); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.ignore(5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf sb(L" "); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.ignore(5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp index 2d09932..1794346 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp @@ -12,7 +12,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -66,38 +65,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.peek(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.peek(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp index 588c0a6..4ca3a8c 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp @@ -13,8 +13,6 @@ #include #include -#include "test_macros.h" - template struct testbuf : public std::basic_streambuf @@ -87,38 +85,6 @@ int main(int, char**) assert(is.bad()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.putback('x'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.putback(L'x'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp index 0ae8bcf..9296e0b 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp @@ -12,7 +12,6 @@ #include #include -#include "test_macros.h" template struct testbuf @@ -78,40 +77,6 @@ int main(int, char**) assert( is.fail()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - char s[10]; - bool threw = false; - try { - is.read(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - wchar_t s[10]; - bool threw = false; - try { - is.read(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp index ff22e98..43ddd81 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp @@ -13,8 +13,6 @@ #include #include -#include "test_macros.h" - int sync_called = 0; template @@ -48,41 +46,6 @@ protected: } }; -#ifndef TEST_HAS_NO_EXCEPTIONS -struct testbuf_exception { }; - -template -struct throwing_testbuf - : public std::basic_streambuf -{ - typedef std::basic_string string_type; - typedef std::basic_streambuf base; -private: - string_type str_; -public: - - throwing_testbuf() {} - throwing_testbuf(const string_type& str) - : str_(str) - { - base::setg(const_cast(str_.data()), - const_cast(str_.data()), - const_cast(str_.data()) + str_.size()); - } - - CharT* eback() const {return base::eback();} - CharT* gptr() const {return base::gptr();} - CharT* egptr() const {return base::egptr();} - -protected: - virtual int sync() - { - throw testbuf_exception(); - return 5; - } -}; -#endif // TEST_HAS_NO_EXCEPTIONS - int main(int, char**) { { @@ -97,36 +60,6 @@ int main(int, char**) assert(is.sync() == 0); assert(sync_called == 2); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - throwing_testbuf sb(" 123456789"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.sync(); - } catch (testbuf_exception const&) { - threw = true; - } - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - throwing_testbuf sb(L" 123456789"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.sync(); - } catch (testbuf_exception const&) { - threw = true; - } - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp index b48ff86..ca00af4 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp @@ -13,8 +13,6 @@ #include #include -#include "test_macros.h" - template struct testbuf : public std::basic_streambuf @@ -79,38 +77,6 @@ int main(int, char**) assert(is.bad()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.unget(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - testbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.unget(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp index 6069f8e..8e663cb 100644 --- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp @@ -18,7 +18,6 @@ #include #include "min_allocator.h" -#include "test_macros.h" int main(int, char**) { @@ -78,85 +77,6 @@ int main(int, char**) assert(s == L" ghij"); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - std::basic_stringbuf sb("hello"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - assert(s == "hello"); - } - { - std::basic_stringbuf sb(L"hello"); - std::basic_istream is(&sb); - is.exceptions(std::ios_base::eofbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - assert(s == L"hello"); - } - - { - std::basic_stringbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - assert(s == ""); - } - { - std::basic_stringbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios_base::failbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - assert(s == L""); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp index d7d271b..b081b55 100644 --- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp @@ -18,7 +18,6 @@ #include #include "min_allocator.h" -#include "test_macros.h" int main(int, char**) { @@ -90,84 +89,6 @@ int main(int, char**) assert(s == L" ghij"); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - std::basic_stringbuf sb("hello"); - std::basic_istream is(&sb); - is.exceptions(std::ios::eofbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s, '\n'); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - assert(s == "hello"); - } - { - std::basic_stringbuf sb(L"hello"); - std::basic_istream is(&sb); - is.exceptions(std::ios::eofbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s, L'\n'); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - assert(s == L"hello"); - } - { - std::basic_stringbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios::failbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s, '\n'); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - assert(s == ""); - } - { - std::basic_stringbuf sb; - std::basic_istream is(&sb); - is.exceptions(std::ios::failbit); - - std::basic_string s; - bool threw = false; - try { - std::getline(is, s, L'\n'); - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - assert(s == L""); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp index 92061e2..389701d 100644 --- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp @@ -18,7 +18,6 @@ #include #include "min_allocator.h" -#include "test_macros.h" int main(int, char**) { @@ -66,44 +65,6 @@ int main(int, char**) in >> s; assert(in.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - std::stringbuf sb; - std::istream is(&sb); - is.exceptions(std::ios::failbit); - - bool threw = false; - try { - std::string s; - is >> s; - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - std::stringbuf sb; - std::istream is(&sb); - is.exceptions(std::ios::eofbit); - - bool threw = false; - try { - std::string s; - is >> s; - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS #if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; diff --git a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp index 1cb92ea..9abe19c 100644 --- a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp @@ -9,60 +9,19 @@ // test: // template -// basic_istream& -// operator>>(basic_istream& is, bitset& x); +// basic_ostream& +// operator<<(basic_ostream& os, const bitset& x); #include #include #include -#include "test_macros.h" int main(int, char**) { - { - std::istringstream in("01011010"); - std::bitset<8> b; - in >> b; - assert(b.to_ulong() == 0x5A); - } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - std::stringbuf sb; - std::istream is(&sb); - is.exceptions(std::ios::failbit); + std::istringstream in("01011010"); + std::bitset<8> b; + in >> b; + assert(b.to_ulong() == 0x5A); - bool threw = false; - try { - std::bitset<8> b; - is >> b; - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - std::stringbuf sb; - std::istream is(&sb); - is.exceptions(std::ios::eofbit); - - bool threw = false; - try { - std::bitset<8> b; - is >> b; - } catch (std::ios::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - - return 0; + return 0; } diff --git a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_out.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_out.pass.cpp index 43c20f8..2c4ce1e 100644 --- a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_out.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_out.pass.cpp @@ -9,8 +9,8 @@ // test: // template -// basic_ostream& -// operator<<(basic_ostream& os, const bitset& x); +// basic_istream& +// operator>>(basic_istream& is, bitset& x); #include #include