diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-06-14 20:38:30 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-06-14 20:38:30 +0100 |
commit | cdd17d6e9956853892e4c097cc33afc2156df69e (patch) | |
tree | 9dd093a8714a77cd2da1b8da47f96a2354503708 /libstdc++-v3/testsuite/27_io/basic_istream | |
parent | be75f645e6d1ef22806a0193abecd56a215e6594 (diff) | |
download | gcc-cdd17d6e9956853892e4c097cc33afc2156df69e.zip gcc-cdd17d6e9956853892e4c097cc33afc2156df69e.tar.gz gcc-cdd17d6e9956853892e4c097cc33afc2156df69e.tar.bz2 |
Fix libstdc++ testsuite failures with -D_GLIBCXX_USE_CXX11_ABI=0
* doc/xml/manual/test.xml: Correct instructions on running tests.
* testsuite/21_strings/basic_string/cons/char/deduction.cc: Adjust to
pass when -D_GLIBCXX_USE_CXX11_ABI=0 added to RUNTESTFLAGS.
* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
Likewise.
* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Likewise.
* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/
exceptions_failbit.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
exceptions_failbit.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_other/char/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/
exceptions_null.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
exceptions_null.cc: Likewise.
* testsuite/27_io/ios_base/storage/2.cc: Likewise.
From-SVN: r249206
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/basic_istream')
6 files changed, 58 insertions, 35 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc index 2f1edf6..5fa3f1f 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include <sstream> #include <testsuite_hooks.h> @@ -29,20 +26,27 @@ void test_failbit() istringstream stream("jaylib - champion sound"); stream.exceptions(ios_base::failbit); - + + // The library throws the new definition of std::ios::failure +#if _GLIBCXX_USE_CXX11_ABI + typedef std::ios_base::failure exception_type; +#else + typedef std::exception exception_type; +#endif + try { T i; stream >> i; VERIFY( false ); } - catch (const ios_base::failure&) - { + catch (const exception_type&) + { // stream should set failbit and throw ios_base::failure. VERIFY( stream.fail() ); VERIFY( !stream.bad() ); VERIFY( !stream.eof() ); - } + } catch(...) { VERIFY( false ); } } diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc index 7038565..4ff48f7 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include <sstream> #include <testsuite_hooks.h> @@ -29,20 +26,27 @@ void test_failbit() wistringstream stream(L"jaylib - champion sound"); stream.exceptions(ios_base::failbit); - + + // The library throws the new definition of std::ios::failure +#if _GLIBCXX_USE_CXX11_ABI + typedef std::ios_base::failure exception_type; +#else + typedef std::exception exception_type; +#endif + try { T i; stream >> i; VERIFY( false ); } - catch (const ios_base::failure&) - { + catch (const exception_type&) + { // stream should set failbit and throw ios_base::failure. VERIFY( stream.fail() ); VERIFY( !stream.bad() ); VERIFY( !stream.eof() ); - } + } catch(...) { VERIFY( false ); } } diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc index 50c70f9..088aaa4 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include <istream> #include <ostream> #include <streambuf> @@ -38,12 +35,19 @@ void test4() istringstream stream; stream.exceptions(ios_base::failbit); + // The library throws the new definition of std::ios::failure +#if _GLIBCXX_USE_CXX11_ABI + typedef std::ios_base::failure exception_type; +#else + typedef std::exception exception_type; +#endif + try { stream >> static_cast<streambuf*>(0); VERIFY(false); } - catch (ios_base::failure&) + catch (exception_type&) { } diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc index 0d8a3cd..fd6322b 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include <istream> #include <ostream> #include <streambuf> @@ -38,12 +35,19 @@ void test4() wistringstream stream; stream.exceptions(ios_base::failbit); + // The library throws the new definition of std::ios::failure +#if _GLIBCXX_USE_CXX11_ABI + typedef std::ios_base::failure exception_type; +#else + typedef std::exception exception_type; +#endif + try { stream >> static_cast<wstreambuf*>(0); VERIFY( false ); } - catch (ios_base::failure&) + catch (exception_type&) { } diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc index ceb9234..0900a70 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc @@ -15,12 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - // 27.6.1.1.2 class basic_istream::sentry -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include <sstream> #include <testsuite_hooks.h> @@ -29,16 +25,23 @@ int main() using namespace std; istringstream stream; stream.exceptions(ios_base::eofbit); - + + // The library throws the new definition of std::ios::failure +#if _GLIBCXX_USE_CXX11_ABI + typedef std::ios_base::failure exception_type; +#else + typedef std::exception exception_type; +#endif + try { istream::sentry sentry(stream, false); VERIFY( false ); } - catch (ios_base::failure&) + catch (exception_type&) { VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) ); } - + return 0; } diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc index dc9d48a..e72fe1a 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - // 27.6.1.1.2 class basic_istream::sentry #include <sstream> @@ -28,16 +25,23 @@ int main() using namespace std; wistringstream stream; stream.exceptions(ios_base::eofbit); - + + // The library throws the new definition of std::ios::failure +#if _GLIBCXX_USE_CXX11_ABI + typedef std::ios_base::failure exception_type; +#else + typedef std::exception exception_type; +#endif + try { wistream::sentry sentry(stream, false); VERIFY( false ); } - catch (ios_base::failure&) + catch (exception_type&) { VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) ); } - + return 0; } |