From 100c43c8c36700f9fbc91551185400afa9981bc8 Mon Sep 17 00:00:00 2001 From: jihandong Date: Tue, 11 Jun 2024 18:04:09 +0800 Subject: [PATCH] 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 --- libs/libxx/Kconfig | 7 +++---- libs/libxx/__config_site | 6 +++++- libs/libxx/system_configuration.h | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig index 35017bcffb..8bbd396a04 100644 --- a/libs/libxx/Kconfig +++ b/libs/libxx/Kconfig @@ -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" diff --git a/libs/libxx/__config_site b/libs/libxx/__config_site index a151662f44..c099b5b66c 100644 --- a/libs/libxx/__config_site +++ b/libs/libxx/__config_site @@ -9,6 +9,8 @@ #ifndef _LIBCPP___CONFIG_SITE #define _LIBCPP___CONFIG_SITE +#include + #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 diff --git a/libs/libxx/system_configuration.h b/libs/libxx/system_configuration.h index fff4560dfd..9f560ff804 100644 --- a/libs/libxx/system_configuration.h +++ b/libs/libxx/system_configuration.h @@ -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