[newlib-cygwin/main] Fix newlib/testsuite/newlib.wctype/twctype.c compilation for 16-bit targets

Jeff Johnston jjohnstn@sourceware.org
Wed Jul 15 00:06:35 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5079e0929b415d56f1dc61aaf0903db71a1a189a

commit 5079e0929b415d56f1dc61aaf0903db71a1a189a
Author: Jan Dubiec <jdx@o2.pl>
Date:   Mon Jul 13 02:40:42 2026 +0200

    Fix newlib/testsuite/newlib.wctype/twctype.c compilation for 16-bit targets
    
    When the test case is compiled for a target with a 16-bit wint_t, the
    compiler emits the two warnings shown below, causing the test to fail. The
    code assumes that wint_t is 32 bits wide, which is not always the case.
    This patch fixes the issue.
    
    Signed-off-by: Jan Dubiec <jdx@o2.pl>

Diff:
---
 newlib/testsuite/newlib.wctype/twctype.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/testsuite/newlib.wctype/twctype.c b/newlib/testsuite/newlib.wctype/twctype.c
index 95be74d63..d45128e50 100644
--- a/newlib/testsuite/newlib.wctype/twctype.c
+++ b/newlib/testsuite/newlib.wctype/twctype.c
@@ -39,8 +39,13 @@ int main()
       setlocale (LC_CTYPE, "C-UTF-8");
       CHECK (iswalpha(0x0967));
       CHECK (!iswalpha(0x128e));
+#if __SIZEOF_WINT_T__ > 2
+      /* These two lines may cause compilation warnings on targets
+         where wint_t is 16 bits wide, which in turn causes the test
+         case to fail. */
       CHECK (iswalnum(0x1d7ce));
       CHECK (!iswalnum(0x1d800));
+#endif
       CHECK (iswcntrl(0x007f));
       CHECK (!iswcntrl(0x2027));
       CHECK (iswdigit(L'2'));


More information about the Newlib-cvs mailing list