Toolchain: Remove workarounds for initializer_list and _aligned_alloc

These are no longer required to use libc++ on Serenity
This commit is contained in:
Andrew Kaster 2022-06-26 20:55:06 -06:00 committed by Linus Groh
parent efc1805b8f
commit 010190beb8
Notes: sideshowbarker 2024-07-17 11:34:34 +09:00

View File

@ -10,24 +10,17 @@ LibC, namely:
* The number of errno constants defined by us is given by the value of
the `ELAST` macro.
* Multithreading is implemented though the pthread library.
* Aligned memory allocation is provided by the MSVCRT-like
`_aligned_{malloc,free}` functions.
Adds a hack for a header not found error when including
`<initializer_list>` inside the SerenityOS kernel.
Makes libc++ use its builtin character type table instead of the one
provided by LibC as it is incomplete.
* Use libc++'s builtin character type table instead of the one provided
by LibC as there's a lot of extra porting work to convince the rest of
locale.cpp to use our character type table properly.
---
libcxx/include/CMakeLists.txt | 1 +
libcxx/include/__config | 6 ++++--
libcxx/include/__locale | 2 ++
libcxx/include/__support/serenity/xlocale.h | 24 +++++++++++++++++++++
libcxx/include/initializer_list | 2 ++
libcxx/include/locale | 2 +-
libcxx/include/new | 4 ++--
libcxx/src/include/config_elast.h | 2 ++
8 files changed, 38 insertions(+), 5 deletions(-)
6 files changed, 34 insertions(+), 3 deletions(-)
create mode 100644 libcxx/include/__support/serenity/xlocale.h
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
@ -109,20 +102,6 @@ index 000000000..0f939d2f6
+#endif // __serenity__
+
+#endif
diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list
index fefaf8cf8..c388bc246 100644
--- a/libcxx/include/initializer_list
+++ b/libcxx/include/initializer_list
@@ -43,7 +43,9 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
*/
#include <__config>
+#if !defined(__serenity__) || !defined(KERNEL)
#include <cstddef>
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 7c2d2361f..229ca7258 100644
--- a/libcxx/include/locale
@ -136,28 +115,6 @@ index 7c2d2361f..229ca7258 100644
# define _LIBCPP_HAS_CATOPEN 1
# include <nl_types.h>
# endif
diff --git a/libcxx/include/new b/libcxx/include/new
index be0d972f4..d212bae46 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -320,7 +320,7 @@ inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, s
// Returns the allocated memory, or `nullptr` on failure.
inline _LIBCPP_INLINE_VISIBILITY
void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
-#if defined(_LIBCPP_MSVCRT_LIKE)
+#if defined(_LIBCPP_MSVCRT_LIKE) || (defined(__serenity__) && !defined(KERNEL))
return ::_aligned_malloc(__size, __alignment);
#else
void* __result = nullptr;
@@ -332,7 +332,7 @@ void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
inline _LIBCPP_INLINE_VISIBILITY
void __libcpp_aligned_free(void* __ptr) {
-#if defined(_LIBCPP_MSVCRT_LIKE)
+#if defined(_LIBCPP_MSVCRT_LIKE) || (defined(__serenity__) && !defined(KERNEL))
::_aligned_free(__ptr);
#else
::free(__ptr);
diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h
index 0ed53a3b2..7fffd937e 100644
--- a/libcxx/src/include/config_elast.h