From b1298344f0c221c382a95af689f7f3ecd864f531 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:45:57 +0400
Subject: [PATCH 06/46] uclibc-locale-wchar_fix

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Upstream-Status: Pending
---
 libstdc++-v3/config/locale/uclibc/monetary_members.cc |  4 ++--
 libstdc++-v3/config/locale/uclibc/numeric_members.cc  | 13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/config/locale/uclibc/monetary_members.cc b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
index 2e6f80a..31ebb9f 100644
--- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
@@ -401,7 +401,7 @@ namespace std
 # ifdef __UCLIBC_HAS_XLOCALE__
 	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
 	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-# else
+# elif defined __UCLIBC_HAS_LOCALE__
 	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
 	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
 # endif
@@ -556,7 +556,7 @@ namespace std
 # ifdef __UCLIBC_HAS_XLOCALE__
 	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
 	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-# else
+# elif defined __UCLIBC_HAS_LOCALE__
 	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
 	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
 # endif
diff --git a/libstdc++-v3/config/locale/uclibc/numeric_members.cc b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
index 2c70642..d5c8961 100644
--- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
@@ -127,12 +127,25 @@ namespace std
 	{
 	  // Named locale.
 	  // NB: In the GNU model wchar_t is always 32 bit wide.
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix this... should be numeric
+#endif
+#ifdef __UCLIBC__
+# ifdef __UCLIBC_HAS_XLOCALE__
+	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+# elif defined __UCLIBC_HAS_LOCALE__
+	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+# endif
+#else
 	  union { char *__s; wchar_t __w; } __u;
 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
 	  _M_data->_M_decimal_point = __u.__w;
 
 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
 	  _M_data->_M_thousands_sep = __u.__w;
+#endif
 
 	  if (_M_data->_M_thousands_sep == L'\0')
 	    _M_data->_M_grouping = "";
-- 
2.6.3

