diff options
author | Carlos O'Donell <carlos@redhat.com> | 2021-07-29 01:27:56 -0400 |
---|---|---|
committer | Carlos O'Donell <carlos@redhat.com> | 2021-07-29 01:31:39 -0400 |
commit | b2a77206b3c3bf4670acc069f6fdda76cf857d48 (patch) | |
tree | 3e35b2a2b9c864a91a223c9bc94c35797af57aae /posix/bug-regex19.c | |
parent | 7de41f96a172e5f15bc449ec3c09dbd0ae4cf2c6 (diff) | |
download | glibc-b2a77206b3c3bf4670acc069f6fdda76cf857d48.tar.gz glibc-b2a77206b3c3bf4670acc069f6fdda76cf857d48.tar.xz glibc-b2a77206b3c3bf4670acc069f6fdda76cf857d48.zip |
Add generic C.UTF-8 locale (Bug 17318) codonell/c-utf8
We add a new C.UTF-8 locale. This locale is not builtin to glibc, but is provided as a distinct locale. The locale provides full support for UTF-8 and this includes full code point sorting via strcmp-based collation. The collation uses a new keyword 'strcmp_collation' which drops all collation rules and generates an empty zero rules collation to enable strcmp usage in collation. This ensures that we get full code point sorting for C.UTF-8 with a minimal 92 bytes of overhead (LC_COLLATE structure information). The new locale is added to SUPPORTED. Minimal test data for specific code points (minus those not supported by collate-test) is provided in C.UTF-8.in, and this verifies code point sorting is working reasonably across the range. The locale was tested manually with the full set of code points without failure. The locale is harmonized with locales already shipping in Gentoo, Debian, Ubuntu, Fedora, CentOS Stream, and RHEL. A new tst-iconv9 test is added which verifies the C.UTF-8 locale is generally usable. Testing for fnmatch, regexec, and recomp is provided by extending bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch, tst-regcomp-truncated, and tst-regex to use C.UTF-8. Tested on x86_64 or i686 without regression.
Diffstat (limited to 'posix/bug-regex19.c')
-rw-r--r-- | posix/bug-regex19.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/posix/bug-regex19.c b/posix/bug-regex19.c index b3fee0a730..e00ff60a14 100644 --- a/posix/bug-regex19.c +++ b/posix/bug-regex19.c @@ -25,6 +25,7 @@ #include <string.h> #include <locale.h> #include <libc-diag.h> +#include <support/support.h> #define BRE RE_SYNTAX_POSIX_BASIC #define ERE RE_SYNTAX_POSIX_EXTENDED @@ -407,8 +408,8 @@ do_mb_tests (const struct test_s *test) return 0; } -int -main (void) +static int +do_test (void) { size_t i; int ret = 0; @@ -417,20 +418,17 @@ main (void) for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) { - if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL) - { - puts ("setlocale de_DE.ISO-8859-1 failed"); - ret = 1; - } + xsetlocale (LC_ALL, "de_DE.ISO-8859-1"); ret |= do_one_test (&tests[i], ""); - if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) - { - puts ("setlocale de_DE.UTF-8 failed"); - ret = 1; - } + xsetlocale (LC_ALL, "de_DE.UTF-8"); + ret |= do_one_test (&tests[i], "UTF-8 "); + ret |= do_mb_tests (&tests[i]); + xsetlocale (LC_ALL, "C.UTF-8"); ret |= do_one_test (&tests[i], "UTF-8 "); ret |= do_mb_tests (&tests[i]); } return ret; } + +#include <support/test-driver.c> |