[libcxx] r305000 - [libcxx] [test] Update locale names for Windows.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 8 11:22:04 PDT 2017


Author: stl_msft
Date: Thu Jun  8 13:22:03 2017
New Revision: 305000

URL: http://llvm.org/viewvc/llvm-project?rev=305000&view=rev
Log:
[libcxx] [test] Update locale names for Windows.

locale.codecvt.byname/ctor_char.pass.cpp:
This test used to use "en_US" as a plain string instead of using platform_support.
Need to fix this because MS STL expects "en-US" instead.

platform_support.h:
These are the legacy Windows locale names. Should use IETF tags instead.
I've also added en_US, since a test was using that as a locale string as well.

msvc_stdlib_force_include.hpp:
Remove _MSVC_STL_VER. The libraries will directly define _MSVC_STL_VERSION in the future.

Fixes D29351.

Modified:
    libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp
    libcxx/trunk/test/support/msvc_stdlib_force_include.hpp
    libcxx/trunk/test/support/platform_support.h

Modified: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp?rev=305000&r1=304999&r2=305000&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp Thu Jun  8 13:22:03 2017
@@ -17,6 +17,8 @@
 #include <locale>
 #include <cassert>
 
+#include "platform_support.h"
+
 typedef std::codecvt_byname<char, char, std::mbstate_t> F;
 
 class my_facet
@@ -38,12 +40,12 @@ int my_facet::count = 0;
 int main()
 {
     {
-        std::locale l(std::locale::classic(), new my_facet("en_US"));
+        std::locale l(std::locale::classic(), new my_facet(LOCALE_en_US));
         assert(my_facet::count == 1);
     }
     assert(my_facet::count == 0);
     {
-        my_facet f("en_US", 1);
+        my_facet f(LOCALE_en_US, 1);
         assert(my_facet::count == 1);
         {
             std::locale l(std::locale::classic(), &f);
@@ -53,12 +55,12 @@ int main()
     }
     assert(my_facet::count == 0);
     {
-        std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
+        std::locale l(std::locale::classic(), new my_facet(std::string(LOCALE_en_US)));
         assert(my_facet::count == 1);
     }
     assert(my_facet::count == 0);
     {
-        my_facet f(std::string("en_US"), 1);
+        my_facet f(std::string(LOCALE_en_US), 1);
         assert(my_facet::count == 1);
         {
             std::locale l(std::locale::classic(), &f);

Modified: libcxx/trunk/test/support/msvc_stdlib_force_include.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/msvc_stdlib_force_include.hpp?rev=305000&r1=304999&r2=305000&view=diff
==============================================================================
--- libcxx/trunk/test/support/msvc_stdlib_force_include.hpp (original)
+++ libcxx/trunk/test/support/msvc_stdlib_force_include.hpp Thu Jun  8 13:22:03 2017
@@ -28,11 +28,6 @@
     #error This header may not be used when targeting libc++
 #endif
 
-// Indicates that we are using the MSVC standard library.
-#ifndef _MSVC_STL_VER
-    #define _MSVC_STL_VER 42
-#endif
-
 #ifndef _LIBCXX_IN_DEVCRT
 struct AssertionDialogAvoider {
     AssertionDialogAvoider() {

Modified: libcxx/trunk/test/support/platform_support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/platform_support.h?rev=305000&r1=304999&r2=305000&view=diff
==============================================================================
--- libcxx/trunk/test/support/platform_support.h (original)
+++ libcxx/trunk/test/support/platform_support.h Thu Jun  8 13:22:03 2017
@@ -19,16 +19,18 @@
 #ifdef _WIN32
 // WARNING: Windows does not support UTF-8 codepages.
 // Locales are "converted" using http://docs.moodle.org/dev/Table_of_locales
-#define LOCALE_en_US_UTF_8     "English_United States.1252"
-#define LOCALE_cs_CZ_ISO8859_2 "Czech_Czech Republic.1250"
-#define LOCALE_fr_FR_UTF_8     "French_France.1252"
-#define LOCALE_fr_CA_ISO8859_1 "French_Canada.1252"
-#define LOCALE_ru_RU_UTF_8     "Russian_Russia.1251"
-#define LOCALE_zh_CN_UTF_8     "Chinese_China.936"
+#define LOCALE_en_US           "en-US"
+#define LOCALE_en_US_UTF_8     "en-US"
+#define LOCALE_cs_CZ_ISO8859_2 "cs-CZ"
+#define LOCALE_fr_FR_UTF_8     "fr-FR"
+#define LOCALE_fr_CA_ISO8859_1 "fr-CA"
+#define LOCALE_ru_RU_UTF_8     "ru-RU"
+#define LOCALE_zh_CN_UTF_8     "zh-CN"
 #elif defined(__CloudABI__)
 // Timezones are integrated into locales through LC_TIMEZONE_MASK on
 // CloudABI. LC_ALL_MASK can only be used if a timezone has also been
 // provided. UTC should be all right.
+#define LOCALE_en_US           "en_US"
 #define LOCALE_en_US_UTF_8     "en_US.UTF-8 at UTC"
 #define LOCALE_fr_FR_UTF_8     "fr_FR.UTF-8 at UTC"
 #define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO-8859-1 at UTC"
@@ -36,6 +38,7 @@
 #define LOCALE_ru_RU_UTF_8     "ru_RU.UTF-8 at UTC"
 #define LOCALE_zh_CN_UTF_8     "zh_CN.UTF-8 at UTC"
 #else
+#define LOCALE_en_US           "en_US"
 #define LOCALE_en_US_UTF_8     "en_US.UTF-8"
 #define LOCALE_fr_FR_UTF_8     "fr_FR.UTF-8"
 #ifdef __linux__




More information about the cfe-commits mailing list