[Toybox] i18n configuration in toy_singleinit

Jim Huang jserv at 0xlab.org
Wed Mar 25 10:51:57 PDT 2015


Hello list,

I just browsed file main.c and found the following:

static void toy_singleinit(struct toy_list *which, char *argv[])
{
  ..
  if (CFG_TOYBOX_I18N) setlocale(LC_ALL, "C"+!!(which->flags &
TOYFLAG_LOCALE));

clang-3.5 complains:

main.c:72:45: warning: adding 'int' to a string does not append to the
string [-Wstring-plus-int]
main.c:72:45: note: use array indexing to silence this warning

According to setlocale(3), on  startup  of the main program, the
portable "C" locale is selected as default.  A program may be made
portable to all locales by calling setlocale(LC_ALL, "").

It seems that Toybox would like to pass argument "C" or "" to
setlocale(). Is my understanding right? If so, how can we suppress the
warning?

Thanks,
-jserv

 1427305917.0


More information about the Toybox mailing list