comparison tests/test-locale.c @ 16717:474c0712e7aa

locale: Provide a working 'struct lconv'. * lib/locale.in.h (lconv): Override if REPLACE_STRUCT_LCONV is 1. * m4/locale_h.m4 (gl_LOCALE_H): Set REPLACE_STRUCT_LCONV to 1 if 'struct lconv' does not even contain decimal_point. (gl_LOCALE_H_DEFAULTS): Initialize REPLACE_STRUCT_LCONV. * modules/locale (Makefile.am): Substitute REPLACE_STRUCT_LCONV. * tests/test-locale.c (main): Check that 'struct lconv' is complete. * doc/posix-headers/locale.texi: Mention the problems with 'struct lconv'. Reported by Gianluigi Tiesi <sherpya@netfarm.it>.
author Bruno Haible <bruno@clisp.org>
date Sun, 25 Mar 2012 13:22:41 +0200
parents 8250f2777afc
children 8d5d2ed0afb0
comparison
equal deleted inserted replaced
16716:079fb1e73828 16717:474c0712e7aa
36 #if HAVE_NEWLOCALE 36 #if HAVE_NEWLOCALE
37 /* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined. */ 37 /* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined. */
38 locale_t b = LC_GLOBAL_LOCALE; 38 locale_t b = LC_GLOBAL_LOCALE;
39 #endif 39 #endif
40 40
41 /* Check that the 'struct lconv' type is defined. */
42 struct lconv l;
43 int ls;
44
41 /* Check that NULL can be passed through varargs as a pointer type, 45 /* Check that NULL can be passed through varargs as a pointer type,
42 per POSIX 2008. */ 46 per POSIX 2008. */
43 verify (sizeof NULL == sizeof (void *)); 47 verify (sizeof NULL == sizeof (void *));
44 48
45 int 49 int
46 main () 50 main ()
47 { 51 {
52 /* Check that 'struct lconv' has the ISO C and POSIX specified members. */
53 ls += sizeof (*l.decimal_point);
54 ls += sizeof (*l.thousands_sep);
55 ls += sizeof (*l.grouping);
56 ls += sizeof (*l.mon_decimal_point);
57 ls += sizeof (*l.mon_thousands_sep);
58 ls += sizeof (*l.mon_grouping);
59 ls += sizeof (*l.positive_sign);
60 ls += sizeof (*l.negative_sign);
61 ls += sizeof (*l.currency_symbol);
62 ls += sizeof (l.frac_digits);
63 ls += sizeof (l.p_cs_precedes);
64 ls += sizeof (l.p_sign_posn);
65 ls += sizeof (l.p_sep_by_space);
66 ls += sizeof (l.n_cs_precedes);
67 ls += sizeof (l.n_sign_posn);
68 ls += sizeof (l.n_sep_by_space);
69 ls += sizeof (*l.int_curr_symbol);
70 ls += sizeof (l.int_frac_digits);
71 #if 0
72 ls += sizeof (l.int_p_cs_precedes);
73 ls += sizeof (l.int_p_sign_posn);
74 ls += sizeof (l.int_p_sep_by_space);
75 ls += sizeof (l.int_n_cs_precedes);
76 ls += sizeof (l.int_n_sign_posn);
77 ls += sizeof (l.int_n_sep_by_space);
78 #endif
79
48 return 0; 80 return 0;
49 } 81 }