|
| From: | Bruno Haible |
| Subject: | Re: wctype, iswctype: Add tests |
| Date: | Wed, 26 Jul 2023 15:23:06 +0200 |
I wrote:
> I saw a test failure of c32_apply_type_test on mingw
And indeed we see the following test failures on native Windows:
* On mingw:
FAIL: test-wctype-h
===================
test-wctype-h.c:67: assertion '!iswprint (L'\t')' failed
FAIL: test-wctype
=================
test-wctype.c:37: assertion 'desc != (wctype_t) 0' failed
FAIL: test-iswctype
===================
test-iswctype.c:37: assertion 'desc != (wctype_t) 0' failed
* On MSVC:
FAIL: test-iswctype
===================
test-iswctype.c:39: assertion 'iswctype (L'\t', desc)' failed
It can also be reproduced with a simple program:
================================================================================
#include <stdio.h>
#include <ctype.h>
#include <wctype.h>
int main ()
{
printf ("space: %d%d%d %d%d%d %d%d%d %d%d%d\n",
!!isgraph(' '), !!iswgraph(L' '), !!iswctype(L' ',wctype("graph")),
!!isprint(' '), !!iswprint(L' '), !!iswctype(L' ',wctype("print")),
!!iscntrl(' '), !!iswcntrl(L' '), !!iswctype(L' ',wctype("cntrl")),
!!isblank(' '), !!iswblank(L' '), !!iswctype(L' ',wctype("blank")));
printf ("tab: %d%d%d %d%d%d %d%d%d %d%d%d\n",
!!isgraph('\t'), !!iswgraph(L'\t'), !!iswctype(L'\t',wctype("graph")),
!!isprint('\t'), !!iswprint(L'\t'), !!iswctype(L'\t',wctype("print")),
!!iscntrl('\t'), !!iswcntrl(L'\t'), !!iswctype(L'\t',wctype("cntrl")),
!!isblank('\t'), !!iswblank(L'\t'),
!!iswctype(L'\t',wctype("blank")));
printf ("lf: %d%d%d %d%d%d %d%d%d %d%d%d\n",
!!isgraph('\n'), !!iswgraph(L'\n'), !!iswctype(L'\n',wctype("graph")),
!!isprint('\n'), !!iswprint(L'\n'), !!iswctype(L'\n',wctype("print")),
!!iscntrl('\n'), !!iswcntrl(L'\n'), !!iswctype(L'\n',wctype("cntrl")),
!!isblank('\n'), !!iswblank(L'\n'),
!!iswctype(L'\n',wctype("blank")));
}
================================================================================
glibc:
space: 000 111 000 111
tab: 000 000 111 111
lf: 000 000 111 000
mingw:
space: 000 111 000 110
tab: 000 011 111 110
lf: 000 000 111 000
msvc:
space: 000 111 000 111
tab: 000 000 111 110
lf: 000 000 111 000
So, we have three bugs to work around:
- On mingw, iswprint('\t') is true, should be false.
- On mingw, wctype("blank") is null.
- On MSVC, iswctype(c,wctype("blank")) is not consistent with iswblank(c)
and isblank(c).
Done through these patches:
2023-07-26 Bruno Haible <bruno@clisp.org>
fnmatch: Update dependencies.
* modules/fnmatch (Depends-on): Add wctype.
2023-07-26 Bruno Haible <bruno@clisp.org>
wctype: Work around wctype+iswctype bug on MSVC.
* m4/wctype.m4 (gl_FUNC_WCTYPE): In the test program, test also for the
MSVC bug. Update cross-compilation guess.
* doc/posix-functions/wctype.texi: Mention the MSVC bug.
2023-07-26 Bruno Haible <bruno@clisp.org>
wctype: Work around wctype bug on mingw.
* lib/wctype.in.h (rpl_wctype_t, wctype_t, GNULIB_defined_wctype_t):
Define if REPLACE_WCTYPE is 1.
(wctype): Consider REPLACE_WCTYPE.
(iswctype): Override also if REPLACE_WCTYPE is 1.
* lib/iswctype.c: If GNULIB_defined_wctype_t is defined, use the
function-pointer based implementation.
* m4/wctype_h.m4 (gl_WCTYPE_H_DEFAULTS): Initialize REPLACE_WCTYPE.
* m4/wctype.m4 (gl_FUNC_WCTYPE): Define through AC_DEFUN_ONCE. Test
whether wctype supports the "blank" character class. Set REPLACE_WCTYPE
if not.
* m4/iswctype.m4 (gl_FUNC_ISWCTYPE): Require gl_FUNC_WCTYPE.
* modules/wctype (Status, Notice): Remove.
(Depends-on): Add iswctype. Consider REPLACE_WCTYPE.
(configure.ac): Consider REPLACE_WCTYPE.
* modules/iswctype (Status, Notice): Remove.
(Files): Add m4/wctype.m4.
(configure.ac): Override also if REPLACE_WCTYPE is 1.
* modules/wctype-h (Makefile.am): Substitute REPLACE_WCTYPE.
* doc/posix-functions/wctype.texi: Mention the mingw bug.
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.
* tests/test-iswblank.c (main): Verify that this character class
contains the ASCII space and tab, but not newline.
2023-07-26 Bruno Haible <bruno@clisp.org>
wctype, wctrans: Require a non-NULL argument.
* lib/wctype.in.h: Add placeholder for definition of _GL_ARG_NONNULL.
(wctype, wctrans): Mark with _GL_ARG_NONNULL ((1)).
* modules/wctype-h (Depends-on): Add snippet/arg-nonnull.
(Makefile.am): Substitute $(ARG_NONNULL_H) into wctype.h.
0001-wctype-wctrans-Require-a-non-NULL-argument.patch
Description: Text Data
0002-iswblank-tests-Add-more-tests.patch
Description: Text Data
0003-wctype-h-Work-around-iswprint-bug-on-mingw.patch
Description: Text Data
0004-wctype-Work-around-wctype-bug-on-mingw.patch
Description: Text Data
0005-wctype-Work-around-wctype-iswctype-bug-on-MSVC.patch
Description: Text Data
0006-fnmatch-Update-dependencies.patch
Description: Text Data
| [Prev in Thread] | Current Thread | [Next in Thread] |