diff options
author | Carlos O'Donell <carlos@redhat.com> | 2021-09-01 15:19:19 -0400 |
---|---|---|
committer | Carlos O'Donell <carlos@redhat.com> | 2021-09-06 11:30:28 -0400 |
commit | 466f2be6c08070e9113ae2fdc7acd5d8828cba50 (patch) | |
tree | c4fb7c10d98994298dcd451df71f1be790b575e9 /posix/transbug.c | |
parent | f5117c6504888fab5423282a4607c552b90fd3f9 (diff) | |
download | glibc-466f2be6c08070e9113ae2fdc7acd5d8828cba50.zip glibc-466f2be6c08070e9113ae2fdc7acd5d8828cba50.tar.gz glibc-466f2be6c08070e9113ae2fdc7acd5d8828cba50.tar.bz2 |
Add generic C.UTF-8 locale (Bug 17318)
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 (strcmp or wcscmp).
The collation uses a new keyword 'codepoint_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 1406 bytes of overhead (LC_COLLATE
structure information and ASCII collating tables).
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 various
downstream distributions. 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.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'posix/transbug.c')
-rw-r--r-- | posix/transbug.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/posix/transbug.c b/posix/transbug.c index d0983b4..b240177 100644 --- a/posix/transbug.c +++ b/posix/transbug.c @@ -116,16 +116,32 @@ do_test (void) static const char lower[] = "[[:lower:]]+"; static const char upper[] = "[[:upper:]]+"; struct re_registers regs[4]; + int result = 0; +#define CHECK(exp) \ + if (exp) { puts (#exp); result = 1; } + + printf ("INFO: Checking C.\n"); setlocale (LC_ALL, "C"); (void) re_set_syntax (RE_SYNTAX_GNU_AWK); - int result; -#define CHECK(exp) \ - if (exp) { puts (#exp); result = 1; } + result |= run_test (lower, regs); + result |= run_test (upper, ®s[2]); + if (! result) + { + CHECK (regs[0].start[0] != regs[2].start[0]); + CHECK (regs[0].end[0] != regs[2].end[0]); + CHECK (regs[1].start[0] != regs[3].start[0]); + CHECK (regs[1].end[0] != regs[3].end[0]); + } + + printf ("INFO: Checking C.UTF-8.\n"); + setlocale (LC_ALL, "C.UTF-8"); + + (void) re_set_syntax (RE_SYNTAX_GNU_AWK); - result = run_test (lower, regs); + result |= run_test (lower, regs); result |= run_test (upper, ®s[2]); if (! result) { |