-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Build fixes for widechar characterconverter #143805
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
Conversation
@llvm/pr-subscribers-libc Author: Uzair Nawaz (uzairnawaz) ChangesBuild fixes for wchar CharacterConverter class Full diff: https://github.com/llvm/llvm-project/pull/143805.diff 8 Files Affected:
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 209fcb965242f..1e40e3e4cc908 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -212,6 +212,8 @@ add_proxy_header_library(
add_header_library(wchar_overlay HDRS wchar_overlay.h)
+add_header_library(uchar_overlay HDRS uchar_overlay.h)
+
add_proxy_header_library(
wchar_macros
HDRS
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 5f6197c93d445..89eabc0bc4b2e 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -1,3 +1,26 @@
+
+add_proxy_header_library(
+ char8_t
+ HDRS
+ char8_t.h
+ DEPENDS
+ libc.hdr.uchar_overlay
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.char8_t
+ libc.include.uchar
+)
+
+add_proxy_header_library(
+ char32_t
+ HDRS
+ char32_t.h
+ DEPENDS
+ libc.hdr.uchar_overlay
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.char32_t
+ libc.include.uchar
+)
+
add_proxy_header_library(
div_t
HDRS
diff --git a/libc/include/llvm-libc-types/char8_t.h b/libc/include/llvm-libc-types/char8_t.h
index ddadab1afa219..a343be77d810b 100644
--- a/libc/include/llvm-libc-types/char8_t.h
+++ b/libc/include/llvm-libc-types/char8_t.h
@@ -9,8 +9,7 @@
#ifndef LLVM_LIBC_TYPES_CHAR8_T_H
#define LLVM_LIBC_TYPES_CHAR8_T_H
-#if !defined(__cplusplus) && defined(__STDC_VERSION__) && \
- __STDC_VERSION__ >= 202311L
+#if !(defined(__cplusplus) && defined(__cpp_char8_t))
typedef unsigned char char8_t;
#endif
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index f92499fdbf451..201967fe05f0e 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -381,3 +381,5 @@ add_subdirectory(HashTable)
add_subdirectory(fixed_point)
add_subdirectory(time)
+
+add_subdirectory(wchar)
diff --git a/libc/src/__support/wchar/mbstate.h b/libc/src/__support/wchar/mbstate.h
index 72ec727560003..0a0c5e2ad4ce1 100644
--- a/libc/src/__support/wchar/mbstate.h
+++ b/libc/src/__support/wchar/mbstate.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MBSTATE_H
#define LLVM_LIBC_SRC___SUPPORT_MBSTATE_H
+#include "src/__support/common.h"
#include "hdr/types/char32_t.h"
#include <stdint.h>
diff --git a/libc/src/__support/wchar/utf_ret.h b/libc/src/__support/wchar/utf_ret.h
index b8a8f6f094143..ad9690ec1f646 100644
--- a/libc/src/__support/wchar/utf_ret.h
+++ b/libc/src/__support/wchar/utf_ret.h
@@ -10,12 +10,13 @@
#define LLVM_LIBC_SRC___SUPPORT_UTF_RET_H
namespace LIBC_NAMESPACE_DECL {
-
+namespace internal {
template <typename T> struct utf_ret {
T out;
int error;
};
+} // namespace internal
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_UTF_RET_H
diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt
index 4fb0dae86e5ca..8905ac2127620 100644
--- a/libc/test/src/__support/CMakeLists.txt
+++ b/libc/test/src/__support/CMakeLists.txt
@@ -275,3 +275,4 @@ add_subdirectory(fixed_point)
add_subdirectory(HashTable)
add_subdirectory(time)
add_subdirectory(threads)
+add_subdirectory(wchar)
diff --git a/libc/test/src/__support/wchar/CMakeLists.txt b/libc/test/src/__support/wchar/CMakeLists.txt
new file mode 100644
index 0000000000000..109f3ab3c85db
--- /dev/null
+++ b/libc/test/src/__support/wchar/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_custom_target(libc-support-wchar-tests)
+
+add_libc_test(
+ utf32_to_8_test
+ SUITE
+ libc-support-tests
+ SRCS
+ utf32_to_8_test.cpp
+ DEPENDS
+ libc.src.__support.wchar.character_converter
+ )
\ No newline at end of file
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Will add back in a later patch when creating tests.
…ad of test folder
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.
LGTM
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/7228 Here is the relevant piece of the build log for the reference
|
Build fixes for wchar CharacterConverter class
Build fixes for wchar CharacterConverter class
Build fixes for wchar CharacterConverter class