You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/11/15 11:29:40 UTC

[incubator-nuttx] branch master updated (81abbcb -> e70bff7)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 81abbcb  boards: sabre-6quad: Add CONFIG_TESTING_GETPRIME=y to smp/defconfig
     new 8bc4a5b  [libc++] Cherry pick patches from mainline to fix warnings
     new b827565  [libc++] Move the toolchain's macros undefinition to Make.defs
     new 3ccbcf3  sim: Add a config to test libcxx
     new e70bff7  board/sim: Remove the too strict warning

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../sim/configs/{vpnkit => libcxxtest}/defconfig   |   7 +-
 boards/sim/sim/sim/scripts/Make.defs               |  24 +++-
 libs/libxx/0001-libc-Fix-a-few-warnings.patch      |  43 +++++++
 ...sts-failing-with-Clang-after-removing-GCC.patch |  26 ++++
 ...ix-several-GCC-warnings-in-the-test-suite.patch | 135 +++++++++++++++++++++
 ...k-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch |  78 ++++++++++++
 ...Port-to-NuttX-https-nuttx.apache.org-RTOS.patch |  55 ++-------
 libs/libxx/libcxx.defs                             |   4 +
 8 files changed, 323 insertions(+), 49 deletions(-)
 copy boards/sim/sim/sim/configs/{vpnkit => libcxxtest}/defconfig (94%)
 create mode 100644 libs/libxx/0001-libc-Fix-a-few-warnings.patch
 create mode 100644 libs/libxx/0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch
 create mode 100644 libs/libxx/0001-libc-NFC-Fix-several-GCC-warnings-in-the-test-suite.patch
 create mode 100644 libs/libxx/0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch


[incubator-nuttx] 04/04: board/sim: Remove the too strict warning

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit e70bff723b5e2eecb741f43bb2ecc5a220d3bf8c
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Nov 11 21:19:16 2020 +0800

    board/sim: Remove the too strict warning
    
    The variable shadow is a frequently-used feature
    (especially in c++), so let's disable this warning
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 boards/sim/sim/sim/scripts/Make.defs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs
index 68b407d..f7dc836 100644
--- a/boards/sim/sim/sim/scripts/Make.defs
+++ b/boards/sim/sim/sim/scripts/Make.defs
@@ -59,8 +59,8 @@ ifeq ($(CONFIG_CXX_EXCEPTION),)
   ARCHCPUFLAGSXX += -fno-exceptions
 endif
 ARCHPICFLAGS = -fpic
-ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
-ARCHWARNINGSXX = -Wall -Wshadow -Wundef
+ARCHWARNINGS = -Wstrict-prototypes -Wundef
+ARCHWARNINGSXX = -Wundef
 
 # Add -fvisibility=hidden
 # Because we don't want export nuttx's symbols to share libraries


[incubator-nuttx] 03/04: sim: Add a config to test libcxx

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 3ccbcf3c28e041bf3552ac4c1696fff35fadb4b8
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Oct 22 12:51:43 2020 +0900

    sim: Add a config to test libcxx
---
 boards/sim/sim/sim/configs/libcxxtest/defconfig | 106 ++++++++++++++++++++++++
 1 file changed, 106 insertions(+)

