Skip to content

[libc] Fix some warnings #66366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libc/src/__support/CPP/limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions libc/test/src/ctype/isprint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}