Discussion:
nl_langinfo: Fix compilation error on Android
Bruno Haible
2018-05-14 01:04:11 UTC
Permalink
Another compilation error of a testdir for Android 4.3 is:

nl_langinfo.c:194:10: error: 'GROUPING' undeclared (first use in this function)
case GROUPING:
^
nl_langinfo.c:194:10: note: each undeclared identifier is reported only once for each function it appears in
nl_langinfo.c:323:10: error: 'INT_CURR_SYMBOL' undeclared (first use in this function)
case INT_CURR_SYMBOL:
^
nl_langinfo.c:325:10: error: 'MON_DECIMAL_POINT' undeclared (first use in this function)
case MON_DECIMAL_POINT:
^
nl_langinfo.c:327:10: error: 'MON_THOUSANDS_SEP' undeclared (first use in this function)
case MON_THOUSANDS_SEP:
^
nl_langinfo.c:329:10: error: 'MON_GROUPING' undeclared (first use in this function)
case MON_GROUPING:
^
nl_langinfo.c:331:10: error: 'POSITIVE_SIGN' undeclared (first use in this function)
case POSITIVE_SIGN:
^
nl_langinfo.c:333:10: error: 'NEGATIVE_SIGN' undeclared (first use in this function)
case NEGATIVE_SIGN:
^
nl_langinfo.c:335:10: error: 'FRAC_DIGITS' undeclared (first use in this function)
case FRAC_DIGITS:
^
nl_langinfo.c:337:10: error: 'INT_FRAC_DIGITS' undeclared (first use in this function)
case INT_FRAC_DIGITS:
^
nl_langinfo.c:339:10: error: 'P_CS_PRECEDES' undeclared (first use in this function)
case P_CS_PRECEDES:
^
nl_langinfo.c:341:10: error: 'N_CS_PRECEDES' undeclared (first use in this function)
case N_CS_PRECEDES:
^
nl_langinfo.c:343:10: error: 'P_SEP_BY_SPACE' undeclared (first use in this function)
case P_SEP_BY_SPACE:
^
nl_langinfo.c:345:10: error: 'N_SEP_BY_SPACE' undeclared (first use in this function)
case N_SEP_BY_SPACE:
^
nl_langinfo.c:347:10: error: 'P_SIGN_POSN' undeclared (first use in this function)
case P_SIGN_POSN:
^
nl_langinfo.c:349:10: error: 'N_SIGN_POSN' undeclared (first use in this function)
case N_SIGN_POSN:
^

This patch fixes it.


2018-05-13 Bruno Haible <***@clisp.org>

nl_langinfo: Fix compilation error on Android.
* lib/nl_langinfo.c (nl_langinfo): Define values for the items GROUPING,
INT_CURR_SYMBOL, etc. only if these items are defined.

diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c
index 90b26a2..ea26730 100644
--- a/lib/nl_langinfo.c
+++ b/lib/nl_langinfo.c
@@ -191,8 +191,10 @@ nl_langinfo (nl_item item)
return localeconv () ->decimal_point;
case THOUSEP:
return localeconv () ->thousands_sep;
+# ifdef GROUPING
case GROUPING:
return localeconv () ->grouping;
+# endif
/* nl_langinfo items of the LC_TIME category.
TODO: Really use the locale. */
case D_T_FMT:
@@ -320,6 +322,7 @@ nl_langinfo (nl_item item)
/* nl_langinfo items of the LC_MONETARY category. */
case CRNCYSTR:
return localeconv () ->currency_symbol;
+# ifdef INT_CURR_SYMBOL
case INT_CURR_SYMBOL:
return localeconv () ->int_curr_symbol;
case MON_DECIMAL_POINT:
@@ -348,6 +351,7 @@ nl_langinfo (nl_item item)
return & localeconv () ->p_sign_posn;
case N_SIGN_POSN:
return & localeconv () ->n_sign_posn;
+# endif
/* nl_langinfo items of the LC_MESSAGES category
TODO: Really use the locale. */
case YESEXPR:

Loading...