[libcxx] r290835 - win32: temporarily disable setting locale on 14+

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 2 13:09:17 PST 2017


Author: compnerd
Date: Mon Jan  2 15:09:16 2017
New Revision: 290835

URL: http://llvm.org/viewvc/llvm-project?rev=290835&view=rev
Log:
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).

Modified:
    libcxx/trunk/src/support/win32/locale_win32.cpp

Modified: libcxx/trunk/src/support/win32/locale_win32.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/win32/locale_win32.cpp?rev=290835&r1=290834&r2=290835&view=diff
==============================================================================
--- libcxx/trunk/src/support/win32/locale_win32.cpp (original)
+++ libcxx/trunk/src/support/win32/locale_win32.cpp Mon Jan  2 15:09:16 2017
@@ -13,6 +13,8 @@
 #include <memory>
 #include <type_traits>
 
+#include <crtversion.h>
+
 typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
 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
     _configthreadlocale( _ENABLE_PER_THREAD_LOCALE );
     // uselocale sets all categories
+#if _VC_CRT_MAJOR_VERSION < 14
     setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale );
+#endif
     // uselocale returns the old locale_t
     return old_locale;
 }




More information about the cfe-commits mailing list