This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix missing declaration of LC_CTYPE nonascii-case element
- From: Andreas Schwab <schwab at suse dot de>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 22 Jul 2013 12:28:08 +0200
- Subject: Re: [PATCH] Fix missing declaration of LC_CTYPE nonascii-case element
- References: <mvmr4exeg0e dot fsf at hawking dot suse dot de> <51E86B7A dot 40207 at redhat dot com>
"Carlos O'Donell" <carlos@redhat.com> writes:
> While this looks correct to me I'm curious why we didn't detect
> it when Ulrich fixed support for non-ascii locales in x86-64 in
> 2011?
The strcasecmp tests were never run for non-C locales.
Andreas.
[BZ #15736]
* locale/categories.def (LC_CTYPE): Add "nonascii-case" element.
* string/Makefile (test-strcasecmp-ENV)
(test-strcasecmp-ifunc-ENV): Define.
* string/test-strcasecmp.c (test_main): Run tests in several
locales.
---
locale/categories.def | 1 +
string/Makefile | 2 ++
string/test-strcasecmp.c | 26 ++++++++++++++++++++++----
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/locale/categories.def b/locale/categories.def
index 9a89d2d..8c25378 100644
--- a/locale/categories.def
+++ b/locale/categories.def
@@ -133,6 +133,7 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE_LEN, "ctype-translit-ignore-len", std, word)
DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE, "ctype-translit-ignore", std, string)
DEFINE_ELEMENT (_NL_CTYPE_MAP_TO_NONASCII, "map-to-nonascii", std, word)
+ DEFINE_ELEMENT (_NL_CTYPE_NONASCII_CASE, "nonascii-case", std, word)
), _nl_postload_ctype)
diff --git a/string/Makefile b/string/Makefile
index 0237edd..45a53a9 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -65,6 +65,8 @@ noinl-tester-ENV = LANGUAGE=C
tst-strxfrm-ENV = LOCPATH=$(common-objpfx)localedata
tst-strxfrm2-ENV = LOCPATH=$(common-objpfx)localedata
bug-strcoll1-ENV = LOCPATH=$(common-objpfx)localedata
+test-strcasecmp-ENV = LOCPATH=$(common-objpfx)localedata
+test-strcasecmp-ifunc-ENV = LOCPATH=$(common-objpfx)localedata
CFLAGS-inl-tester.c = -fno-builtin
CFLAGS-noinl-tester.c = -fno-builtin
CFLAGS-tst-strlen.c = -fno-builtin
diff --git a/string/test-strcasecmp.c b/string/test-strcasecmp.c
index f321501..bdfccca 100644
--- a/string/test-strcasecmp.c
+++ b/string/test-strcasecmp.c
@@ -17,6 +17,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <locale.h>
#include <ctype.h>
#define TEST_MAIN
#define TEST_NAME "strcasecmp"
@@ -206,14 +207,18 @@ do_random_tests (void)
}
}
-int
-test_main (void)
+static void
+test_locale (const char *locale)
{
size_t i;
- test_init ();
+ if (setlocale (LC_CTYPE, locale) == NULL)
+ {
+ error (0, 0, "cannot set locale \"%s\"", locale);
+ ret = 1;
+ }
- printf ("%23s", "");
+ printf ("%-23s", locale);
FOR_EACH_IMPL (impl, 0)
printf ("\t%s", impl->name);
putchar ('\n');
@@ -246,6 +251,19 @@ test_main (void)
}
do_random_tests ();
+}
+
+int
+test_main (void)
+{
+ test_init ();
+
+ test_locale ("C");
+ test_locale ("en_US.ISO-8859-1");
+ test_locale ("en_US.UTF-8");
+ test_locale ("tr_TR.ISO-8859-9");
+ test_locale ("tr_TR.UTF-8");
+
return ret;
}
--
1.8.3.3
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."