[libcxx] r263020 - Split locale management out of locale_win32. NFCI

Ben Craig via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 9 07:49:59 PST 2016


Author: bcraig
Date: Wed Mar  9 09:49:59 2016
New Revision: 263020

URL: http://llvm.org/viewvc/llvm-project?rev=263020&view=rev
Log:
Split locale management out of locale_win32. NFCI

For the locale refactor, the locale management functions (newlocale,
freelocale, uselocale) are needed in a separate header from the various _l
functions. This is because some platforms implement the _l functions in terms
of a locale switcher RAII helper, and the locale switcher RAII helper needs
the locale management functions. This patch helps pave the way by getting all
the functions in the right files, so that later diffs aren't completely
horrible.

Unfortunately, the Windows, Cygwin, and MinGW builds seemed to have
bit-rotted, so I wasn't able to test this completely. I don't think I made
things any worse than they already are though.

http://reviews.llvm.org/D17419

Added:
    libcxx/trunk/include/support/win32/locale_mgmt_win32.h
Modified:
    libcxx/trunk/include/support/win32/locale_win32.h

Added: libcxx/trunk/include/support/win32/locale_mgmt_win32.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_mgmt_win32.h?rev=263020&view=auto
==============================================================================
--- libcxx/trunk/include/support/win32/locale_mgmt_win32.h (added)
+++ libcxx/trunk/include/support/win32/locale_mgmt_win32.h Wed Mar  9 09:49:59 2016
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------- support/win32/locale_mgmt_win32.h ------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H
+#define _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H
+
+#include <xlocinfo.h> // _locale_t
+#define locale_t _locale_t
+#define LC_COLLATE_MASK _M_COLLATE
+#define LC_CTYPE_MASK _M_CTYPE
+#define LC_MONETARY_MASK _M_MONETARY
+#define LC_NUMERIC_MASK _M_NUMERIC
+#define LC_TIME_MASK _M_TIME
+#define LC_MESSAGES_MASK _M_MESSAGES
+#define LC_ALL_MASK (  LC_COLLATE_MASK \
+                     | LC_CTYPE_MASK \
+                     | LC_MESSAGES_MASK \
+                     | LC_MONETARY_MASK \
+                     | LC_NUMERIC_MASK \
+                     | LC_TIME_MASK )
+#define freelocale _free_locale
+// FIXME: base currently unused. Needs manual work to construct the new locale
+locale_t newlocale( int mask, const char * locale, locale_t base );
+locale_t uselocale( locale_t newloc );
+
+#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H

Modified: libcxx/trunk/include/support/win32/locale_win32.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_win32.h?rev=263020&r1=263019&r2=263020&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/locale_win32.h (original)
+++ libcxx/trunk/include/support/win32/locale_win32.h Wed Mar  9 09:49:59 2016
@@ -15,26 +15,10 @@
 extern "C" unsigned short  __declspec(dllimport) _ctype[];
 
 #include "support/win32/support.h"
+#include "support/win32/locale_mgmt_win32.h"
 #include <stdio.h>
 #include <memory>
-#include <xlocinfo.h> // _locale_t
-#define locale_t _locale_t
-#define LC_COLLATE_MASK _M_COLLATE
-#define LC_CTYPE_MASK _M_CTYPE
-#define LC_MONETARY_MASK _M_MONETARY
-#define LC_NUMERIC_MASK _M_NUMERIC
-#define LC_TIME_MASK _M_TIME
-#define LC_MESSAGES_MASK _M_MESSAGES
-#define LC_ALL_MASK (  LC_COLLATE_MASK \
-                     | LC_CTYPE_MASK \
-                     | LC_MESSAGES_MASK \
-                     | LC_MONETARY_MASK \
-                     | LC_NUMERIC_MASK \
-                     | LC_TIME_MASK )
-#define freelocale _free_locale
-// FIXME: base currently unused. Needs manual work to construct the new locale
-locale_t newlocale( int mask, const char * locale, locale_t base );
-locale_t uselocale( locale_t newloc );
+
 lconv *localeconv_l( locale_t loc );
 size_t mbrlen_l( const char *__restrict s, size_t n,
                  mbstate_t *__restrict ps, locale_t loc);




More information about the cfe-commits mailing list