Re: [PATCH] wchar.h: tweak wcwidth prototype parameter wchar_t -> wint_t
Thomas Wolff <[email protected]> Sun, 31 May 2026 10:06:12 +0200
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Hi Brian, Am 31.05.2026 um 05:50 schrieb Brian Inglis via Cygwin: > On 2026-05-28 22:58, Thomas Wolff wrote: >> to make it compliant with newlib and the manual page; >> fixes cases of wrong width calculation: >> https://cygwin.com/pipermail/cygwin/2026-April/259597.html >> as mentioned in >> https://cygwin.com/pipermail/cygwin/2026-May/259734.html >> as described in >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D125451#c14 > > attachment:=20 > 0001-wchar.h-tweak-wcwidth-prototype-parameter-wchar_t-wi.patch > > The existing wcwidth declaration in newlib/libc/include/wchar.h agrees= =20 > with > POSIX 8 SUS V5. > > It is the man doc, definition, and implementation in > newlib/libc/string/wcwidth.c which need changed to match the=20 > specification and return codes in: > > =C2=A0=C2=A0=C2=A0=C2=A0https://pubs.opengroup.org/onlinepubs/9799919799= /functions/wcwidth.html Your argument overlooks one significant deviation: in POSIX, wchar_t has= =20 32 bits, in cygwin only 16. So to make wcwidth work for *all* Unicode character code points, the 32=20 bit version must be used. I tested positively that this fixes the broken test case with gcc 16 I=20 had reported to the cygwin list.