[libcxx-commits] [libcxx] f0785c1 - [libcxx] Port to NuttX (https://nuttx.apache.org) RTOS
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 18 13:22:04 PST 2020
Author: Xiang Xiao
Date: 2020-11-18T16:20:56-05:00
New Revision: f0785c1f7acd34ec6681f188afedc9be89ba0cc4
URL: https://github.com/llvm/llvm-project/commit/f0785c1f7acd34ec6681f188afedc9be89ba0cc4
DIFF: https://github.com/llvm/llvm-project/commit/f0785c1f7acd34ec6681f188afedc9be89ba0cc4.diff
LOG: [libcxx] Port to NuttX (https://nuttx.apache.org) RTOS
Since NuttX conform to POSIX standard, the code need to add is very simple.
Differential Revision: https://reviews.llvm.org/D88718
Added:
libcxx/include/support/nuttx/xlocale.h
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/__config
libcxx/include/__locale
libcxx/src/include/config_elast.h
libcxx/src/locale.cpp
Removed:
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 1c3468e7f595..e0f05da65996 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -154,6 +154,7 @@ set(files
support/ibm/xlocale.h
support/musl/xlocale.h
support/newlib/xlocale.h
+ support/nuttx/xlocale.h
support/solaris/floatingpoint.h
support/solaris/wchar.h
support/solaris/xlocale.h
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 00068973bf26..59aa922df5da 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1121,6 +1121,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__) || \
@@ -1223,7 +1224,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) || \
defined(__MVS__)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index d4f3cda08c98..fd09206b6c5d 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -22,6 +22,8 @@
#if defined(_LIBCPP_MSVCRT_LIKE)
# include <cstring>
# include <support/win32/locale_win32.h>
+#elif defined(__NuttX__)
+# include <support/nuttx/xlocale.h>
#elif defined(_AIX) || defined(__MVS__)
# include <support/ibm/xlocale.h>
#elif defined(__ANDROID__)
diff --git a/libcxx/include/support/nuttx/xlocale.h b/libcxx/include/support/nuttx/xlocale.h
new file mode 100644
index 000000000000..b70d62005046
--- /dev/null
+++ b/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 <support/xlocale/__posix_l_fallback.h>
+#include <support/xlocale/__strtonum_fallback.h>
+#endif // __NuttX__
+
+#endif
diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h
index 501cbc4ffeba..3113f9fb5cd1 100644
--- a/libcxx/src/include/config_elast.h
+++ b/libcxx/src/include/config_elast.h
@@ -17,10 +17,14 @@
#include <errno.h>
#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/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 5fdc14992f80..ed93727b5441 100644
--- a/libcxx/src/locale.cpp
+++ b/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 <langinfo.h>
#endif
#include <stdlib.h>
More information about the libcxx-commits
mailing list