diff --git a/boards/sim/sim/sim/configs/libcxxtest/defconfig b/boards/sim/sim/sim/configs/libcxxtest/defconfig
new file mode 100644
index 0000000..19d6155
--- /dev/null
+++ b/boards/sim/sim/sim/configs/libcxxtest/defconfig
@@ -0,0 +1,106 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_CXX_EXCEPTION is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="sim"
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+CONFIG_ARCH_CHIP="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_BOARDCTL_APP_SYMTAB=y
+CONFIG_BOARDCTL_POWEROFF=y
+CONFIG_BOARD_LOOPSPERMSEC=0
+CONFIG_BOOT_RUNFROMEXTSRAM=y
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_BINFMT=y
+CONFIG_DEBUG_BINFMT_ERROR=y
+CONFIG_DEBUG_BINFMT_INFO=y
+CONFIG_DEBUG_BINFMT_WARN=y
+CONFIG_DEBUG_ERROR=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEBUG_WARN=y
+CONFIG_DEV_LOOP=y
+CONFIG_DEV_ZERO=y
+CONFIG_DHCPC_RENEW_STACKSIZE=4096
+CONFIG_EXAMPLES_HELLO=y
+CONFIG_EXAMPLES_HELLOXX=y
+CONFIG_EXAMPLES_NETTEST=y
+CONFIG_FSUTILS_PASSWD=y
+CONFIG_FSUTILS_PASSWD_READONLY=y
+CONFIG_FS_BINFS=y
+CONFIG_FS_HOSTFS=y
+CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
+CONFIG_HAVE_CXX=y
+CONFIG_HOST_MACOS=y
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_IOB_NOTIFIER=y
+CONFIG_LIBCXX=y
+CONFIG_LIBC_EXECFUNCS=y
+CONFIG_LIB_ENVPATH=y
+CONFIG_MAX_TASKS=64
+CONFIG_MM_FILL_ALLOCATIONS=y
+CONFIG_NET=y
+CONFIG_NETDB_DNSCLIENT=y
+CONFIG_NETDEV_IFINDEX=y
+CONFIG_NETDEV_PHY_IOCTL=y
+CONFIG_NETDOWN_NOTIFIER=y
+CONFIG_NETINIT_DHCPC=y
+CONFIG_NET_ARP_SEND=y
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_SOCKET=y
+CONFIG_NET_ICMPv6=y
+CONFIG_NET_ICMPv6_AUTOCONF=y
+CONFIG_NET_ICMPv6_NEIGHBOR=y
+CONFIG_NET_ICMPv6_ROUTER=y
+CONFIG_NET_ICMPv6_SOCKET=y
+CONFIG_NET_IPv6=y
+CONFIG_NET_LOCAL=y
+CONFIG_NET_PROMISCUOUS=y
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_NOTIFIER=y
+CONFIG_NET_TCP_WRITE_BUFFERS=y
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_NOTIFIER=y
+CONFIG_NFILE_DESCRIPTORS=32
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_ARCHROMFS=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_READLINE=y
+CONFIG_NSH_ROMFSDEVNO=1
+CONFIG_NSH_ROMFSETC=y
+CONFIG_PATH_INITIAL="/bin"
+CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
+CONFIG_READLINE_TABCOMPLETION=y
+CONFIG_RTC=y
+CONFIG_RTC_ARCH=y
+CONFIG_RTC_DATETIME=y
+CONFIG_RTC_DRIVER=y
+CONFIG_SCHED_HAVE_PARENT=y
+CONFIG_SCHED_LPWORKSTACKSIZE=4096
+CONFIG_SCHED_ONEXIT=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SDCLONE_DISABLE=y
+CONFIG_START_MONTH=6
+CONFIG_START_YEAR=2008
+CONFIG_STDIO_DISABLE_BUFFERING=y
+CONFIG_SYSLOG_CONSOLE=y
+CONFIG_SYSTEM_DHCPC_RENEW=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_STACKSIZE=4096
+CONFIG_SYSTEM_PING=y
+CONFIG_SYSTEM_PING_STACKSIZE=4096
+CONFIG_TESTING_CXXTEST=y
+CONFIG_USERMAIN_STACKSIZE=4096
+CONFIG_USER_ENTRYPOINT="nsh_main"


[incubator-nuttx] 02/04: [libc++] Move the toolchain's macros undefinition to Make.defs

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b82756539623c2561c0ab612b2089e111399cbd0
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Nov 11 23:55:37 2020 +0800

    [libc++] Move the toolchain's macros undefinition to Make.defs
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 boards/sim/sim/sim/scripts/Make.defs               | 20 +++++++-
 ...Port-to-NuttX-https-nuttx.apache.org-RTOS.patch | 55 ++++------------------
 2 files changed, 29 insertions(+), 46 deletions(-)

diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs
index 9b31d9f..68b407d 100644
--- a/boards/sim/sim/sim/scripts/Make.defs
+++ b/boards/sim/sim/sim/scripts/Make.defs
@@ -23,6 +23,24 @@ include $(TOPDIR)/tools/Config.mk
 
 HOSTOS = ${shell uname -o 2>/dev/null || uname -s 2>/dev/null || echo "Other"}
 
+# NuttX is sometimes built as a native target.
+# In that case, the __NuttX__ macro is predefined by the compiler.
+# https://github.com/NuttX/buildroot
+#
+# In other cases, __NuttX__ is an ordinary user-definded macro.
+# It's especially the case for NuttX sim, which is a target to run
+# the entire NuttX as a program on the host OS, which can be Linux,
+# macOS, Windows, etc.
+# https://cwiki.apache.org/confluence/display/NUTTX/NuttX+Simulation
+# In that case, the host OS compiler is used to build NuttX.
+# Thus, eg. NuttX sim on macOS is built with __APPLE__.
+# We #undef predefined macros for those possible host OSes here
+# because the OS APIs this library should use are of NuttX,
+# not the host OS.
+
+ARCHDEFINES += -U_AIX -U_WIN32 -U__APPLE__ -U__FreeBSD__
+ARCHDEFINES += -U__NetBSD__ -U__linux__ -U__sun__ -U__unix__
+
 ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
   ARCHOPTIMIZATION = -g
 endif
