summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorjimb <jimb@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-12-11 23:38:31 +0000
committerjimb <jimb@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-12-11 23:38:31 +0000
commit34faad38b87a823ca93058804c85114dc06f9c15 (patch)
tree55a6d326543682b0d4503816f7f707082a169af7 /libc/stdlib
parent445e5f283d689b6681f3944885c29f6486ec82d3 (diff)
Clean up test results with OPTION_EGLIBC_LOCALE_CODE disabled.
* debug/tst-chk1.c: Omit locale tests when group is disabled. * intl/Makefile (tests): Put tst-translit, tst-gettext2, tst-codeset, and tst-gettext3 in the group. * libio/Makefile (tests): Put tst-fgetws, tst-fopenloc, tst-setvbuf1, tst-ungetwc1, tst-ungetwc2, bug-ftell, bug-ungetwc2, tst-widetext, and tst-fopenloc in the group; some were formerly in OPTION_POSIX_WIDE_CHAR_DEVICE_IO. * nptl/Makefile (tests): Put tst-locale1 in the group. * posix/Makefile (tests): Put bug-regex17, bug-regex18, bug-regex20, bug-regex23, and bug-regex26 in the group. (tst-rxspencer): Pass --utf8 only when the group is enabled. * posix/bug-regex6.c: Omit non-C locale tests when group is disabled. * stdio-common/Makefile (tests): Put bug14 and scanf13 in the group. * stdlib/Makefile (tests): Put tst-strtod4, tst-strtod5, and testmb2 in the group. * stdlib/tst-strtod.c: Omit locale tests when group is disabled. * string/tst-strxfrm.c, string/tst-strxfrm2.c: Same. * time/Makefile (tests): Put tst-ftime_l in the group. Fix code broken by OPTION_EGLIBC_LOCALE_CODE. * posix/regex_internal.h: #include <gnu/option-groups.h>. (string_mb_cur_max, dfa_mb_cur_max): New macros for accessing the 'mb_cur_max' fields of re_string_t and re_dfa_t, whose values can be constant when the group is disabled. Use them throughout. * posix/regex_internal.c: Use string_mb_cur_max and dfa_mb_cur_max as appropriate. * posix/regcomp.c: Same. (re_compile_fastmap_iter): Process COMPLEX_BRACKET nodes only when the group is enabled. (init_dfa): When the group is disabled, clear map_notascii. (parse_bracket_exp): Process MB_CHAR elements only when the group is enabled. Otherwise, fix 'nrules' at zero, for the compiler's benefit, and assume the collation sequence is the identity. (parse_bracket_element): Create MB_CHAR elements only when the group is enabled. (build_equiv_class): When the group is disabled, we know there will be no collation rules. (build_charclass): When the group is disabled, do not try to process references to wide character categories accessed via 'wctype'. * posix/regexec.c: Use string_mb_cur_max and dfa_mb_cur_max as appropriate. (find_collation_sequence_value): Define function only when the group is enabled. (check_node_accept_bytes): Check character against 'wctype' style classes only if group is enabled. When the group is disabled, Skip collation-rule-based matching. * posix/fnmatch.c: #include <gnu/option-groups.h>. Define HANDLE_MULTIBYTE only if when OPTION_EGLIBC_LOCALE_CODE is enabled. * posix/fnmatch_loop.c (FCT (internal_fnmatch or internal_fnwmatch)): If the group is disabled, assume that the collation sequence is the identity. * stdio-common/_i18n_number.h (_i18n_number_rewrite): Provide only a trivial definition when the group is disabled. * stdio-common/vfprintf.c: #include <gnu/option-groups.h>. (LOCALE_SUPPORT): Define. (vfprintf): Consult it as appropriate. * stdio-common/vfscanf.c: #include <gnu/option-groups.h>. (_IO_vfwscanf): If the group is disabled, don't try to consult the locale for decimal point and thousands separator characters, or for custom digits. * stdlib/strtod_l.c (__STRTOF_INTERNAL): Don't try to consult the locale's numeric settings. * string/strxfrm_l.c, string/strcoll_l.c: Don't try to consult the locale's collation settings. git-svn-id: svn://svn.eglibc.org/trunk@4501 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/Makefile6
-rw-r--r--libc/stdlib/strtod_l.c13
-rw-r--r--libc/stdlib/tst-strtod.c5
3 files changed, 21 insertions, 3 deletions
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index 28097c1d3..47c5a9429 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -73,11 +73,11 @@ tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
test-canon test-canon2 tst-strtoll tst-environ \
tst-xpg-basename tst-random tst-random2 tst-bsearch \
tst-limits tst-rand48 bug-strtod tst-setcontext \
- test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
+ test-a64l tst-qsort tst-system bug-strtod2 \
tst-atof1 tst-atof2 tst-strtod2 tst-rand48-2 \
- tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2
+ tst-makecontext tst-qsort2
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
- += tst-strtod3
+ += tst-strtod3 tst-strtod4 tst-strtod5 testmb2
include ../Makeconfig
ifeq ($(build-shared),yes)
diff --git a/libc/stdlib/strtod_l.c b/libc/stdlib/strtod_l.c
index 86b408e1f..4f43f3853 100644
--- a/libc/stdlib/strtod_l.c
+++ b/libc/stdlib/strtod_l.c
@@ -19,6 +19,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <gnu/option-groups.h>
#include <xlocale.h>
extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
@@ -480,6 +481,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* Used in several places. */
int cnt;
+#if __OPTION_EGLIBC_LOCALE_CODE
struct locale_data *current = loc->__locales[LC_NUMERIC];
if (__builtin_expect (group, 0))
@@ -518,6 +520,17 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
decimal_len = strlen (decimal);
assert (decimal_len > 0);
#endif
+#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
+ /* Hard-code values from the 'C' locale. */
+ grouping = NULL;
+#ifdef USE_WIDE_CHAR
+ decimal = L'.';
+# define decimal_len 1
+#else
+ decimal = ".";
+ decimal_len = 1;
+#endif
+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
/* Prepare number representation. */
exponent = 0;
diff --git a/libc/stdlib/tst-strtod.c b/libc/stdlib/tst-strtod.c
index 628e40ca3..e97a05701 100644
--- a/libc/stdlib/tst-strtod.c
+++ b/libc/stdlib/tst-strtod.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <math.h>
+#include <gnu/option-groups.h>
struct ltest
{
@@ -174,7 +175,9 @@ main (int argc, char ** argv)
status |= long_dbl ();
+#if __OPTION_EGLIBC_LOCALE_CODE
status |= locale_test ();
+#endif
return status ? EXIT_FAILURE : EXIT_SUCCESS;
}
@@ -217,6 +220,7 @@ long_dbl (void)
return 0;
}
+#if __OPTION_EGLIBC_LOCALE_CODE
/* Perform a few tests in a locale with thousands separators. */
static int
locale_test (void)
@@ -274,3 +278,4 @@ locale_test (void)
return result;
}
+#endif /* __OPTION_EGLIBC_LOCALE_CODE */