+2023-07-26 Bruno Haible <bruno@clisp.org>
+
+ wctype-h: Work around iswprint bug on mingw.
+ * lib/wctype.in.h (rpl_iswprint): On mingw, don't use the system's
+ iswprint function.
+ * tests/test-wctype-h.c (main): Verify that this character class
+ contains the ASCII space but not tab and newline.
+ * tests/test-c32isprint.c (main): For tab, \v, \f, expect the same value
+ on native Windows as on other platforms.
+ * doc/posix-functions/iswprint.texi: Mention the mingw bug.
+
2023-07-26 Bruno Haible <bruno@clisp.org>
iswblank tests: Add more tests.
This function cannot be called from plain inline or extern inline functions
on some platforms:
OS X 10.8.
+@item
+This function returns true for the tab (@code{'\t'}) character
+on some platforms:
+mingw.
@end itemize
Portability problems not fixed by Gnulib:
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
Linux libc5 has <wctype.h> and the functions but they are broken.
mingw and MSVC have <wctype.h> and the functions but they take a wchar_t
- as argument, not an rpl_wint_t.
+ as argument, not an rpl_wint_t. Additionally, the mingw iswprint function
+ is broken.
Assume all 11 functions (all isw* except iswblank) are implemented the
same way, or not at all. */
# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
_GL_WCTYPE_INLINE int
rpl_iswprint (wint_t wc)
{
+# ifdef __MINGW32__
+ return ((wchar_t) wc == wc ? wc == ' ' || iswgraph ((wchar_t) wc) : 0);
+# else
return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0);
+# endif
}
_GL_WCTYPE_INLINE int
for (c = 0; c < 0x100; c++)
switch (c)
{
- #if !(defined _WIN32 && !defined __CYGWIN__)
case '\t': case '\v': case '\f':
- #endif
case ' ': case '!': case '"': case '#': case '%':
case '&': case '\'': case '(': case ')': case '*':
case '+': case ',': case '-': case '.': case '/':
ASSERT (!iswupper (e));
ASSERT (!iswxdigit (e));
+ /* Sanity check for the iswprint function. */
+ ASSERT (iswprint (L' '));
+ ASSERT (!iswprint (L'\t'));
+ ASSERT (!iswprint (L'\n'));
+
/* Check that the tow* functions exist as functions or as macros. */
(void) towlower (0);
(void) towupper (0);