diff options
author | Joseph Myers <joseph@codesourcery.com> | 2018-10-22 14:52:14 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2018-10-22 14:52:14 +0000 |
commit | be8ff03f92df08055ac5f15f1b65b24026a683a5 (patch) | |
tree | ec40bc97f79dc838435cd541cab97f3cc19e38d5 /wcsmbs/Makefile | |
parent | 2dd8e58cc533ee840d37725b11bc0dc0308a5dc0 (diff) | |
download | glibc-be8ff03f92df08055ac5f15f1b65b24026a683a5.tar.gz glibc-be8ff03f92df08055ac5f15f1b65b24026a683a5.tar.xz glibc-be8ff03f92df08055ac5f15f1b65b24026a683a5.zip |
Stop c32rtomb and mbrtoc32 aliasing wcrtomb and mbrtowc (bug 23793).
glibc does: /* There should be no difference between the UTF-32 handling required by c32rtomb and the wchar_t handling which has long since been implemented in wcrtomb. */ weak_alias (__wcrtomb, c32rtomb) /* There should be no difference between the UTF-32 handling required by mbrtoc32 and the wchar_t handling which has long since been implemented in mbrtowc. */ weak_alias (__mbrtowc, mbrtoc32) The reasoning in those comments to justify those aliases is incorrect: ISO C requires that, for the case of a NULL mbstate_t* being passed, each function has its *own* internal static mbstate_t. Thus a program must be able to use both wcrtomb and c32rtomb at the same time with each keeping its own separate state, and likewise for mbrtowc and mbrtoc32. This patch duly sets up separarate char32_t function that wrap the wchar_t ones. Note that the included test only covers the mbrtoc32 / mbrtowc pair. While I think the change made is logically correct for c32rtomb / wcrtomb as well, I'm not sure we have a locale with a suitable state-dependent multibyte encoding for testing that part of the change. Tested for x86_64. [BZ #23793] * wcsmbs/c32rtomb.c: New file. * wcsmbs/mbrtoc32.c: Likewise. * wcsmbs/tst-c32-state.c: Likewise. * wcsmbs/mbrtowc.c (mbrtoc32): Do not define as alias. * wcsmbs/wcrtomb.c (c32rtomb): Likewise. * wcsmbs/Makefile (routines): Add mbrtoc32 and c32rtomb. (tests): Add tst-c32-state. [$(run-built-tests) = yes] ($(objpfx)tst-c32-state.out): Depend on $(gen-locales).
Diffstat (limited to 'wcsmbs/Makefile')
-rw-r--r-- | wcsmbs/Makefile | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index a58d36ff8f..cdd8dd5c50 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -42,7 +42,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \ wcsmbsload mbsrtowcs_l \ isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \ isoc99_swscanf isoc99_vswscanf \ - mbrtoc16 c16rtomb + mbrtoc16 c16rtomb mbrtoc32 c32rtomb strop-tests := wcscmp wcsncmp wmemcmp wcslen wcschr wcsrchr wcscpy wcsnlen \ wcpcpy wcsncpy wcpncpy wcscat wcsncat wcschrnul wcsspn wcspbrk \ @@ -51,7 +51,7 @@ tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \ tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \ tst-c16c32-1 wcsatcliff tst-wcstol-locale tst-wcstod-nan-locale \ tst-wcstod-round test-char-types tst-fgetwc-after-eof \ - tst-wcstod-nan-sign tst-c16-surrogate \ + tst-wcstod-nan-sign tst-c16-surrogate tst-c32-state \ $(addprefix test-,$(strop-tests)) include ../Rules @@ -70,6 +70,7 @@ $(objpfx)wcsmbs-tst1.out: $(gen-locales) $(objpfx)tst-wcstol-locale.out: $(gen-locales) $(objpfx)tst-wcstod-nan-locale.out: $(gen-locales) $(objpfx)tst-c16-surrogate.out: $(gen-locales) +$(objpfx)tst-c32-state.out: $(gen-locales) endif $(objpfx)tst-wcstod-round: $(libm) |