On 13.08.2013 03:31, G M wrote:
Hello

Could someone please consider this patch to libcxx. it's an improvement and
replacement to my prior patch that has yet to be committed. More details
about this and the prior patch can be found in previous messages with the
same subject line as this message.

You can't just intentionally break other platforms in the process. You should also mention that it's for Mingw. The attached patch restores the previous behavior. But it doesn't link, at least for me. How are you building libc++ with Mingw?

-Nico
>From 77cd95c91a29b56f67f86a4a742def6026c2edcc Mon Sep 17 00:00:00 2001
From: Nico Rieck <[email protected]>
Date: Fri, 9 Aug 2013 16:24:31 +0200
Subject: [PATCH] mingw

---
 include/__config              |  4 +++-
 include/__locale              |  2 +-
 include/locale                |  6 +++---
 src/locale.cpp                | 16 ++++++++--------
 src/support/win32/support.cpp |  2 ++
 5 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/include/__config b/include/__config
index b1f0d95..0fccaa0 100644
--- a/include/__config
+++ b/include/__config
@@ -80,7 +80,9 @@
 #  if defined(_MSC_VER) && !defined(__clang__)
 #    define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
 #  endif
-#  define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
+#  if !defined(__GNUC__)
+#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
+#  endif
 #endif  // _WIN32
 
 #ifdef __linux__
diff --git a/include/__locale b/include/__locale
index 93147ec..a94281e 100644
--- a/include/__locale
+++ b/include/__locale
@@ -19,7 +19,7 @@
 #include <cstdint>
 #include <cctype>
 #include <locale.h>
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 # include <support/win32/locale_win32.h>
 #elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(EMSCRIPTEN)
 # include <xlocale.h>
diff --git a/include/locale b/include/locale
index 00a275f..94ec56a 100644
--- a/include/locale
+++ b/include/locale
@@ -186,11 +186,11 @@ template <class charT> class messages_byname;
 #endif
 #include <cstdlib>
 #include <ctime>
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include <support/win32/locale_win32.h>
-#else // _LIBCPP_MSVCRT
+#else // _LIBCPP_MSVCRT || __MINGW32__
 #include <nl_types.h>
-#endif  // !_LIBCPP_MSVCRT
+#endif  // !_LIBCPP_MSVCRT && !__MINGW32__
 
 #ifdef __APPLE__
 #include <Availability.h>
diff --git a/src/locale.cpp b/src/locale.cpp
index d95d0c9..4028acd 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -26,7 +26,7 @@
 #include "cstring"
 #include "cwctype"
 #include "__sso_allocator"
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include <support/win32/locale_win32.h>
 #else // _LIBCPP_MSVCRT
 #include <langinfo.h>
@@ -1009,7 +1009,7 @@ ctype<char>::classic_table()  _NOEXCEPT
     return __cloc()->__ctype_b;
 #elif __sun__
     return __ctype_mask;
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
     return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
@@ -5848,7 +5848,7 @@ moneypunct_byname<char, true>::init(const char* nm)
         __frac_digits_ = lc->int_frac_digits;
     else
         __frac_digits_ = base::do_frac_digits();
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
     if (lc->p_sign_posn == 0)
 #else // _LIBCPP_MSVCRT
     if (lc->int_p_sign_posn == 0)
@@ -5856,7 +5856,7 @@ moneypunct_byname<char, true>::init(const char* nm)
         __positive_sign_ = "()";
     else
         __positive_sign_ = lc->positive_sign;
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
     if(lc->n_sign_posn == 0)
 #else // _LIBCPP_MSVCRT
     if (lc->int_n_sign_posn == 0)
@@ -5868,7 +5868,7 @@ moneypunct_byname<char, true>::init(const char* nm)
     // the same places in curr_symbol since there's no way to
     // represent anything else.
     string_type __dummy_curr_symbol = __curr_symbol_;
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
     __init_pat(__pos_format_, __dummy_curr_symbol, true,
                lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
     __init_pat(__neg_format_, __curr_symbol_, true,
@@ -6007,7 +6007,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
         __frac_digits_ = lc->int_frac_digits;
     else
         __frac_digits_ = base::do_frac_digits();
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
     if (lc->p_sign_posn == 0)
 #else // _LIBCPP_MSVCRT
     if (lc->int_p_sign_posn == 0)
@@ -6027,7 +6027,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
         wbe = wbuf + j;
         __positive_sign_.assign(wbuf, wbe);
     }
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
     if (lc->n_sign_posn == 0)
 #else // _LIBCPP_MSVCRT
     if (lc->int_n_sign_posn == 0)
@@ -6051,7 +6051,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
     // the same places in curr_symbol since there's no way to
     // represent anything else.
     string_type __dummy_curr_symbol = __curr_symbol_;
-#ifdef _LIBCPP_MSVCRT
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
     __init_pat(__pos_format_, __dummy_curr_symbol, true,
                lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
     __init_pat(__neg_format_, __curr_symbol_, true,
diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp
index 4215a70..09882d4 100644
--- a/src/support/win32/support.cpp
+++ b/src/support/win32/support.cpp
@@ -24,6 +24,8 @@ namespace { // Private
 }
 // Some of these functions aren't standard or if they conform, the name does not.
 
+int vasprintf( char **sptr, const char *__restrict format, va_list ap );
+
 int asprintf(char **sptr, const char *__restrict format, ...)
 {
     va_list ap;
-- 
1.8.1.msysgit.1

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to