[git commit 0_9_30] This patch fixes locale-mbwc test failures when __UCLIBC_HAS_LOCALE__ is disabled and __UCLIBC_HAS_WCHAR__ is enabled. The only locale available when __UCLIBC_HAS_LOCALE__ is disabled is the C locale, the others locale are skipped.

Carmelo Amoroso carmelo.amoroso at st.com
Sat Oct 10 16:44:02 UTC 2009


commit: http://git.uclibc.org/uClibc/commit/?id=d30429d9432f883364ebb6f84951cc18d0474b3b
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/0_9_30

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono at st.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 test/locale-mbwc/tst_funcs.h |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/test/locale-mbwc/tst_funcs.h b/test/locale-mbwc/tst_funcs.h
index 552bed2..4bd0fb1 100644
--- a/test/locale-mbwc/tst_funcs.h
+++ b/test/locale-mbwc/tst_funcs.h
@@ -95,6 +95,7 @@ extern int result (FILE * fp, char res, const char *func, const char *loc,
 	for (loc = 0; strcmp (TST_HEAD (o_func).locale, TST_LOC_end); ++loc)
 
 
+#ifdef __UCLIBC_HAS_LOCALE__
 #define TST_HEAD_LOCALE(ofunc, s_func) \
   func_id = TST_HEAD (ofunc).func_id;					      \
   locale  = TST_HEAD (ofunc).locale;					      \
@@ -106,6 +107,29 @@ extern int result (FILE * fp, char res, const char *func, const char *loc,
       ++err_count;							      \
       continue;								      \
     }
+#else
+#define TST_HEAD_LOCALE(ofunc, s_func)					\
+  func_id = TST_HEAD (ofunc).func_id;					\
+  locale  = TST_HEAD (ofunc).locale;					\
+  if (strcmp(locale, "C") == 0)					\
+	{								\
+	if (setlocale (LC_ALL, locale) == NULL)						\
+		{									\
+		fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n",	\
+			locale);							\
+		result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale");	\
+		++err_count;						\
+		continue;						\
+		}							\
+	}								\
+  else									\
+  	{								\
+		fprintf (stderr, "Warning : locale %s unsupported\n\n",		\
+			locale);						\
+		result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "unsupported");	\
+		continue;						      	\
+	}
+#endif
 
 #define TST_DO_REC(ofunc) \
 	for (rec=0; !TST_IS_LAST (ofunc); ++rec)
-- 
1.6.3.3



More information about the uClibc-cvs mailing list