Commit cdd17d6e by Jonathan Wakely Committed by Jonathan Wakely

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
parent be75f645
2017-06-14 Jonathan Wakely <jwakely@redhat.com>
* 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 <palves@redhat.com> 2017-06-12 Pedro Alves <palves@redhat.com>
* doc/xml/manual/status_cxx2017.xml: Update C++17 constexpr * doc/xml/manual/status_cxx2017.xml: Update C++17 constexpr
......
...@@ -569,7 +569,7 @@ cat 27_io/objects/char/3_xin.in | a.out</programlisting> ...@@ -569,7 +569,7 @@ cat 27_io/objects/char/3_xin.in | a.out</programlisting>
For example, to run the tests with For example, to run the tests with
<option>-O1 -D_GLIBCXX_ASSERTIONS</option> <option>-O1 -D_GLIBCXX_ASSERTIONS</option>
you could use: you could use:
<programlisting> make RUNTESTFLAGS=--target_board=unix/-O1/-D_GLIBCXX_ASSERTIONS</programlisting> <programlisting> make check RUNTESTFLAGS=--target_board=unix/-O1/-D_GLIBCXX_ASSERTIONS</programlisting>
</para> </para>
<para> <para>
...@@ -577,7 +577,7 @@ cat 27_io/objects/char/3_xin.in | a.out</programlisting> ...@@ -577,7 +577,7 @@ cat 27_io/objects/char/3_xin.in | a.out</programlisting>
tests multiple times in different variations. For example, to run the tests multiple times in different variations. For example, to run the
entire testsuite three times using <option>-O3</option> but with entire testsuite three times using <option>-O3</option> but with
different <option>-std</option> options: different <option>-std</option> options:
<programlisting> make 'RUNTESTFLAGS=--target_board=unix/-O3\"{-std=gnu++98,-std=gnu++11,-std=gnu++14}\"'</programlisting> <programlisting> make check 'RUNTESTFLAGS=--target_board=unix/-O3\"{-std=gnu++98,-std=gnu++11,-std=gnu++14}\"'</programlisting>
N.B. that set of variations could also be written as N.B. that set of variations could also be written as
<literal>unix/-O3\"{-std=gnu++98,-std=gnu++11,}\"</literal> so that <literal>unix/-O3\"{-std=gnu++98,-std=gnu++11,}\"</literal> so that
the third variation would use the default for <option>-std</option> the third variation would use the default for <option>-std</option>
......
...@@ -50,11 +50,13 @@ test01() ...@@ -50,11 +50,13 @@ test01()
const std::basic_string s4 = s3; const std::basic_string s4 = s3;
check_type<const std::string>(s4); check_type<const std::string>(s4);
#if _GLIBCXX_USE_CXX11_ABI
std::basic_string s5(s0, a); std::basic_string s5(s0, a);
check_type<std::string>(s5); check_type<std::string>(s5);
std::basic_string s6(std::move(s0), a); std::basic_string s6(std::move(s0), a);
check_type<std::string>(s6); check_type<std::string>(s6);
#endif
std::basic_string s7(s0, 0, 0); std::basic_string s7(s0, 0, 0);
check_type<std::string>(s7); check_type<std::string>(s7);
......
...@@ -46,11 +46,13 @@ test01() ...@@ -46,11 +46,13 @@ test01()
const std::basic_string s4 = s2; const std::basic_string s4 = s2;
check_type<const std::wstring>(s4); check_type<const std::wstring>(s4);
#if _GLIBCXX_USE_CXX11_ABI
std::basic_string s5(s0, a); std::basic_string s5(s0, a);
check_type<std::wstring>(s5); check_type<std::wstring>(s5);
std::basic_string s6(std::move(s0), a); std::basic_string s6(std::move(s0), a);
check_type<std::wstring>(s6); check_type<std::wstring>(s6);
#endif
std::basic_string s7(s0, 0, 0); std::basic_string s7(s0, 0, 0);
check_type<std::wstring>(s7); check_type<std::wstring>(s7);
......
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// 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 // 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file. // NB: Don't include any other headers in this file.
...@@ -49,6 +46,13 @@ void test02() ...@@ -49,6 +46,13 @@ void test02()
} }
{ {
// 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_01(0);
std::ios ios_02(0); std::ios ios_02(0);
ios_01.clear(std::ios_base::eofbit); ios_01.clear(std::ios_base::eofbit);
...@@ -58,7 +62,7 @@ void test02() ...@@ -58,7 +62,7 @@ void test02()
ios_01.copyfmt(ios_02); ios_01.copyfmt(ios_02);
VERIFY( false ); VERIFY( false );
} }
catch(std::ios_base::failure& fail) { catch(exception_type&) {
VERIFY( true ); VERIFY( true );
} }
catch(...) { catch(...) {
......
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// 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 // 27.4.4.2 basic_ios member functions
// NB: Don't include any other headers in this file. // NB: Don't include any other headers in this file.
...@@ -53,13 +50,20 @@ void test01() ...@@ -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); std::ios ios_01(0);
ios_01.clear(std::ios_base::eofbit); ios_01.clear(std::ios_base::eofbit);
try { try {
ios_01.exceptions(std::ios_base::eofbit); ios_01.exceptions(std::ios_base::eofbit);
VERIFY( false ); VERIFY( false );
} }
catch(std::ios_base::failure& fail) { catch(exception_type&) {
iostate02 = ios_01.exceptions(); iostate02 = ios_01.exceptions();
VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) ); VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
} }
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <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 <sstream>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
...@@ -30,13 +27,20 @@ void test_failbit() ...@@ -30,13 +27,20 @@ void test_failbit()
istringstream stream("jaylib - champion sound"); istringstream stream("jaylib - champion sound");
stream.exceptions(ios_base::failbit); 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 try
{ {
T i; T i;
stream >> i; stream >> i;
VERIFY( false ); VERIFY( false );
} }
catch (const ios_base::failure&) catch (const exception_type&)
{ {
// stream should set failbit and throw ios_base::failure. // stream should set failbit and throw ios_base::failure.
VERIFY( stream.fail() ); VERIFY( stream.fail() );
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <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 <sstream>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
...@@ -30,13 +27,20 @@ void test_failbit() ...@@ -30,13 +27,20 @@ void test_failbit()
wistringstream stream(L"jaylib - champion sound"); wistringstream stream(L"jaylib - champion sound");
stream.exceptions(ios_base::failbit); 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 try
{ {
T i; T i;
stream >> i; stream >> i;
VERIFY( false ); VERIFY( false );
} }
catch (const ios_base::failure&) catch (const exception_type&)
{ {
// stream should set failbit and throw ios_base::failure. // stream should set failbit and throw ios_base::failure.
VERIFY( stream.fail() ); VERIFY( stream.fail() );
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <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 <istream>
#include <ostream> #include <ostream>
#include <streambuf> #include <streambuf>
...@@ -38,12 +35,19 @@ void test4() ...@@ -38,12 +35,19 @@ void test4()
istringstream stream; istringstream stream;
stream.exceptions(ios_base::failbit); 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 try
{ {
stream >> static_cast<streambuf*>(0); stream >> static_cast<streambuf*>(0);
VERIFY(false); VERIFY(false);
} }
catch (ios_base::failure&) catch (exception_type&)
{ {
} }
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <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 <istream>
#include <ostream> #include <ostream>
#include <streambuf> #include <streambuf>
...@@ -38,12 +35,19 @@ void test4() ...@@ -38,12 +35,19 @@ void test4()
wistringstream stream; wistringstream stream;
stream.exceptions(ios_base::failbit); 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 try
{ {
stream >> static_cast<wstreambuf*>(0); stream >> static_cast<wstreambuf*>(0);
VERIFY( false ); VERIFY( false );
} }
catch (ios_base::failure&) catch (exception_type&)
{ {
} }
......
...@@ -15,12 +15,8 @@ ...@@ -15,12 +15,8 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// 27.6.1.1.2 class basic_istream::sentry // 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 <sstream>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
...@@ -30,12 +26,19 @@ int main() ...@@ -30,12 +26,19 @@ int main()
istringstream stream; istringstream stream;
stream.exceptions(ios_base::eofbit); 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 try
{ {
istream::sentry sentry(stream, false); istream::sentry sentry(stream, false);
VERIFY( false ); VERIFY( false );
} }
catch (ios_base::failure&) catch (exception_type&)
{ {
VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) ); VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
} }
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <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 // 27.6.1.1.2 class basic_istream::sentry
#include <sstream> #include <sstream>
...@@ -29,12 +26,19 @@ int main() ...@@ -29,12 +26,19 @@ int main()
wistringstream stream; wistringstream stream;
stream.exceptions(ios_base::eofbit); 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 try
{ {
wistream::sentry sentry(stream, false); wistream::sentry sentry(stream, false);
VERIFY( false ); VERIFY( false );
} }
catch (ios_base::failure&) catch (exception_type&)
{ {
VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) ); VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
} }
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <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 <istream>
#include <ostream> #include <ostream>
#include <streambuf> #include <streambuf>
...@@ -40,12 +37,19 @@ void test3() ...@@ -40,12 +37,19 @@ void test3()
ostringstream stream; ostringstream stream;
stream.exceptions(ios_base::badbit); 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 try
{ {
stream << static_cast<streambuf*>(0); stream << static_cast<streambuf*>(0);
VERIFY( false ); VERIFY( false );
} }
catch (ios_base::failure&) catch (exception_type&)
{ {
} }
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <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 <istream>
#include <ostream> #include <ostream>
#include <streambuf> #include <streambuf>
...@@ -40,12 +37,19 @@ void test3() ...@@ -40,12 +37,19 @@ void test3()
wostringstream stream; wostringstream stream;
stream.exceptions(ios_base::badbit); 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 try
{ {
stream << static_cast<wstreambuf*>(0); stream << static_cast<wstreambuf*>(0);
VERIFY( false ); VERIFY( false );
} }
catch (ios_base::failure&) catch (exception_type&)
{ {
} }
......
...@@ -28,9 +28,6 @@ ...@@ -28,9 +28,6 @@
// Radar 6467884: 10.X systems are not robust when paging space is exceeded // Radar 6467884: 10.X systems are not robust when paging space is exceeded
// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } } // { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
// The library throws the new definition of std::ios::failure
// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
...@@ -53,11 +50,18 @@ void test02() ...@@ -53,11 +50,18 @@ void test02()
ios.pword(1) = v; ios.pword(1) = v;
VERIFY( ios.pword(1) == v ); VERIFY( ios.pword(1) == v );
// 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 try
{ {
v = ios.pword(max); v = ios.pword(max);
} }
catch(std::ios_base::failure& obj) catch(exception_type&)
{ {
// Ok. // Ok.
VERIFY( ios.bad() ); VERIFY( ios.bad() );
...@@ -76,7 +80,7 @@ void test02() ...@@ -76,7 +80,7 @@ void test02()
{ {
v = ios.pword(std::numeric_limits<int>::max()); v = ios.pword(std::numeric_limits<int>::max());
} }
catch(std::ios_base::failure& obj) catch(exception_type&)
{ {
// Ok. // Ok.
VERIFY( ios.bad() ); VERIFY( ios.bad() );
...@@ -95,7 +99,7 @@ void test02() ...@@ -95,7 +99,7 @@ void test02()
{ {
l = ios.iword(max); l = ios.iword(max);
} }
catch(std::ios_base::failure& obj) catch(exception_type&)
{ {
// Ok. // Ok.
VERIFY( ios.bad() ); VERIFY( ios.bad() );
...@@ -114,7 +118,7 @@ void test02() ...@@ -114,7 +118,7 @@ void test02()
{ {
l = ios.iword(std::numeric_limits<int>::max()); l = ios.iword(std::numeric_limits<int>::max());
} }
catch(std::ios_base::failure& obj) catch(exception_type&)
{ {
// Ok. // Ok.
VERIFY( ios.bad() ); VERIFY( ios.bad() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment