libcxx: optional wide characters support.

Disable wchar can reduce approximately 1/3 of the libcxx.
mainly from locale, string and streams.

Platform: sim
Figures: bin size in bytes.

   Size   | Description
----------+------------------------------------------------
 10045336 | Base, enable libcxx whithout any cxx programs.
 42067224 | Add cxxtest.
 29997304 | Disable libcxx wchar support.

Signed-off-by: jihandong <jihandong@xiaomi.com>
This commit is contained in:
jihandong 2024-06-11 18:04:09 +08:00 committed by Xiang Xiao
parent 65aa5415a7
commit 100c43c8c3
3 changed files with 10 additions and 7 deletions

View File

@ -112,11 +112,10 @@ config CXX_EXCEPTION
config CXX_RTTI
bool "Enable RTTI Support"
if UCLIBCXX
config CXX_WCHAR
bool "Enable Wide Character Support"
config UCLIBCXX_WCHAR
bool "Enable Wide Stream Support"
default n
if UCLIBCXX
config UCLIBCXX_BUFSIZE
int "IO Stream/Container Buffer Size"

View File

@ -9,6 +9,8 @@
#ifndef _LIBCPP___CONFIG_SITE
#define _LIBCPP___CONFIG_SITE
#include <nuttx/config.h>
#define _LIBCPP_ABI_VERSION 1
#define _LIBCPP_ABI_NAMESPACE __1
/* #undef _LIBCPP_ABI_FORCE_ITANIUM */
@ -26,7 +28,9 @@
/* #undef _LIBCPP_HAS_NO_FILESYSTEM */
/* #undef _LIBCPP_HAS_NO_RANDOM_DEVICE */
/* #undef _LIBCPP_HAS_NO_LOCALIZATION */
/* #undef _LIBCPP_HAS_NO_WIDE_CHARACTERS */
#ifndef CONFIG_CXX_WCHAR
#define _LIBCPP_HAS_NO_WIDE_CHARACTERS
#endif
#define _LIBCPP_ENABLE_ASSERTIONS_DEFAULT 0
// PSTL backends

View File

@ -55,7 +55,7 @@
/* String and I/O Stream Support */
#ifdef CONFIG_UCLIBCXX_WCHAR
#ifdef CONFIG_CXX_WCHAR
# define __UCLIBCXX_HAS_WCHAR__ 1
#endif
#define __UCLIBCXX_IOSTREAM_BUFSIZE__ CONFIG_UCLIBCXX_BUFSIZE
@ -65,7 +65,7 @@
#define __UCLIBCXX_SUPPORT_COUT__ 1
#define __UCLIBCXX_SUPPORT_CERR__ 1
#define __UCLIBCXX_SUPPORT_CLOG__ 1
#ifdef CONFIG_UCLIBCXX_WCHAR
#ifdef CONFIG_CXX_WCHAR
# define __UCLIBCXX_SUPPORT_WCIN__ 1
# define __UCLIBCXX_SUPPORT_WCOUT__ 1
# define __UCLIBCXX_SUPPORT_WCERR__ 1