Fix newlib/testsuite/newlib.wctype/twctype.c compilation for targets with a 16-bit wint_t.
| Message ID | 20260713004128.744560-1-jdx@o2.pl |
|---|---|
| State | New |
| Headers |
Return-Path: <newlib-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C336C4BA2E0B for <patchwork@sourceware.org>; Mon, 13 Jul 2026 00:42:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C336C4BA2E0B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=o2.pl header.i=@o2.pl header.a=rsa-sha256 header.s=20241105 header.b=TViTTkKy X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mx-out.tlen.pl (mx-out.tlen.pl [193.222.135.148]) by sourceware.org (Postfix) with ESMTPS id 910D74BA2E07 for <newlib@sourceware.org>; Mon, 13 Jul 2026 00:41:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 910D74BA2E07 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=o2.pl Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=o2.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 910D74BA2E07 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=193.222.135.148 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783903299; cv=none; b=F7VwsP3Xz+riolnL+LJ05c8tG0A8ETrUvCfUzFvEt1pMhXl5RqgbdfYlaoKCNjIQFmZWqwbxctBP4Gmpv/oYLE+gsHbEkuQBXlxg8sMZnVRyQzTSUr88q05qwLYBCoKjSKV423IZShRiMc0q8+fDFegdvr1Pw/pgvQ65N/6z8j0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783903299; c=relaxed/simple; bh=LPI4Yl3+Q5zVh8o0VsbSUgkrZZLRYz0NekJZcm5akXI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=eDf2H4flmmsJORAwPTAJ9jNBqomsRCztRhjI3iyRYVBrwTXgDgcQo/5Fz58asVJsi/1Nf/K85gtodICXqhdRWV3Qe5/mLYnEOzPAGZNBFAAeTL5nXpJ6h/9JW3jQBiKY8FX4qM1ohFuKJx7kcwI3jwN0JxbbVRUnbg1qn51dxfY= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=o2.pl header.i=@o2.pl header.a=rsa-sha256 header.s=20241105 header.b=TViTTkKy DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 910D74BA2E07 Received: (wp-smtpd smtp.tlen.pl 41183 invoked from network); 13 Jul 2026 02:41:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=o2.pl; s=20241105; t=1783903298; bh=/JLqYGlAeoyFqgdEJjoYMQ01XRCN7FcAnBmf21nUq/8=; h=From:To:Cc:Subject; b=TViTTkKyJtHSKCd9Isrexmme/8QtW7nQKlgCR24yx85QrBfGDsNDEihbal+Ajjpa0 geK8pFMhuV0u3SW/4dE/2v41ITlgtH5K+laIofcOj/c79kXanDLJpoq6nXwkCxh7ZF Is1LCcj1Bcs8DG0aSbuq9suTK/m6vUeJ9Qy1x1KgsZBd+0Fcj1nvQ8evcnoJD98oEy 3L7jgGHSQIqRrqmcvq1dl6Y3rH+jrsdLvUFN4xTvDexd2FkAOCj/lJJXHfktThIXe8 QYqPlU3J44JKAKpcv2+By/r0tOujDjLlznai/ATPIhnCzZnjPdFE15YBYxIJEXVdeL RuCvfAgzrE4Zg== Received: from ip-94-42-225-247.multimo.pl (HELO jdxpc) (jdx@o2.pl@[94.42.225.247]) (envelope-sender <jdx@o2.pl>) by smtp.tlen.pl (WP-SMTPD) with TLS_AES_256_GCM_SHA384 encrypted SMTP for <newlib@sourceware.org>; 13 Jul 2026 02:41:37 +0200 From: Jan Dubiec <jdx@o2.pl> To: newlib@sourceware.org Cc: Jan Dubiec <jdx@o2.pl> Subject: [PATCH] Fix newlib/testsuite/newlib.wctype/twctype.c compilation for targets with a 16-bit wint_t. Date: Mon, 13 Jul 2026 02:40:42 +0200 Message-ID: <20260713004128.744560-1-jdx@o2.pl> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-WP-DKIM-Status: good (id: o2.pl) X-WP-MailID: 13919a431f6b45dd5d596552448d0fe4 X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 0000001 [0aKz] X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list <newlib.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/newlib>, <mailto:newlib-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/newlib/> List-Post: <mailto:newlib@sourceware.org> List-Help: <mailto:newlib-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/newlib>, <mailto:newlib-request@sourceware.org?subject=subscribe> Errors-To: newlib-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
Fix newlib/testsuite/newlib.wctype/twctype.c compilation for targets with a 16-bit wint_t.
|
|
Commit Message
Jan Dubiec
July 13, 2026, 12:40 a.m. UTC
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.
h8300-elf-gcc /mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c -I/mnt/Works/newlib/newlib/testsuite/include -lm -o /mnt/Works/xcomp/build-newlib-h8300-linux/h8300-elf/newlib/testsuite/twctype.x
In file included from /mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c:7:
/mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c: In function 'main':
/mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c:42:23: warning: unsigned conversion from 'long int' to 'wint_t' {aka 'unsigned int'} changes value from '120782' to '55246' [-Woverflow]
42 | CHECK (iswalnum(0x1d7ce));
| ^~~~~~~
/mnt/Works/newlib/newlib/testsuite/include/check.h:5:9: note: in definition of macro 'CHECK'
5 | if (!(a)) \
| ^
/mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c:43:24: warning: unsigned conversion from 'long int' to 'wint_t' {aka 'unsigned int'} changes value from '120832' to '55296' [-Woverflow]
43 | CHECK (!iswalnum(0x1d800));
| ^~~~~~~
/mnt/Works/newlib/newlib/testsuite/include/check.h:5:9: note: in definition of macro 'CHECK'
5 | if (!(a)) \
| ^
Signed-off-by: Jan Dubiec <jdx@o2.pl>
---
newlib/testsuite/newlib.wctype/twctype.c | 5 +++++
1 file changed, 5 insertions(+)
Comments
Patch merged. -- Jeff J. On Sun, Jul 12, 2026 at 8:42 PM Jan Dubiec <jdx@o2.pl> wrote: > 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. > > h8300-elf-gcc /mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c > -I/mnt/Works/newlib/newlib/testsuite/include -lm -o > /mnt/Works/xcomp/build-newlib-h8300-linux/h8300-elf/newlib/testsuite/twctype.x > In file included from > /mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c:7: > /mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c: In function > 'main': > /mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c:42:23: warning: > unsigned conversion from 'long int' to 'wint_t' {aka 'unsigned int'} > changes value from '120782' to '55246' [-Woverflow] > 42 | CHECK (iswalnum(0x1d7ce)); > | ^~~~~~~ > /mnt/Works/newlib/newlib/testsuite/include/check.h:5:9: note: in > definition of macro 'CHECK' > 5 | if (!(a)) \ > | ^ > /mnt/Works/newlib/newlib/testsuite/newlib.wctype/twctype.c:43:24: warning: > unsigned conversion from 'long int' to 'wint_t' {aka 'unsigned int'} > changes value from '120832' to '55296' [-Woverflow] > 43 | CHECK (!iswalnum(0x1d800)); > | ^~~~~~~ > /mnt/Works/newlib/newlib/testsuite/include/check.h:5:9: note: in > definition of macro 'CHECK' > 5 | if (!(a)) \ > | ^ > > Signed-off-by: Jan Dubiec <jdx@o2.pl> > --- > 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..2275bf44d 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')); > -- > 2.54.0 > >
diff --git a/newlib/testsuite/newlib.wctype/twctype.c b/newlib/testsuite/newlib.wctype/twctype.c index 95be74d63..2275bf44d 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'));