glibc/wcsmbs
Joseph Myers be8ff03f92 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).
2018-10-22 14:52:14 +00:00
..
bits
btowc.c
c16rtomb.c Handle surrogate pairs in c16rtomb (bug 23794, DR#488, C2X). 2018-10-19 16:31:29 +00:00
c32rtomb.c Stop c32rtomb and mbrtoc32 aliasing wcrtomb and mbrtowc (bug 23793). 2018-10-22 14:52:14 +00:00
Depend
isoc99_fwscanf.c
isoc99_swscanf.c
isoc99_vfwscanf.c
isoc99_vswscanf.c
isoc99_vwscanf.c
isoc99_wscanf.c
Makefile Stop c32rtomb and mbrtoc32 aliasing wcrtomb and mbrtowc (bug 23793). 2018-10-22 14:52:14 +00:00
mbrlen.c
mbrtoc16.c
mbrtoc32.c Stop c32rtomb and mbrtoc32 aliasing wcrtomb and mbrtowc (bug 23793). 2018-10-22 14:52:14 +00:00
mbrtowc.c Stop c32rtomb and mbrtoc32 aliasing wcrtomb and mbrtowc (bug 23793). 2018-10-22 14:52:14 +00:00
mbsinit.c
mbsnrtowcs.c
mbsrtowcs_l.c
mbsrtowcs.c
test-char-types.c
test-wcpcpy.c
test-wcpncpy.c
test-wcscat.c
test-wcschr.c
test-wcschrnul.c
test-wcscmp.c
test-wcscpy.c
test-wcscspn.c
test-wcslen.c
test-wcsncat.c
test-wcsncmp.c
test-wcsncpy.c
test-wcsnlen.c
test-wcspbrk.c
test-wcsrchr.c
test-wcsspn.c
test-wmemchr.c
test-wmemcmp.c
test-wmemset.c
tst-btowc.c
tst-c16-surrogate.c Handle surrogate pairs in c16rtomb (bug 23794, DR#488, C2X). 2018-10-19 16:31:29 +00:00
tst-c16c32-1.c
tst-c32-state.c Stop c32rtomb and mbrtoc32 aliasing wcrtomb and mbrtowc (bug 23793). 2018-10-22 14:52:14 +00:00
tst-fgetwc-after-eof.c [BZ 1190] Make EOF sticky in stdio. 2018-03-13 08:31:56 -04:00
tst-mbrtowc2.c
tst-mbrtowc.c
tst-mbsrtowcs.c
tst-wchar-h.c
tst-wcpncpy.c
tst-wcrtomb.c
tst-wcsnlen.c
tst-wcstod-nan-locale.c
tst-wcstod-nan-sign.c Add tests for sign of NaN returned by strtod (bug 23007). 2018-06-15 17:36:21 +00:00
tst-wcstod-round.c
tst-wcstof.c
tst-wcstol-locale.c
uchar.h
Versions
wchar.h
wcpcpy.c
wcpncpy.c
wcrtomb.c Stop c32rtomb and mbrtoc32 aliasing wcrtomb and mbrtowc (bug 23793). 2018-10-22 14:52:14 +00:00
wcsatcliff.c
wcscasecmp_l.c
wcscasecmp.c
wcscat.c
wcschr.c
wcschrnul.c
wcscmp.c
wcscoll_l.c
wcscoll.c
wcscpy.c
wcscspn.c
wcsdup.c
wcslen.c
wcsmbs-tst1.c
wcsmbsload.c
wcsmbsload.h
wcsncase_l.c
wcsncase.c
wcsncat.c
wcsncmp.c
wcsncpy.c
wcsnlen.c
wcsnrtombs.c
wcspbrk.c
wcsrchr.c
wcsrtombs.c
wcsspn.c
wcsstr.c
wcstod_l.c
wcstod_nan.c math: Merge strtod_nan_*.h into math-type-macros-*.h 2018-05-16 06:03:08 +02:00
wcstod.c
wcstof_l.c
wcstof_nan.c math: Merge strtod_nan_*.h into math-type-macros-*.h 2018-05-16 06:03:08 +02:00
wcstof.c
wcstok.c
wcstol_l.c
wcstol.c
wcstold_l.c
wcstold_nan.c math: Merge strtod_nan_*.h into math-type-macros-*.h 2018-05-16 06:03:08 +02:00
wcstold.c
wcstoll_l.c
wcstoll.c
wcstoul_l.c
wcstoul.c
wcstoull_l.c
wcstoull.c
wcswidth.c
wcsxfrm_l.c
wcsxfrm.c
wctob.c
wcwidth.c
wcwidth.h
wmemchr.c
wmemcmp.c
wmemcpy.c
wmemmove.c
wmempcpy.c
wmemset.c