mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
win32: temporarily disable setting locale on 14+
The locale structures have been made opaque in CRT 14+. This currently prevents building libc++ for Windows. We can re-enable this in the future when we have replicated the structure to access the private field for the name (unless there exists a better supported mechanism to query the name of a locale given the locale_t). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,6 +13,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include <crtversion.h>
|
||||||
|
|
||||||
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
|
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
|
||||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||||
|
|
||||||
@@ -29,7 +31,9 @@ locale_t uselocale( locale_t newloc )
|
|||||||
// uselocale sets the thread's locale by definition, so unconditionally use thread-local locale
|
// uselocale sets the thread's locale by definition, so unconditionally use thread-local locale
|
||||||
_configthreadlocale( _ENABLE_PER_THREAD_LOCALE );
|
_configthreadlocale( _ENABLE_PER_THREAD_LOCALE );
|
||||||
// uselocale sets all categories
|
// uselocale sets all categories
|
||||||
|
#if _VC_CRT_MAJOR_VERSION < 14
|
||||||
setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale );
|
setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale );
|
||||||
|
#endif
|
||||||
// uselocale returns the old locale_t
|
// uselocale returns the old locale_t
|
||||||
return old_locale;
|
return old_locale;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user