Skip to content

Commit 2ad7a06

Browse files
authored
[libc] Fix some warnings (#66366)
Some compilers will warn about dangling else and missleading lack of parentheses.
1 parent cb479e7 commit 2ad7a06

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

libc/src/__support/CPP/limits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ namespace cpp {
1717
// Some older gcc distributions don't define these for 32 bit targets.
1818
#ifndef LLONG_MAX
1919
constexpr size_t LLONG_BIT_WIDTH = sizeof(long long) * 8;
20-
constexpr long long LLONG_MAX = ~0LL ^ (1LL << LLONG_BIT_WIDTH - 1);
21-
constexpr long long LLONG_MIN = 1LL << LLONG_BIT_WIDTH - 1;
20+
constexpr long long LLONG_MAX = ~0LL ^ (1LL << (LLONG_BIT_WIDTH - 1));
21+
constexpr long long LLONG_MIN = 1LL << (LLONG_BIT_WIDTH - 1);
2222
constexpr unsigned long long ULLONG_MAX = ~0ULL;
2323
#endif
2424

libc/test/src/ctype/isprint_test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
TEST(LlvmLibcIsPrint, DefaultLocale) {
1313
for (int ch = -255; ch < 255; ++ch) {
14-
if (' ' <= ch && ch <= '~') // A-Z, a-z, 0-9, punctuation, space.
14+
if (' ' <= ch && ch <= '~') { // A-Z, a-z, 0-9, punctuation, space.
1515
EXPECT_NE(__llvm_libc::isprint(ch), 0);
16-
else
16+
} else {
1717
EXPECT_EQ(__llvm_libc::isprint(ch), 0);
18+
}
1819
}
1920
}

0 commit comments

Comments
 (0)