@@ -146,4 +164,4 @@ ifeq ($(CONFIG_SIM_M32),y)
 endif
 
 HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
-   $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
+   $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(EXTRAFLAGS) -pipe
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
index 964ce7c..b8f0efd 100644
--- 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
@@ -1,4 +1,4 @@
-From 10891b1c9eda0c87e33b0c0ba87f17a83930093c Mon Sep 17 00:00:00 2001
+From 6b12d8b5c30a84aa5767b1b18ecf5ba5e99a1654 Mon Sep 17 00:00:00 2001
 From: Xiang Xiao <xi...@xiaomi.com>
 Date: Fri, 2 Oct 2020 13:25:43 +0800
 Subject: [PATCH] [libcxx] Port to NuttX(https://nuttx.apache.org/) RTOS
@@ -9,54 +9,19 @@ Co-authored-by: YAMAMOTO Takashi <ya...@midokura.com>
 
 Differential Revision: https://reviews.llvm.org/D88718
 ---
- include/__config                | 31 +++++++++++++++++++++++++-
+ include/__config                |  3 ++-
  include/__locale                |  2 ++
- include/support/nuttx/xlocale.h | 18 +++++++++++++++
+ include/support/nuttx/xlocale.h | 18 ++++++++++++++++++
  src/include/config_elast.h      |  4 ++++
  src/locale.cpp                  |  2 +-
- 5 files changed, 55 insertions(+), 2 deletions(-)
+ 5 files changed, 27 insertions(+), 2 deletions(-)
  create mode 100644 include/support/nuttx/xlocale.h
 
 diff --git a/include/__config libcxx/include/__config
-index 575147cead4..32036094017 100644
+index eeef9c53a9f..9ace3b46028 100644
 --- a/include/__config
 +++ libcxx/include/__config
-@@ -10,6 +10,34 @@
- #ifndef _LIBCPP_CONFIG
- #define _LIBCPP_CONFIG
- 
-+// NuttX is sometimes built as a native target.
-+// In that case, the __NuttX__ macro is predefined by the compiler.
-+// https://github.com/NuttX/buildroot
-+//
-+// In other cases, __NuttX__ is an ordinary user-definded macro.
-+// It's especially the case for NuttX sim, which is a target to run
-+// the entire NuttX as a program on the host OS, which can be Linux,
-+// macOS, Windows, etc.
-+// https://cwiki.apache.org/confluence/display/NUTTX/NuttX+Simulation
-+// In that case, the host OS compiler is used to build NuttX.
-+// Thus, eg. NuttX sim on macOS is built with __APPLE__.
-+// We #undef predefined macros for those possible host OSes here
-+// because the OS APIs this library should use are of NuttX,
-+// not the host OS.
-+#if defined(__NuttX__)
-+#undef __linux__
-+#undef __APPLE__
-+#undef __FreeBSD__
-+#undef __NetBSD__
-+#undef _WIN32
-+#undef __sun__
-+#undef _AIX
-+// For the current use of the __unix__ macro in this library,
-+// NuttX is not __unix__.
-+// This might need to be revisited in future.
-+#undef __unix__
-+#endif
-+
- #if defined(_MSC_VER) && !defined(__clang__)
- #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- #    define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-@@ -1125,6 +1153,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
+@@ -1117,6 +1117,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
  #  if defined(__FreeBSD__) || \
        defined(__wasi__) || \
        defined(__NetBSD__) || \
@@ -64,7 +29,7 @@ index 575147cead4..32036094017 100644
        defined(__linux__) || \
        defined(__GNU__) || \
        defined(__APPLE__) || \
-@@ -1227,7 +1256,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
+@@ -1219,7 +1220,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
  #  endif
  #endif
  
@@ -74,10 +39,10 @@ index 575147cead4..32036094017 100644
  #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
  #endif
 diff --git a/include/__locale libcxx/include/__locale
-index 6d10fa4d3d6..fb391861f23 100644
+index 125adcf68c8..ebededf066b 100644
 --- a/include/__locale
 +++ libcxx/include/__locale
-@@ -21,6 +21,8 @@
+@@ -22,6 +22,8 @@
  #if defined(_LIBCPP_MSVCRT_LIKE)
  # include <cstring>
  # include <support/win32/locale_win32.h>
@@ -130,7 +95,7 @@ index 501cbc4ffeb..3113f9fb5cd 100644
  // No _LIBCPP_ELAST needed on Fuchsia
  #elif defined(__wasi__)
 diff --git a/src/locale.cpp libcxx/src/locale.cpp
-index b9180880e49..25699f29ec9 100644
+index 5fdc14992f8..ed93727b544 100644
 --- a/src/locale.cpp
 +++ libcxx/src/locale.cpp
 @@ -30,7 +30,7 @@


[incubator-nuttx] 01/04: [libc++] Cherry pick patches from mainline to fix warnings

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8bc4a5b08adf3d6e697db51babbcf4ab80c74d67
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Nov 11 20:37:45 2020 +0800

    [libc++] Cherry pick patches from mainline to fix warnings
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libxx/0001-libc-Fix-a-few-warnings.patch      |  43 +++++++
 ...sts-failing-with-Clang-after-removing-GCC.patch |  26 ++++
 ...ix-several-GCC-warnings-in-the-test-suite.patch | 135 +++++++++++++++++++++
 ...k-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch |  78 ++++++++++++
 libs/libxx/libcxx.defs                             |   4 +
 5 files changed, 286 insertions(+)

diff --git a/libs/libxx/0001-libc-Fix-a-few-warnings.patch b/libs/libxx/0001-libc-Fix-a-few-warnings.patch
new file mode 100644
index 0000000..b7bb109
--- /dev/null
+++ b/libs/libxx/0001-libc-Fix-a-few-warnings.patch
@@ -0,0 +1,43 @@
+From acd7be74ca12f8f08e52d6d80850a9b230109134 Mon Sep 17 00:00:00 2001
+From: YAMAMOTO Takashi <ya...@midokura.com>
+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<path> 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<char, decltype(&::free)>
+     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<char>::__classic_upper_table() _NOEXCEPT
+ {
+     return _LIBCPP_GET_C_LOCALE->__ctype_toupper;
+ }
+-#elif __NetBSD__
++#elif defined(__NetBSD__)
+ const short*
+ ctype<char>::__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
new file mode 100644
index 0000000..5e28838
--- /dev/null
+++ b/libs/libxx/0001-libc-Fix-tests-failing-with-Clang-after-removing-GCC.patch
@@ -0,0 +1,26 @@
+From 81b6aa0e27abc3037c84d1ff2065bf60207f9b8b Mon Sep 17 00:00:00 2001
+From: Louis Dionne <ld...@apple.com>
+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 <class FileTimeT, class TimeT,
+-- 
+2.17.1
+
diff --git a/libs/libxx/0001-libc-NFC-Fix-several-GCC-warnings-in-the-test-suite.patch b/libs/libxx/0001-libc-NFC-Fix-several-GCC-warnings-in-the-test-suite.patch
new file mode 100644
index 0000000..e412923
--- /dev/null
+++ b/libs/libxx/0001-libc-NFC-Fix-several-GCC-warnings-in-the-test-suite.patch
@@ -0,0 +1,135 @@
+From c479e0c99459e4c5596c2a22829d0937224df0bf Mon Sep 17 00:00:00 2001
+From: Louis Dionne <ld...@apple.com>
+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 <unistd.h>
+ #include <sys/stat.h>
+@@ -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<path>() {
+ 
+ template <class T>
+ 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<T>();
+     }
+-    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 <class... Args>
+-  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<T>();
+     }
+     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 <class FileTimeT, class TimeT,
+           bool IsFloat = is_floating_point<typename FileTimeT::rep>::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
new file mode 100644
index 0000000..8757259
--- /dev/null
+++ b/libs/libxx/0001-libcxx-Check-_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE-fir.patch
@@ -0,0 +1,78 @@
+From 3e8b517a509ae043571d8d0b00625d8a03eb5d05 Mon Sep 17 00:00:00 2001
+From: Xiang Xiao <xi...@xiaomi.com>
+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 <an...@xiaomi.com>
+
+Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
+
+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/libcxx.defs b/libs/libxx/libcxx.defs
index 82c9179..a96b983 100644
--- a/libs/libxx/libcxx.defs
+++ b/libs/libxx/libcxx.defs
@@ -25,6 +25,10 @@ $(TOPDIR)/include/libcxx:
 	$(Q) tar -xf libcxx-$(VERSION).src.tar.xz
 	$(Q) $(DELFILE) 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) $(DIRLINK) $(CURDIR)/libcxx/include $(TOPDIR)/include/libcxx