Skip to content

Commit

Permalink
libc/libcxx: fix failures with GCC 14
Browse files Browse the repository at this point in the history
CXX:  libcxx/libcxx/src/random.cpp In file included from nuttx/include/libcxx/__filesystem/filesystem_error.h:15,
                 from nuttx/include/libcxx/__filesystem/directory_entry.h:20,
                 from nuttx/include/libcxx/filesystem:539,
                 from nuttx/include/libcxx/fstream:192,
                 from libcxx/libcxx/src/ios.instantiations.cpp:10:
nuttx/include/libcxx/__filesystem/path.h: In instantiation of 'std::__1::__fs::filesystem::path::_EnableIfPathable<_Source> std::__1::__fs::filesystem::path::append(const _Source&) [with _Source = std::__1::basic_string<char>]':
nuttx/include/libcxx/__filesystem/path.h:623:30: error: use of built-in trait '__remove_pointer(typename std::__1::decay<_Tp>::type)' in function signature; use library traits instead
  623 |   _EnableIfPathable<_Source> append(const _Source& __src) {
      |                              ^~~~~~

Pick the change from llvm-project:

llvm/llvm-project#92663

Signed-off-by: chao an <anchao.archer@bytedance.com>
  • Loading branch information
anchao committed Feb 19, 2025
1 parent c9a8f96 commit d29a3e2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
35 changes: 35 additions & 0 deletions libs/libxx/libcxx/0001-libc-Fix-failures-with-GCC-14-92663.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From cb7a03b41fff563c0cbb5145eed09f9b17edf9e2 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser@berlin.de>
Date: Sat, 1 Jun 2024 12:20:41 +0200
Subject: [PATCH] [libc++] Fix failures with GCC 14 (#92663)

Fixes #91831

Signed-off-by: chao an <anchao.archer@bytedance.com>

---
libcxx/include/__type_traits/remove_pointer.h | 5 +++++
11 files changed, 22 insertions(+), 8 deletions(-)

diff --git libcxx/include/__type_traits/remove_pointer.h b/libcxx/include/__type_traits/remove_pointer.h
index 54390a1939f7..1048f67055a2 100644
--- libcxx/include/__type_traits/remove_pointer.h
+++ libcxx/include/__type_traits/remove_pointer.h
@@ -23,8 +23,13 @@ struct remove_pointer {
using type _LIBCPP_NODEBUG = __remove_pointer(_Tp);
};

+# ifdef _LIBCPP_COMPILER_GCC
+template <class _Tp>
+using __remove_pointer_t = typename remove_pointer<_Tp>::type;
+# else
template <class _Tp>
using __remove_pointer_t = __remove_pointer(_Tp);
+# endif
#else
// clang-format off
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;};

--
2.43.0

4 changes: 3 additions & 1 deletion libs/libxx/libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ if(CONFIG_LIBCXX)
-p1 -d ${CMAKE_CURRENT_LIST_DIR}/libcxx <
${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-fix-ld-errors.patch && patch -p1
-d ${CMAKE_CURRENT_LIST_DIR}/libcxx <
${CMAKE_CURRENT_LIST_DIR}/0001-Fix-build-error-about-__GLIBC__.patch
${CMAKE_CURRENT_LIST_DIR}/0001-Fix-build-error-about-__GLIBC__.patch &&
patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/libcxx <
${CMAKE_CURRENT_LIST_DIR}/0001-libc-Fix-failures-with-GCC-14-92663.patch
DOWNLOAD_NO_PROGRESS true
TIMEOUT 30)

Expand Down
1 change: 1 addition & 0 deletions libs/libxx/libcxx/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ libcxx/libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz
$(Q) patch -p0 < libcxx/0001-libcxx-remove-mach-time-h.patch -d libcxx
$(Q) patch -p0 < libcxx/0001-libcxx-fix-ld-errors.patch -d libcxx
$(Q) patch -p0 < libcxx/0001-Fix-build-error-about-__GLIBC__.patch -d libcxx
$(Q) patch -p0 < libcxx/0001-libc-Fix-failures-with-GCC-14-92663.patch -d libcxx

endif

Expand Down

0 comments on commit d29a3e2

Please sign in to comment.