-
Notifications
You must be signed in to change notification settings - Fork 14k
[libc] build fix: always use our char8_t headers even in overlay mode #144433
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
[libc] build fix: always use our char8_t headers even in overlay mode #144433
Conversation
@llvm/pr-subscribers-libc Author: Uzair Nawaz (uzairnawaz) ChangesBuild fix caused by certain platforms not providing char8_t when expected Full diff: https://github.com/llvm/llvm-project/pull/144433.diff 2 Files Affected:
diff --git a/libc/hdr/types/char8_t.h b/libc/hdr/types/char8_t.h
index 31de764658f9e..4d71e3dd89098 100644
--- a/libc/hdr/types/char8_t.h
+++ b/libc/hdr/types/char8_t.h
@@ -9,14 +9,6 @@
#ifndef LLVM_LIBC_HDR_TYPES_CHAR8_T_H
#define LLVM_LIBC_HDR_TYPES_CHAR8_T_H
-#ifdef LIBC_FULL_BUILD
-
#include "include/llvm-libc-types/char8_t.h"
-#else // overlay mode
-
-#include "hdr/uchar_overlay.h"
-
-#endif // LLVM_LIBC_FULL_BUILD
-
#endif // LLVM_LIBC_HDR_TYPES_CHAR8_T_H
diff --git a/libc/src/__support/wchar/character_converter.cpp b/libc/src/__support/wchar/character_converter.cpp
index bac2f6d827e13..ef5730a70a033 100644
--- a/libc/src/__support/wchar/character_converter.cpp
+++ b/libc/src/__support/wchar/character_converter.cpp
@@ -71,7 +71,7 @@ ErrorOr<char8_t> CharacterConverter::pop_utf8() {
// Shift to get the next 6 bits from the utf32 encoding
const char32_t shift_amount =
- (state->total_bytes - state->bytes_processed - 1) * ENCODED_BITS_PER_UTF8;
+ static_cast<char32_t>((state->total_bytes - state->bytes_processed - 1) * ENCODED_BITS_PER_UTF8);
if (state->bytes_processed == 0) {
/*
Choose the correct set of most significant bits to encode the length
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to explicitly mention and exclude such targets.
the issue isn't actually the targets, it's that the glibc headers only define char8_t under specific circumstances (C23 or higher), which makes them unreliable for defining this type. I think the reason it works on other targets is the default C++ version is new enough that it defines char8_t as a keyword. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on aarch64 and x86_64, passed on both.
…llvm#144433) Build fix caused by certain platforms not providing char8_t when expected Temporary fix to just always use our own definition, even in overlay mode.
Build fix caused by certain platforms not providing char8_t when expected
Temporary fix to just always use our own definition, even in overlay mode.