aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-08-29 11:05:55 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-08-29 11:05:55 +0100
commit9111b0838433457b28e72e646fbe04054cf64780 (patch)
tree08c6566ab2bbc235a191fc2ba0d3d53fbc6f57b5 /libstdc++-v3
parentfb9cb5369dff9afae40dec2224e485625c425a67 (diff)
downloadgcc-9111b0838433457b28e72e646fbe04054cf64780.zip
gcc-9111b0838433457b28e72e646fbe04054cf64780.tar.gz
gcc-9111b0838433457b28e72e646fbe04054cf64780.tar.bz2
PR libstdc++/31413 fix test failure on Debian systems
Debian uses a different D_FMT string for the zh_TW.UTF-8 locale, which caused this test to fail. Try to detect the Debian format and adjust the input being tested. PR libstdc++/31413 * testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Check D_FMT string for alternative format. From-SVN: r263948
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/4.cc24
2 files changed, 29 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b6ae0e5..4777846 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-29 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/31413
+ * testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Check D_FMT
+ string for alternative format.
+
2018-08-28 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/87116
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/4.cc
index 21e51d2..a532c93 100644
--- a/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/4.cc
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_date/wchar_t/4.cc
@@ -25,6 +25,8 @@
#include <sstream>
#include <testsuite_hooks.h>
+static bool debian_date_format();
+
void test01()
{
using namespace std;
@@ -46,7 +48,7 @@ void test01()
0x5e74, L'1', L'2', 0x6708, L'1', L'7',
0x65e5 , 0x0 };
- iss.str(wstr);
+ iss.str(debian_date_format() ? wstr+2 : wstr);
iterator_type is_it01(iss);
tm time01;
tim_get.get_date(is_it01, end, iss, errorstate, &time01);
@@ -56,6 +58,26 @@ void test01()
VERIFY( time01.tm_year == 103 );
}
+#include <locale.h>
+#if __has_include(<langinfo.h>)
+# include <langinfo.h>
+#endif
+
+static bool debian_date_format()
+{
+#ifdef D_FMT
+ if (setlocale(LC_TIME, "zh_TW.UTF-8") != NULL)
+ {
+ // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31413
+ // and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71641#c2
+ if (*nl_langinfo(D_FMT) == '%')
+ return true;
+ setlocale(LC_TIME, "C");
+ }
+#endif
+ return false;
+}
+
int main()
{
test01();