Author: Michael Jones Date: 2021-01-13T22:06:56Z New Revision: ea8034ec35a9e3d6784d7e6f50617af3d87f6a9f
URL: https://github.com/llvm/llvm-project/commit/ea8034ec35a9e3d6784d7e6f50617af3d87f6a9f DIFF: https://github.com/llvm/llvm-project/commit/ea8034ec35a9e3d6784d7e6f50617af3d87f6a9f.diff LOG: [libc][NFC] change isblank and iscntrl from implicit casting 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. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D94634 Added: Modified: libc/src/ctype/isblank.cpp libc/src/ctype/iscntrl.cpp Removed: ################################################################################ diff --git a/libc/src/ctype/isblank.cpp b/libc/src/ctype/isblank.cpp index b29d19aef2f1..1c3061379b29 100644 --- a/libc/src/ctype/isblank.cpp +++ b/libc/src/ctype/isblank.cpp @@ -15,7 +15,7 @@ namespace __llvm_libc { // 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'; } diff --git a/libc/src/ctype/iscntrl.cpp b/libc/src/ctype/iscntrl.cpp index 8962bcae0a84..b061199c47ec 100644 --- a/libc/src/ctype/iscntrl.cpp +++ b/libc/src/ctype/iscntrl.cpp @@ -15,7 +15,7 @@ namespace __llvm_libc { // 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; } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits