summaryrefslogtreecommitdiffstats
path: root/libcxx/src/support
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2017-11-23 10:38:18 +0000
committerMartin Storsjo <martin@martin.st>2017-11-23 10:38:18 +0000
commit771edc7949f6738bad0763fdbdd3ccef3eed18ec (patch)
tree5f751f9ad1a9f7ad4078fcff367346adf428b308 /libcxx/src/support
parent391804f54b2a98f163b685ee72f8f890c8094405 (diff)
downloadbcm5719-llvm-771edc7949f6738bad0763fdbdd3ccef3eed18ec.tar.gz
bcm5719-llvm-771edc7949f6738bad0763fdbdd3ccef3eed18ec.zip
Allow to set locale on Windows.
Fix the problem PR31516 with setting locale on Windows by wrapping _locale_t with a pointer-like class. Reduces 74 test failures in std/localization test suite to 47 test failures (on llvm clang, Visual Studio 2015). Number of test failures doesn't depend on the platform (x86 or x64). Patch by Andrey Khalyavin. Differential Revision: https://reviews.llvm.org/D40181 llvm-svn: 318902
Diffstat (limited to 'libcxx/src/support')
-rw-r--r--libcxx/src/support/win32/locale_win32.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/libcxx/src/support/win32/locale_win32.cpp b/libcxx/src/support/win32/locale_win32.cpp
index 13a6eaedacb..fdca7efff06 100644
--- a/libcxx/src/support/win32/locale_win32.cpp
+++ b/libcxx/src/support/win32/locale_win32.cpp
@@ -18,21 +18,7 @@ using std::__libcpp_locale_guard;
// FIXME: base currently unused. Needs manual work to construct the new locale
locale_t newlocale( int mask, const char * locale, locale_t /*base*/ )
{
- return _create_locale( mask, locale );
-}
-
-locale_t uselocale( locale_t newloc )
-{
- locale_t old_locale = _get_current_locale();
- if ( newloc == NULL )
- return old_locale;
- // uselocale sets the thread's locale by definition, so unconditionally use thread-local locale
- _configthreadlocale( _ENABLE_PER_THREAD_LOCALE );
- // uselocale sets all categories
- // disable setting locale on Windows temporarily because the structure is opaque (PR31516)
- //setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale );
- // uselocale returns the old locale_t
- return old_locale;
+ return {_create_locale( LC_ALL, locale ), locale};
}
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
OpenPOWER on IntegriCloud