On 23/12/18 21:27 -0500, Tom Honermann wrote:
Attached is a revised patch that addresses changes in P0482R6.
Changes from the prior patch include:
- Updated the value of the __cpp_char8_t feature test macro to 201811.
Tested on x86_64-linux.
There are quite a few additional changes needed to make the testsuite
pass cleanly with non-default options, e.g. when running it with
RUNTESTFLAGS=--target_board=unix/-fchar8_t/-fno-inline I see these
failures:
FAIL: 21_strings/basic_string/literals/types.cc (test for excess errors)
FAIL: 21_strings/basic_string/literals/values.cc (test for excess errors)
UNRESOLVED: 21_strings/basic_string/literals/values.cc compilation failed to
produce executable
FAIL: 21_strings/basic_string_view/literals/types.cc (test for excess errors)
FAIL: 21_strings/basic_string_view/literals/values.cc (test for excess errors)
UNRESOLVED: 21_strings/basic_string_view/literals/values.cc compilation failed
to produce executable
FAIL: 22_locale/codecvt/char16_t.cc (test for excess errors)
UNRESOLVED: 22_locale/codecvt/char16_t.cc compilation failed to produce
executable
FAIL: 22_locale/codecvt/char32_t.cc (test for excess errors)
UNRESOLVED: 22_locale/codecvt/char32_t.cc compilation failed to produce
executable
FAIL: 22_locale/codecvt/codecvt_utf8/79980.cc (test for excess errors)
UNRESOLVED: 22_locale/codecvt/codecvt_utf8/79980.cc compilation failed to
produce executable
FAIL: 22_locale/codecvt/codecvt_utf8/wchar_t/1.cc (test for excess errors)
UNRESOLVED: 22_locale/codecvt/codecvt_utf8/wchar_t/1.cc compilation failed to
produce executable
FAIL: 22_locale/codecvt/utf8.cc (test for excess errors)
UNRESOLVED: 22_locale/codecvt/utf8.cc compilation failed to produce executable
FAIL: 22_locale/conversions/string/2.cc (test for excess errors)
UNRESOLVED: 22_locale/conversions/string/2.cc compilation failed to produce
executable
FAIL: 22_locale/conversions/string/3.cc (test for excess errors)
UNRESOLVED: 22_locale/conversions/string/3.cc compilation failed to produce
executable
FAIL: experimental/string_view/literals/types.cc (test for excess errors)
FAIL: experimental/string_view/literals/values.cc (test for excess errors)
UNRESOLVED: experimental/string_view/literals/values.cc compilation failed to
produce executable
There would be similar errors running all the tests with -std=c++2a,
which is definitely something I do often and so want the tests to be
clean. We can either disable those tests when char8_t is enabled
(because we already have alternative tests checking the char8_t
versions of string_view etc.) or make them work either way, which the
attached patch begins doing (more changes are needed).
I expect a different set of failures for -fno-char8_t (which is
probably a less important case to support that enabling char8_t in
older standards, but maybe still worth testing now and then).
commit fb345c6806bd4f1efdb5937e083076e79f2086dd
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Thu Feb 7 09:04:11 2019 +0000
fixup tests
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
index e83cf98e4c7..2e97b4f3ab0 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
@@ -40,14 +40,14 @@ void test01()
typedef str_conv<char> sc;
const sc::byte_string berr = "invalid wide string";
- const sc::wide_string werr = u8"invalid byte string";
+ const sc::wide_string werr = "invalid byte string";
sc c(berr, werr);
string input = "Stop";
input += char(0xFF);
string woutput = c.from_bytes(input);
VERIFY( input == woutput ); // noconv case doesn't detect invalid input
- string winput = u8"Stop";
+ string winput = "Stop";
winput += char(0xFF);
string output = c.to_bytes(winput);
VERIFY( winput == output ); // noconv case doesn't detect invalid input
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
index 144c8582a41..ac03f362411 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
@@ -31,9 +31,18 @@
# error "ATOMIC_CHAR_LOCK_FREE must be 1 or 2"
#endif
+#ifdef _GLIBCXX_USE_CHAR8_T
+# ifndef ATOMIC_CHAR8_T_LOCK_FREE
+# error "ATOMIC_CHAR8_T_LOCK_FREE must be a macro"
+# elif ATOMIC_CHAR8_T_LOCK_FREE != 1 && ATOMIC_CHAR8_T_LOCK_FREE != 2
+# error "ATOMIC_CHAR8_T_LOCK_FREE must be 1 or 2"
+# endif
+#endif
+
#ifndef ATOMIC_CHAR16_T_LOCK_FREE
# error "ATOMIC_CHAR16_T_LOCK_FREE must be a macro"
#elif ATOMIC_CHAR16_T_LOCK_FREE != 1 && ATOMIC_CHAR16_T_LOCK_FREE != 2
+# error "ATOMIC_CHAR16_T_LOCK_FREE must be 1 or 2"
#endif
#ifndef ATOMIC_CHAR32_T_LOCK_FREE
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
index c53bb24fa49..47084c4a33a 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
@@ -46,6 +46,9 @@ void test01()
using std::atomic_llong;
using std::atomic_ullong;
using std::atomic_wchar_t;
+#ifdef _GLIBCXX_USE_CHAR8_T
+ using std::atomic_char8_t;
+#endif
using std::atomic_char16_t;
using std::atomic_char32_t;
diff --git a/libstdc++-v3/testsuite/experimental/string_view/literals/types.cc b/libstdc++-v3/testsuite/experimental/string_view/literals/types.cc
index 022c3fabe26..0998a05dcbd 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/literals/types.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/literals/types.cc
@@ -20,6 +20,12 @@
#include <experimental/string_view>
#include <type_traits>
+#ifdef _GLIBCXX_USE_CHAR8_T
+using std::experimental::u8string_view;
+#else
+using u8string_view = std::experimental::string_view;
+#endif
+
void
test01()
{
@@ -28,7 +34,7 @@ test01()
static_assert(std::is_same<decltype("Hello"sv), std::experimental::string_view>::value,
"\"Hello\"s is std::string_view");
- static_assert(std::is_same<decltype(u8"Hello"sv), std::experimental::string_view>::value,
+ static_assert(std::is_same<decltype(u8"Hello"sv), u8string_view>::value,
"u8\"Hello\"s is std::string_view");
#ifdef _GLIBCXX_USE_WCHAR_T
diff --git a/libstdc++-v3/testsuite/experimental/string_view/literals/values.cc b/libstdc++-v3/testsuite/experimental/string_view/literals/values.cc
index 3af91c25fcb..e18ee7edf6e 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/literals/values.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/literals/values.cc
@@ -20,6 +20,12 @@
#include <experimental/string_view>
#include <testsuite_hooks.h>
+#ifdef _GLIBCXX_USE_CHAR8_T
+using std::experimental::u8string_view;
+#else
+using u8string_view = std::experimental::string_view;
+#endif
+
void
test01()
{
@@ -29,7 +35,7 @@ test01()
#ifdef _GLIBCXX_USE_WCHAR_T
std::experimental::wstring_view wplanet = L"Venus"sv;
#endif
- std::experimental::string_view u8planet = u8"Mars"sv;
+ u8string_view u8planet = u8"Mars"sv;
std::experimental::u16string_view u16planet = u"Jupiter"sv;
std::experimental::u32string_view u32planet = U"Saturn"sv;
@@ -37,7 +43,7 @@ test01()
#ifdef _GLIBCXX_USE_WCHAR_T
VERIFY( wplanet == std::experimental::wstring_view(L"Venus") );
#endif
- VERIFY( u8planet == std::experimental::string_view(u8"Mars") );
+ VERIFY( u8planet == u8string_view(u8"Mars") );
VERIFY( u16planet == std::experimental::u16string_view(u"Jupiter") );
VERIFY( u32planet == std::experimental::u32string_view(U"Saturn") );
}
@@ -51,7 +57,7 @@ test02()
#ifdef _GLIBCXX_USE_WCHAR_T
std::experimental::wstring_view wplanet_cratered = L"Venus\0cratered"sv;
#endif
- std::experimental::string_view u8planet_cratered = u8"Mars\0cratered"sv;
+ u8string_view u8planet_cratered = u8"Mars\0cratered"sv;
std::experimental::u16string_view u16planet_cratered = u"Jupiter\0cratered"sv;
std::experimental::u32string_view u32planet_cratered = U"Saturn\0cratered"sv;
@@ -61,8 +67,7 @@ test02()
VERIFY( wplanet_cratered ==
std::experimental::wstring_view(L"Venus\0cratered", 14) );
#endif
- VERIFY( u8planet_cratered ==
- std::experimental::string_view(u8"Mars\0cratered", 13) );
+ VERIFY( u8planet_cratered == u8string_view(u8"Mars\0cratered", 13) );
VERIFY( u16planet_cratered ==
std::experimental::u16string_view(u"Jupiter\0cratered", 16) );
VERIFY( u32planet_cratered ==