[libc] Fix some warnings (#66366)

Some compilers will warn about dangling else and missleading lack of
parentheses.
This commit is contained in:
Alex Brachet 2023-09-14 08:47:21 -04:00 committed by GitHub
parent cb479e7d7d
commit 2ad7a06cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -17,8 +17,8 @@ namespace cpp {
// Some older gcc distributions don't define these for 32 bit targets.
#ifndef LLONG_MAX
constexpr size_t LLONG_BIT_WIDTH = sizeof(long long) * 8;
constexpr long long LLONG_MAX = ~0LL ^ (1LL << LLONG_BIT_WIDTH - 1);
constexpr long long LLONG_MIN = 1LL << LLONG_BIT_WIDTH - 1;
constexpr long long LLONG_MAX = ~0LL ^ (1LL << (LLONG_BIT_WIDTH - 1));
constexpr long long LLONG_MIN = 1LL << (LLONG_BIT_WIDTH - 1);
constexpr unsigned long long ULLONG_MAX = ~0ULL;
#endif

View File

@ -11,9 +11,10 @@
TEST(LlvmLibcIsPrint, DefaultLocale) {
for (int ch = -255; ch < 255; ++ch) {
if (' ' <= ch && ch <= '~') // A-Z, a-z, 0-9, punctuation, space.
if (' ' <= ch && ch <= '~') { // A-Z, a-z, 0-9, punctuation, space.
EXPECT_NE(__llvm_libc::isprint(ch), 0);
else
} else {
EXPECT_EQ(__llvm_libc::isprint(ch), 0);
}
}
}