From a81166aef6ccd4993e22619fc54ea3451b3a0236 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 13 May 2021 17:52:38 +0800 Subject: [PATCH] Update libcxx to 12.0.0 release and remove the temporary patch since all patch is in the mainline now Signed-off-by: Xiang Xiao --- boards/sim/sim/sim/scripts/Make.defs | 5 +- libs/libxx/0001-libc-Fix-a-few-warnings.patch | 43 ------ ...ailing-with-Clang-after-removing-GCC.patch | 26 ---- ...veral-GCC-warnings-in-the-test-suite.patch | 135 ------------------ ...BCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch | 78 ---------- ...to-NuttX-https-nuttx.apache.org-RTOS.patch | 112 --------------- libs/libxx/libcxx.defs | 7 +- 7 files changed, 4 insertions(+), 402 deletions(-) delete mode 100644 libs/libxx/0001-libc-Fix-a-few-warnings.patch delete mode 100644 libs/libxx/0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch delete mode 100644 libs/libxx/0001-libc-NFC-Fix-several-GCC-warnings-in-the-test-suite.patch delete mode 100644 libs/libxx/0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch delete mode 100644 libs/libxx/0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index 1e78f7951a..bd17433803 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -108,14 +108,15 @@ CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) \ AFLAGS := $(CFLAGS) -D__ASSEMBLY__ ifeq ($(CONFIG_LIBCXX),y) - # Why c++14? + # Why c++17? # * libcxx seems to require c++11. # * The compiler defaults varies: # clang/macOS (from xcode): 199711L # gcc/ubuntu: 201402L # * There is a precedent to use c++14. # (boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs) - CXXFLAGS += -std=c++14 + # * libs/libxx/libcxx/src/barrier.cpp depends on aligned new + CXXFLAGS += -std=c++17 ifeq ($(CONFIG_HOST_MACOS),y) # macOS uses libc++abi diff --git a/libs/libxx/0001-libc-Fix-a-few-warnings.patch b/libs/libxx/0001-libc-Fix-a-few-warnings.patch deleted file mode 100644 index b7bb109a01..0000000000 --- a/libs/libxx/0001-libc-Fix-a-few-warnings.patch +++ /dev/null @@ -1,43 +0,0 @@ -From acd7be74ca12f8f08e52d6d80850a9b230109134 Mon Sep 17 00:00:00 2001 -From: YAMAMOTO Takashi -Date: Wed, 28 Oct 2020 15:40:16 -0400 -Subject: [PATCH] [libc++] Fix a few warnings - -Found during a NuttX porting effort. -But these changes are not directly relevant to NuttX. - -Differential Revision: https://reviews.llvm.org/D90139 ---- - src/filesystem/operations.cpp | 2 +- - src/locale.cpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/filesystem/operations.cpp libcxx/src/filesystem/operations.cpp -index 95d7d0d9642..788e31b673a 100644 ---- a/src/filesystem/operations.cpp -+++ libcxx/src/filesystem/operations.cpp -@@ -534,7 +534,7 @@ path __canonical(path const& orig_p, error_code* ec) { - ErrorHandler err("canonical", ec, &orig_p, &cwd); - - path p = __do_absolute(orig_p, &cwd, ec); --#if _POSIX_VERSION >= 200112 -+#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112 - std::unique_ptr - hold(::realpath(p.c_str(), nullptr), &::free); - if (hold.get() == nullptr) -diff --git a/src/locale.cpp libcxx/src/locale.cpp -index b9180880e49..02dbb334ff8 100644 ---- a/src/locale.cpp -+++ libcxx/src/locale.cpp -@@ -1149,7 +1149,7 @@ ctype::__classic_upper_table() _NOEXCEPT - { - return _LIBCPP_GET_C_LOCALE->__ctype_toupper; - } --#elif __NetBSD__ -+#elif defined(__NetBSD__) - const short* - ctype::__classic_lower_table() _NOEXCEPT - { --- -2.17.1 - diff --git a/libs/libxx/0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch b/libs/libxx/0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch deleted file mode 100644 index 5e28838811..0000000000 --- a/libs/libxx/0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 81b6aa0e27abc3037c84d1ff2065bf60207f9b8b Mon Sep 17 00:00:00 2001 -From: Louis Dionne -Date: Fri, 30 Oct 2020 14:55:37 -0400 -Subject: [PATCH] [libc++] Fix tests failing with Clang after removing GCC - warnings - ---- - src/filesystem/filesystem_common.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/filesystem/filesystem_common.h libcxx/src/filesystem/filesystem_common.h -index a7828ef3863..dc55f93da70 100644 ---- a/src/filesystem/filesystem_common.h -+++ libcxx/src/filesystem/filesystem_common.h -@@ -198,7 +198,7 @@ private: - using chrono::duration; - using chrono::duration_cast; - --using TimeSpec = std::timespec; -+using TimeSpec = timespec; - using StatT = struct stat; - - template -Date: Fri, 30 Oct 2020 11:19:07 -0400 -Subject: [PATCH] [libc++] NFC: Fix several GCC warnings in the test suite - -- Several -Wshadow warnings -- Several places where we did not initialize our base class explicitly -- Unused variable warnings -- Some tautological comparisons -- Some places where we'd pass null arguments to functions expecting - non-null (in unevaluated contexts) -- Add a few pragmas to turn off spurious warnings -- Fix warnings about declarations that don't declare anything -- Properly disable deprecation warnings in ext/ tests (the pragmas we - were using didn't work on GCC) -- Disable include_as_c.sh.cpp because GCC complains about C++ flags - when compiling as C. I couldn't find a way to fix this one properly, - so I'm disabling the test. This isn't great, but at least we'll be - able to enable warnings in the whole test suite with GCC. ---- - src/filesystem/filesystem_common.h | 55 ++++++++++++----------- - 1 file changed, 28 insertions(+), 27 deletions(-) - -diff --git a/src/filesystem/filesystem_common.h libcxx/src/filesystem/filesystem_common.h -index fe5c42f5e6d..a7828ef3863 100644 ---- a/src/filesystem/filesystem_common.h -+++ libcxx/src/filesystem/filesystem_common.h -@@ -13,8 +13,9 @@ - #include "filesystem" - #include "array" - #include "chrono" --#include "cstdlib" - #include "climits" -+#include "cstdlib" -+#include "ctime" - - #include - #include -@@ -47,7 +48,7 @@ static string format_string_imp(const char* msg, ...) { - struct GuardVAList { - va_list& target; - bool active = true; -- GuardVAList(va_list& target) : target(target), active(true) {} -+ GuardVAList(va_list& tgt) : target(tgt), active(true) {} - void clear() { - if (active) - va_end(target); -@@ -134,50 +135,50 @@ path error_value() { - - template - struct ErrorHandler { -- const char* func_name; -- error_code* ec = nullptr; -- const path* p1 = nullptr; -- const path* p2 = nullptr; -+ const char* func_name_; -+ error_code* ec_ = nullptr; -+ const path* p1_ = nullptr; -+ const path* p2_ = nullptr; - - ErrorHandler(const char* fname, error_code* ec, const path* p1 = nullptr, - const path* p2 = nullptr) -- : func_name(fname), ec(ec), p1(p1), p2(p2) { -- if (ec) -- ec->clear(); -+ : func_name_(fname), ec_(ec), p1_(p1), p2_(p2) { -+ if (ec_) -+ ec_->clear(); - } - -- T report(const error_code& m_ec) const { -- if (ec) { -- *ec = m_ec; -+ T report(const error_code& ec) const { -+ if (ec_) { -+ *ec_ = ec; - return error_value(); - } -- string what = string("in ") + func_name; -- switch (bool(p1) + bool(p2)) { -+ string what = string("in ") + func_name_; -+ switch (bool(p1_) + bool(p2_)) { - case 0: -- __throw_filesystem_error(what, m_ec); -+ __throw_filesystem_error(what, ec); - case 1: -- __throw_filesystem_error(what, *p1, m_ec); -+ __throw_filesystem_error(what, *p1_, ec); - case 2: -- __throw_filesystem_error(what, *p1, *p2, m_ec); -+ __throw_filesystem_error(what, *p1_, *p2_, ec); - } - _LIBCPP_UNREACHABLE(); - } - - template -- T report(const error_code& m_ec, const char* msg, Args const&... args) const { -- if (ec) { -- *ec = m_ec; -+ T report(const error_code& ec, const char* msg, Args const&... args) const { -+ if (ec_) { -+ *ec_ = ec; - return error_value(); - } - string what = -- string("in ") + func_name + ": " + format_string(msg, args...); -- switch (bool(p1) + bool(p2)) { -+ string("in ") + func_name_ + ": " + format_string(msg, args...); -+ switch (bool(p1_) + bool(p2_)) { - case 0: -- __throw_filesystem_error(what, m_ec); -+ __throw_filesystem_error(what, ec); - case 1: -- __throw_filesystem_error(what, *p1, m_ec); -+ __throw_filesystem_error(what, *p1_, ec); - case 2: -- __throw_filesystem_error(what, *p1, *p2, m_ec); -+ __throw_filesystem_error(what, *p1_, *p2_, ec); - } - _LIBCPP_UNREACHABLE(); - } -@@ -197,8 +198,8 @@ private: - using chrono::duration; - using chrono::duration_cast; - --using TimeSpec = struct ::timespec; --using StatT = struct ::stat; -+using TimeSpec = std::timespec; -+using StatT = struct stat; - - template ::value> --- -2.17.1 - diff --git a/libs/libxx/0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch b/libs/libxx/0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch deleted file mode 100644 index 8757259028..0000000000 --- a/libs/libxx/0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 3e8b517a509ae043571d8d0b00625d8a03eb5d05 Mon Sep 17 00:00:00 2001 -From: Xiang Xiao -Date: Mon, 9 Nov 2020 21:45:57 +0800 -Subject: [PATCH] [libcxx] Check _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE first in - __locale - -just like what's done in __locale.cpp - -Co-authored-by: Chao An - -Signed-off-by: Xiang Xiao - -Differential Revision: https://reviews.llvm.org/D91074 ---- - include/__locale | 40 +++++++++++++++++++++------------------- - 1 file changed, 21 insertions(+), 19 deletions(-) - -diff --git a/include/__locale libcxx/include/__locale -index 125adcf68c8..e973ce52646 100644 ---- a/include/__locale -+++ libcxx/include/__locale -@@ -397,7 +397,26 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, - class _LIBCPP_TYPE_VIS ctype_base - { - public: --#if defined(__GLIBC__) -+#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE) -+ typedef unsigned long mask; -+ static const mask space = 1<<0; -+ static const mask print = 1<<1; -+ static const mask cntrl = 1<<2; -+ static const mask upper = 1<<3; -+ static const mask lower = 1<<4; -+ static const mask alpha = 1<<5; -+ static const mask digit = 1<<6; -+ static const mask punct = 1<<7; -+ static const mask xdigit = 1<<8; -+ static const mask blank = 1<<9; -+#if defined(__BIONIC__) -+ // Historically this was a part of regex_traits rather than ctype_base. The -+ // historical value of the constant is preserved for ABI compatibility. -+ static const mask __regex_word = 0x8000; -+#else -+ static const mask __regex_word = 1<<10; -+#endif // defined(__BIONIC__) -+#elif defined(__GLIBC__) - typedef unsigned short mask; - static const mask space = _ISspace; - static const mask print = _ISprint; -@@ -486,24 +505,7 @@ public: - # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA - # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT - #else -- typedef unsigned long mask; -- static const mask space = 1<<0; -- static const mask print = 1<<1; -- static const mask cntrl = 1<<2; -- static const mask upper = 1<<3; -- static const mask lower = 1<<4; -- static const mask alpha = 1<<5; -- static const mask digit = 1<<6; -- static const mask punct = 1<<7; -- static const mask xdigit = 1<<8; -- static const mask blank = 1<<9; --#if defined(__BIONIC__) -- // Historically this was a part of regex_traits rather than ctype_base. The -- // historical value of the constant is preserved for ABI compatibility. -- static const mask __regex_word = 0x8000; --#else -- static const mask __regex_word = 1<<10; --#endif // defined(__BIONIC__) -+#error unkown classic_table, try _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE - #endif - static const mask alnum = alpha | digit; - static const mask graph = alnum | punct; --- -2.17.1 - diff --git a/libs/libxx/0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch b/libs/libxx/0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch deleted file mode 100644 index b8f0efd7b5..0000000000 --- a/libs/libxx/0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 6b12d8b5c30a84aa5767b1b18ecf5ba5e99a1654 Mon Sep 17 00:00:00 2001 -From: Xiang Xiao -Date: Fri, 2 Oct 2020 13:25:43 +0800 -Subject: [PATCH] [libcxx] Port to NuttX(https://nuttx.apache.org/) RTOS - -Since NuttX conform to POSIX standard, the code need to add is very simple - -Co-authored-by: YAMAMOTO Takashi - -Differential Revision: https://reviews.llvm.org/D88718 ---- - include/__config | 3 ++- - include/__locale | 2 ++ - include/support/nuttx/xlocale.h | 18 ++++++++++++++++++ - src/include/config_elast.h | 4 ++++ - src/locale.cpp | 2 +- - 5 files changed, 27 insertions(+), 2 deletions(-) - create mode 100644 include/support/nuttx/xlocale.h - -diff --git a/include/__config libcxx/include/__config -index eeef9c53a9f..9ace3b46028 100644 ---- a/include/__config -+++ libcxx/include/__config -@@ -1117,6 +1117,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( - # if defined(__FreeBSD__) || \ - defined(__wasi__) || \ - defined(__NetBSD__) || \ -+ defined(__NuttX__) || \ - defined(__linux__) || \ - defined(__GNU__) || \ - defined(__APPLE__) || \ -@@ -1219,7 +1220,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( - # endif - #endif - --#if defined(__BIONIC__) || defined(__CloudABI__) || \ -+#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \ - defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) - #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE - #endif -diff --git a/include/__locale libcxx/include/__locale -index 125adcf68c8..ebededf066b 100644 ---- a/include/__locale -+++ libcxx/include/__locale -@@ -22,6 +22,8 @@ - #if defined(_LIBCPP_MSVCRT_LIKE) - # include - # include -+#elif defined(__NuttX__) -+# include - #elif defined(_AIX) - # include - #elif defined(__ANDROID__) -diff --git a/include/support/nuttx/xlocale.h libcxx/include/support/nuttx/xlocale.h -new file mode 100644 -index 00000000000..b70d6200504 ---- /dev/null -+++ libcxx/include/support/nuttx/xlocale.h -@@ -0,0 +1,18 @@ -+// -*- C++ -*- -+//===-------------------- support/nuttx/xlocale.h -------------------------===// -+// -+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -+// See https://llvm.org/LICENSE.txt for license information. -+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -+// -+//===----------------------------------------------------------------------===// -+ -+#ifndef _LIBCPP_SUPPORT_NUTTX_XLOCALE_H -+#define _LIBCPP_SUPPORT_NUTTX_XLOCALE_H -+ -+#if defined(__NuttX__) -+#include -+#include -+#endif // __NuttX__ -+ -+#endif -diff --git a/src/include/config_elast.h libcxx/src/include/config_elast.h -index 501cbc4ffeb..3113f9fb5cd 100644 ---- a/src/include/config_elast.h -+++ libcxx/src/include/config_elast.h -@@ -17,10 +17,14 @@ - #include - #endif - -+// Note: _LIBCPP_ELAST needs to be defined only on platforms -+// where strerror/strerror_r can't handle out-of-range errno values. - #if defined(ELAST) - #define _LIBCPP_ELAST ELAST - #elif defined(_NEWLIB_VERSION) - #define _LIBCPP_ELAST __ELASTERROR -+#elif defined(__NuttX__) -+// No _LIBCPP_ELAST needed on NuttX - #elif defined(__Fuchsia__) - // No _LIBCPP_ELAST needed on Fuchsia - #elif defined(__wasi__) -diff --git a/src/locale.cpp libcxx/src/locale.cpp -index 5fdc14992f8..ed93727b544 100644 ---- a/src/locale.cpp -+++ libcxx/src/locale.cpp -@@ -30,7 +30,7 @@ - #include "__sso_allocator" - #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) - #include "support/win32/locale_win32.h" --#elif !defined(__BIONIC__) -+#elif !defined(__BIONIC__) && !defined(__NuttX__) - #include - #endif - #include --- -2.17.1 - diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs index 21ca57f3fc..9b845a7bde 100644 --- a/libs/libxx/libcxx.defs +++ b/libs/libxx/libcxx.defs @@ -18,7 +18,7 @@ # ########################################################################### -VERSION=11.0.0 +VERSION=12.0.0 libcxx-$(VERSION).src.tar.xz: $(Q) curl -O -L https://github.com/llvm/llvm-project/releases/download/llvmorg-$(VERSION)/libcxx-$(VERSION).src.tar.xz @@ -26,11 +26,6 @@ libcxx-$(VERSION).src.tar.xz: libcxx: libcxx-$(VERSION).src.tar.xz $(Q) tar -xf libcxx-$(VERSION).src.tar.xz $(Q) mv libcxx-$(VERSION).src libcxx - $(Q) patch -p0 < 0001-libc-Fix-a-few-warnings.patch - $(Q) patch -p0 < 0001-libc-NFC-Fix-several-GCC-warnings-in-the-test-suite.patch - $(Q) patch -p0 < 0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch - $(Q) patch -p0 < 0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch - $(Q) patch -p0 < 0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch $(Q) touch $@ $(TOPDIR)/include/libcxx: libcxx