[libc-commits] [PATCH] D94634: [libc][NFC] change isblank and iscntrl from implicit casting
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Jan 13 14:04:05 PST 2021
michaelrj created this revision.
michaelrj added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added a project: libc-project.
michaelrj requested review of this revision.
isblank and iscntrl were casting an int to a char implicitly and this
was throwing errors under Fuchsia. I've added a static cast to resolve
this issue.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94634
Files:
libc/src/ctype/isblank.cpp
libc/src/ctype/iscntrl.cpp
Index: libc/src/ctype/iscntrl.cpp
===================================================================
--- libc/src/ctype/iscntrl.cpp
+++ libc/src/ctype/iscntrl.cpp
@@ -15,7 +15,7 @@
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) {
- const unsigned char ch = c;
+ const unsigned char ch = static_cast<char>(c);
return ch < 0x20 || ch == 0x7f;
}
Index: libc/src/ctype/isblank.cpp
===================================================================
--- libc/src/ctype/isblank.cpp
+++ libc/src/ctype/isblank.cpp
@@ -15,7 +15,7 @@
// TODO: Currently restricted to default locale.
// These should be extended using locale information.
LLVM_LIBC_FUNCTION(int, isblank, (int c)) {
- const unsigned char ch = c;
+ const unsigned char ch = static_cast<char>(c);
return ch == ' ' || ch == '\t';
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94634.316513.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210113/c3babad1/attachment-0001.bin>
More information about the libc-commits
mailing list