This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH]Fix newlib.wctype/twctrans.c compilation warning: implicit declaration of function 'toupper' & 'tolower'
- From: Renlin Li <renlin dot li at arm dot com>
- To: Eric Blake <eblake at redhat dot com>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Cc: Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>
- Date: Wed, 07 Jan 2015 16:53:49 +0000
- Subject: Re: [PATCH]Fix newlib.wctype/twctrans.c compilation warning: implicit declaration of function 'toupper' & 'tolower'
- Authentication-results: sourceware.org; auth=none
- References: <54AD370D dot 9010705 at arm dot com> <54AD3802 dot 403 at arm dot com> <54AD5516 dot 4080807 at redhat dot com>
On 07/01/15 15:47, Eric Blake wrote:
On 01/07/2015 06:43 AM, Renlin Li wrote:
Instead, towupper and towloer should be called as wctype.h is included
in the test case.
newlib regresstion test is done using aarch64-none-elf toolchain, no new
issues.
Is it Okay to commit?
- CHECK (towctrans (L'A', x) == tolower ('A'));
- CHECK (towctrans (L'5', x) == tolower ('5'));
+ CHECK (towctrans (L'A', x) == towlower ('A'));
Shouldn't this be using towlower (L'A'), since towlower wants wint_t
inputs? While POSIX requires that 'A' and L'A' have the same integer
value, C99 allows for situations where multibyte characters use a
different encoding of wint_t than the corresponding 'char' representing
the same character.
Hi Eric,
Thank you for pointing it out.
I have updated the patch, newlib regresstion test is done using
aarch64-none-elf toolchain, no new issues.
please check the new attachment.
Regards,
Renlin Li
diff --git a/newlib/testsuite/newlib.wctype/twctrans.c b/newlib/testsuite/newlib.wctype/twctrans.c
index a70e00175eeb3ec956e7eda2257f6e4f0702b160..5a0c831759855c9c26ec7105611c67b2d1ae7ba2 100644
--- a/newlib/testsuite/newlib.wctype/twctrans.c
+++ b/newlib/testsuite/newlib.wctype/twctrans.c
@@ -8,13 +8,13 @@ int main()
x = wctrans ("tolower");
CHECK (x != 0);
- CHECK (towctrans (L'A', x) == tolower ('A'));
- CHECK (towctrans (L'5', x) == tolower ('5'));
+ CHECK (towctrans (L'A', x) == towlower (L'A'));
+ CHECK (towctrans (L'5', x) == towlower (L'5'));
x = wctrans ("toupper");
CHECK (x != 0);
- CHECK (towctrans (L'c', x) == toupper ('c'));
- CHECK (towctrans (L'9', x) == toupper ('9'));
+ CHECK (towctrans (L'c', x) == towupper (L'c'));
+ CHECK (towctrans (L'9', x) == towupper (L'9'));
x = wctrans ("unknown");
CHECK (x == 0);