aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-10-08 21:04:26 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-10-09 00:57:48 +0100
commit43e2a44182768ce1fe00d6ea41dcbad1f963d6c7 (patch)
tree1ceecd5207d4a15cbf657706d167ca6a8a8d1fd8
parent29a9de9b40277af98515eabebb75be1f154e9505 (diff)
downloadgcc-43e2a44182768ce1fe00d6ea41dcbad1f963d6c7.zip
gcc-43e2a44182768ce1fe00d6ea41dcbad1f963d6c7.tar.gz
gcc-43e2a44182768ce1fe00d6ea41dcbad1f963d6c7.tar.bz2
libstdc++: Add missing _GLIBCXX_USE_WCHAR_T checks in testsuite
These tests fail for a --disable-wchar_t build. libstdc++-v3/ChangeLog: * testsuite/22_locale/conversions/buffer/1.cc: Check _GLIBCXX_USE_WCHAR_T. * testsuite/22_locale/conversions/buffer/3.cc: Likewise. Add test using char16_t. * testsuite/22_locale/conversions/string/1.cc: Check _GLIBCXX_USE_WCHAR_T. * testsuite/27_io/filesystem/path/generic/generic_string.cc: Likewise. * testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: Likewise. * testsuite/27_io/filesystem/path/native/alloc.cc: Likewise. * testsuite/27_io/filesystem/path/native/string-char8_t.cc: Likewise. * testsuite/27_io/filesystem/path/native/string.cc: Likewise. * testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc: Likewise. * testsuite/experimental/filesystem/path/generic/generic_string.cc: Likewise. * testsuite/experimental/filesystem/path/native/alloc.cc: Likewise. * testsuite/experimental/filesystem/path/native/string-char8_t.cc: Likewise. * testsuite/experimental/filesystem/path/native/string.cc: Likewise.
-rw-r--r--libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc10
-rw-r--r--libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc18
-rw-r--r--libstdc++-v3/testsuite/22_locale/conversions/string/1.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/make_preferred.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/native/alloc.cc4
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc2
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/path/native/alloc.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc2
13 files changed, 53 insertions, 5 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
index 2d5c094..9db7fce 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
@@ -31,12 +31,11 @@ template<typename Elem>
using buf_conv = std::wbuffer_convert<cvt<Elem>, Elem>;
using std::string;
-using std::stringstream;
using std::wstring;
-using std::wstringstream;
void test01()
{
+#ifdef _GLIBCXX_USE_WCHAR_T
buf_conv<wchar_t> buf;
std::stringbuf sbuf;
VERIFY( buf.rdbuf() == nullptr );
@@ -46,6 +45,7 @@ void test01()
__gnu_test::implicitly_default_constructible test;
test.operator()<buf_conv<wchar_t>>(); // P0935R0
+#endif
}
void test02()
@@ -53,7 +53,7 @@ void test02()
std::stringbuf sbuf;
buf_conv<char> buf(&sbuf); // noconv
- stringstream ss;
+ std::stringstream ss;
ss.std::ios::rdbuf(&buf);
string input = "King for a day...";
ss << input << std::flush;
@@ -63,15 +63,17 @@ void test02()
void test03()
{
+#ifdef _GLIBCXX_USE_WCHAR_T
std::stringbuf sbuf;
buf_conv<wchar_t> buf(&sbuf);
- wstringstream ss;
+ std::wstringstream ss;
ss.std::wios::rdbuf(&buf);
wstring input = L"Fool for a lifetime";
ss << input << std::flush;
string output = sbuf.str();
VERIFY( output == "Fool for a lifetime" );
+#endif
}
int main()
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
index 94aa43b..3e1d90f 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
@@ -38,21 +38,37 @@ private:
char c = 'a';
};
-struct codecvt : std::codecvt<wchar_t, char, std::mbstate_t> { };
void
test01()
{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ struct codecvt : std::codecvt<wchar_t, char, std::mbstate_t> { };
// https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html
streambuf sb;
std::wbuffer_convert<codecvt> conv(&sb);
VERIFY( sb.in_avail() == 0 );
wchar_t c = conv.sgetc();
VERIFY( c == L'a' );
+#endif
+}
+
+
+void
+test02()
+{
+ struct codecvt : std::codecvt<char16_t, char, std::mbstate_t> { };
+ // https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html
+ streambuf sb;
+ std::wbuffer_convert<codecvt, char16_t> conv(&sb);
+ VERIFY( sb.in_avail() == 0 );
+ char16_t c = conv.sgetc();
+ VERIFY( c == u'a' );
}
int
main()
{
test01();
+ test02();
}
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
index 0016910..b5132da 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
@@ -51,6 +51,7 @@ void test01()
void test02()
{
+#ifdef _GLIBCXX_USE_WCHAR_T
typedef str_conv<wchar_t> wsc;
wsc c;
string input = "Fool for a lifetime";
@@ -71,6 +72,7 @@ void test02()
__gnu_test::implicitly_default_constructible test;
test.operator()<wsc>(); // P0935R0
+#endif
}
int main()
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc
index 85d564e..4a603e2 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc
@@ -69,7 +69,9 @@ test03()
// A path constructed from the generic format string should compare equal
// to the original, because they represent the same path.
VERIFY( path(p.generic_string()) == p );
+#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( path(p.generic_wstring()) == p );
+#endif
VERIFY( path(p.generic_u8string()) == p );
VERIFY( path(p.generic_u16string()) == p );
VERIFY( path(p.generic_u32string()) == p );
@@ -80,7 +82,9 @@ test03()
// A path constructed from the generic format string should compare equal
// to the original, because they represent the same path.
VERIFY( path(p.generic_string()) == p );
+#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( path(p.generic_wstring()) == p );
+#endif
VERIFY( path(p.generic_u8string()) == p );
VERIFY( path(p.generic_u16string()) == p );
VERIFY( path(p.generic_u32string()) == p );
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/make_preferred.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/make_preferred.cc
index 8f9e720..d21f179 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/make_preferred.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/make_preferred.cc
@@ -45,7 +45,11 @@ struct checker<wchar_t, L'\\'>
{
static void check()
{
+#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( path("foo/bar").make_preferred() == L"foo\\bar" );
+#else
+ VERIFY( ! "filesystem::path needs --enable-wchar_t on this target" );
+#endif
}
};
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/native/alloc.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/native/alloc.cc
index fb0b75d..87a59b6 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/native/alloc.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/native/alloc.cc
@@ -41,9 +41,11 @@ test01()
VERIFY( str8.get_allocator() == alloc<char8_t>(1) );
#endif
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>(alloc<wchar_t>(2));
VERIFY( strw == L"" );
VERIFY( strw.get_allocator() == alloc<wchar_t>(2) );
+#endif
auto str16 = p.string<char16_t>(alloc<char16_t>(3));
VERIFY( str16 == u"" );
@@ -70,9 +72,11 @@ test02()
VERIFY( str8.get_allocator() == alloc<char8_t>(1) );
#endif
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>(alloc<wchar_t>(2));
VERIFY( strw == L"abcdefghijklmnopqrstuvwxyz" );
VERIFY( strw.get_allocator() == alloc<wchar_t>(2) );
+#endif
auto str16 = p.string<char16_t>(alloc<char16_t>(3));
VERIFY( str16 == u"abcdefghijklmnopqrstuvwxyz" );
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
index df0bb5f..9442129 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
@@ -50,9 +50,11 @@ test02()
VERIFY( str == "abc" );
VERIFY( str == p.string() );
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>();
VERIFY( strw == L"abc" );
VERIFY( strw == p.wstring() );
+#endif
#ifdef _GLIBCXX_USE_CHAR8_T
auto str8 = p.string<char8_t>();
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc
index b4f802d..a61f78a 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc
@@ -48,9 +48,11 @@ test02()
VERIFY( str == "abc" );
VERIFY( str == p.string() );
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>();
VERIFY( strw == L"abc" );
VERIFY( strw == p.wstring() );
+#endif
auto str16 = p.string<char16_t>();
VERIFY( str16 == u"abc" );
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc
index bd03037..a24ee63 100644
--- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc
@@ -35,12 +35,14 @@ using namespace std;
void
test01()
{
+#ifdef _GLIBCXX_USE_WCHAR_T
std::wstring str2 = L"ÜBER";
std::wregex re2;
re2.imbue(std::locale("de_DE.UTF-8"));
re2.assign(L"[[:upper:]]*", std::regex::extended);
std::wsmatch m2;
VERIFY(regex_match_debug(str2, m2, re2));
+#endif
}
int
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc
index d8e35ee..26d68c8 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/generic/generic_string.cc
@@ -55,7 +55,9 @@ test03()
// A path constructed from the generic format string should compare equal
// to the original, because they represent the same path.
VERIFY( path(p.generic_string()) == p );
+#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( path(p.generic_wstring()) == p );
+#endif
VERIFY( path(p.generic_u8string()) == p );
VERIFY( path(p.generic_u16string()) == p );
VERIFY( path(p.generic_u32string()) == p );
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/native/alloc.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/native/alloc.cc
index 591ebae..0442648 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/native/alloc.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/native/alloc.cc
@@ -43,9 +43,11 @@ test01()
VERIFY( str8.get_allocator() == alloc<char8_t>(1) );
#endif
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>(alloc<wchar_t>(2));
VERIFY( strw == L"" );
VERIFY( strw.get_allocator() == alloc<wchar_t>(2) );
+#endif
auto str16 = p.string<char16_t>(alloc<char16_t>(3));
VERIFY( str16 == u"" );
@@ -72,9 +74,11 @@ test02()
VERIFY( str8.get_allocator() == alloc<char8_t>(1) );
#endif
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>(alloc<wchar_t>(2));
VERIFY( strw == L"abcdefghijklmnopqrstuvwxyz" );
VERIFY( strw.get_allocator() == alloc<wchar_t>(2) );
+#endif
auto str16 = p.string<char16_t>(alloc<char16_t>(3));
VERIFY( str16 == u"abcdefghijklmnopqrstuvwxyz" );
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc
index d8dc1f8..9775fe8 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc
@@ -50,9 +50,11 @@ test02()
VERIFY( str == u"abc" );
VERIFY( str == p.string() );
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>();
VERIFY( strw == L"abc" );
VERIFY( strw == p.wstring() );
+#endif
#ifdef _GLIBCXX_USE_CHAR8_T
auto str8 = p.string<char8_t>();
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc
index 40f9bb9..d82a539 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string.cc
@@ -50,9 +50,11 @@ test02()
VERIFY( str == u"abc" );
VERIFY( str == p.string() );
+#ifdef _GLIBCXX_USE_WCHAR_T
auto strw = p.string<wchar_t>();
VERIFY( strw == L"abc" );
VERIFY( strw == p.wstring() );
+#endif
auto str16 = p.string<char16_t>();
VERIFY( str16 == u"abc" );