From: Jonathan Wakely Date: Wed, 14 Jun 2017 19:38:30 +0000 (+0100) Subject: Fix libstdc++ testsuite failures with -D_GLIBCXX_USE_CXX11_ABI=0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cdd17d6e9956853892e4c097cc33afc2156df69e;p=gcc.git 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 05efaa06824..8820d9d03d7 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,28 @@ +2017-06-14 Jonathan Wakely + + * 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. + 2017-06-12 Pedro Alves * doc/xml/manual/status_cxx2017.xml: Update C++17 constexpr diff --git a/libstdc++-v3/doc/xml/manual/test.xml b/libstdc++-v3/doc/xml/manual/test.xml index 7cb7dafd5df..154b74cbf9f 100644 --- a/libstdc++-v3/doc/xml/manual/test.xml +++ b/libstdc++-v3/doc/xml/manual/test.xml @@ -569,7 +569,7 @@ cat 27_io/objects/char/3_xin.in | a.out For example, to run the tests with you could use: - make RUNTESTFLAGS=--target_board=unix/-O1/-D_GLIBCXX_ASSERTIONS + make check RUNTESTFLAGS=--target_board=unix/-O1/-D_GLIBCXX_ASSERTIONS @@ -577,7 +577,7 @@ cat 27_io/objects/char/3_xin.in | a.out tests multiple times in different variations. For example, to run the entire testsuite three times using but with different options: - make 'RUNTESTFLAGS=--target_board=unix/-O3\"{-std=gnu++98,-std=gnu++11,-std=gnu++14}\"' + make check 'RUNTESTFLAGS=--target_board=unix/-O3\"{-std=gnu++98,-std=gnu++11,-std=gnu++14}\"' N.B. that set of variations could also be written as unix/-O3\"{-std=gnu++98,-std=gnu++11,}\" so that the third variation would use the default for diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc index c9af333f28e..205714a7f5f 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc @@ -50,11 +50,13 @@ test01() const std::basic_string s4 = s3; check_type(s4); +#if _GLIBCXX_USE_CXX11_ABI std::basic_string s5(s0, a); check_type(s5); std::basic_string s6(std::move(s0), a); check_type(s6); +#endif std::basic_string s7(s0, 0, 0); check_type(s7); diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc index 1f8eadb355a..23ae07c6634 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc @@ -46,11 +46,13 @@ test01() const std::basic_string s4 = s2; check_type(s4); +#if _GLIBCXX_USE_CXX11_ABI std::basic_string s5(s0, a); check_type(s5); std::basic_string s6(std::move(s0), a); check_type(s6); +#endif std::basic_string s7(s0, 0, 0); check_type(s7); diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc index 87551a08311..840017e4e85 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc @@ -17,9 +17,6 @@ // with this library; see the file COPYING3. If not see // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - // 27.4.4.2 basic_ios member functions // NB: Don't include any other headers in this file. @@ -36,29 +33,36 @@ void test02() // basic_ios& copyfmt(const basic_ios& rhs) { std::ios ios_01(0); - std::ios ios_02(0); + std::ios ios_02(0); ios_01.exceptions(std::ios_base::eofbit); ios_02.exceptions(std::ios_base::eofbit); - + try { - ios_01.copyfmt(ios_02); - } + ios_01.copyfmt(ios_02); + } catch(...) { VERIFY( false ); } } { + // 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 + std::ios ios_01(0); - std::ios ios_02(0); + std::ios ios_02(0); ios_01.clear(std::ios_base::eofbit); ios_02.exceptions(std::ios_base::eofbit); try { ios_01.copyfmt(ios_02); VERIFY( false ); - } - catch(std::ios_base::failure& fail) { + } + catch(exception_type&) { VERIFY( true ); } catch(...) { @@ -67,7 +71,7 @@ void test02() } } -int main() +int main() { test02(); return 0; diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc index 86b7bee35d3..152e783640a 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc @@ -17,9 +17,6 @@ // with this library; see the file COPYING3. If not see // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - // 27.4.4.2 basic_ios member functions // NB: Don't include any other headers in this file. @@ -44,7 +41,7 @@ void test01() std::ios ios_01(0); try { ios_01.exceptions(std::ios_base::eofbit); - } + } catch(...) { VERIFY( false ); } @@ -53,13 +50,20 @@ void test01() } { + // 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 + std::ios ios_01(0); ios_01.clear(std::ios_base::eofbit); try { ios_01.exceptions(std::ios_base::eofbit); VERIFY( false ); - } - catch(std::ios_base::failure& fail) { + } + catch(exception_type&) { iostate02 = ios_01.exceptions(); VERIFY( static_cast(iostate02 & std::ios_base::eofbit) ); } @@ -69,7 +73,7 @@ void test01() } } -int main() +int main() { test01(); return 0; 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 2f1edf6e79c..5fa3f1f34a0 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 // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include #include @@ -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 7038565eb89..4ff48f73712 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 // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include #include @@ -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 50c70f96378..088aaa42808 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 // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include #include #include @@ -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(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 0d8a3cd3f3a..fd6322b4cdb 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 // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include #include #include @@ -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(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 ceb92347e08..0900a70d148 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 // . - // 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 #include @@ -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 dc9d48a18d8..e72fe1a03a0 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 // . -// 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 @@ -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; } diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc index ab9ef94da35..9a7bd06f21a 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include #include #include @@ -39,13 +36,20 @@ void test3() ostringstream stream; stream.exceptions(ios_base::badbit); - + + // 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(0); VERIFY( false ); } - catch (ios_base::failure&) + catch (exception_type&) { } diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc index bba6dd0e3f1..fcfb37d2dac 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc @@ -15,9 +15,6 @@ // with this library; see the file COPYING3. If not see // . -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } - #include #include #include @@ -39,13 +36,20 @@ void test3() wostringstream stream; stream.exceptions(ios_base::badbit); - + + // 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(0); VERIFY( false ); } - catch (ios_base::failure&) + catch (exception_type&) { } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc index d2c9ec50e53..8fa306f61a2 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc @@ -26,10 +26,7 @@ // Skip test at -m64 on Darwin because RLIMITS are not being honored. // Radar 6467883: 10.4/10.5 setrlimits are not honored by memory allocators // Radar 6467884: 10.X systems are not robust when paging space is exceeded -// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } } - -// The library throws the new definition of std::ios::failure -// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" } +// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } } #include #include @@ -52,12 +49,19 @@ void test02() // pword ios.pword(1) = v; VERIFY( ios.pword(1) == v ); - - try + + // 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 { v = ios.pword(max); } - catch(std::ios_base::failure& obj) + catch(exception_type&) { // Ok. VERIFY( ios.bad() ); @@ -69,14 +73,14 @@ void test02() VERIFY( v == 0 ); VERIFY( ios.pword(1) == v ); - + // max is different code path from max-1 v = &test; try { v = ios.pword(std::numeric_limits::max()); } - catch(std::ios_base::failure& obj) + catch(exception_type&) { // Ok. VERIFY( ios.bad() ); @@ -90,12 +94,12 @@ void test02() // iword ios.iword(1) = 1; VERIFY( ios.iword(1) == 1 ); - - try + + try { l = ios.iword(max); } - catch(std::ios_base::failure& obj) + catch(exception_type&) { // Ok. VERIFY( ios.bad() ); @@ -110,11 +114,11 @@ void test02() // max is different code path from max-1 l = 1; - try + try { l = ios.iword(std::numeric_limits::max()); } - catch(std::ios_base::failure& obj) + catch(exception_type&) { // Ok. VERIFY( ios.bad() );