Hi Ed, > For FreeBSD specifically I'd rather conclude either that this is a bug > in our localeconv and fix it, or that more than one value for > l->grouping is permissible and change the test.
Looking at http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html section 7.3.4, subsection "LC_NUMERIC Category in the POSIX Locale", there is a table ┌────────────────┬───────────┬──────────────┬──────────────┬───────────┐ │ │ langinfo │ POSIX Locale │ localeconv() │ localedef │ ├────────────────┼───────────┼──────────────┼──────────────┼───────────┤ │ Item │ Constant │ Value │ Value │ Value │ ├────────────────┼───────────┼──────────────┼──────────────┼───────────┤ │ decimal_point │ RADIXCHAR │ "." │ "." │ . │ ├────────────────┼───────────┼──────────────┼──────────────┼───────────┤ │ thousands_sep │ THOUSEP │ N/A │ "" │ "" │ ├────────────────┼───────────┼──────────────┼──────────────┼───────────┤ │ grouping │ - │ N/A │ "" │ -1 │ └────────────────┴───────────┴──────────────┴──────────────┴───────────┘ which clearly says that the 'grouping' value in localeconv() should be the empty string. > I've raised a FreeBSD > pr for this: http://www.freebsd.org/cgi/query-pr.cgi?pr=172215 since > it looks to me like the most recent standards suggest grouping should > be "" rather than "\177". Thanks! > That said, the test passes for me with the following change: > > --- a/tests/test-localeconv.c > +++ b/tests/test-localeconv.c > @@ -37,15 +37,11 @@ main () > > -#if !(defined __FreeBSD__ || defined __sun) > - ASSERT (STREQ (l->grouping, "")); > -#endif > + ASSERT (l->grouping[0] == CHAR_MAX || STREQ (l->grouping, "")); The intent of this test is also to document to what extent a gnulib user can rely on the POSIX specification. Once someone has tested it on OpenIndiana, I'd suggest to write this code this way: #if !(defined __FreeBSD__ || defined __sun) /* POSIX specifies that localeconv()->grouping is "" in the C locale. */ ASSERT (STREQ (l->grouping, "")); #else /* On some platforms, the value is different. */ ASSERT (STREQ (l->grouping, "") || l->grouping[0] == CHAR_MAX); #endif Bruno