From 6ce6af9004b98252e1b5a41f52f6ffca7cfdbbda Mon Sep 17 00:00:00 2001 From: v-zhangxiaomeng5 Date: Mon, 12 Jan 2026 23:02:58 +0800 Subject: [PATCH] libcxx: supports CXX_MINI_LOCALIZATION This commit contains changes: 1) define new C++ locale macros CXX_MINI_LOCALIZATION & CXX_NO_LOCALIZATION 2) define a new C++ macro _LIBCPP_HAS_MINI_LOCALIZATION for CXX_MINI_LOCALIZATION 3) update libxx/libcxx/CMakeLists.txt & Make.defs Signed-off-by: v-zhangxiaomeng5 --- libs/libxx/Kconfig | 13 ++++++++++++- libs/libxx/__config_site | 4 +++- libs/libxx/libcxx/CMakeLists.txt | 2 +- libs/libxx/libcxx/Make.defs | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig index 49206a4e6dd..e7709d5793e 100644 --- a/libs/libxx/Kconfig +++ b/libs/libxx/Kconfig @@ -29,7 +29,6 @@ choice config LIBCXXTOOLCHAIN bool "Toolchain C++ support" select HAVE_CXXINITIALIZE - select LIBC_LOCALE ---help--- Use Standard C++ library from toolchain. @@ -120,10 +119,22 @@ config CXX_RTTI config CXX_WCHAR bool "Enable Wide Character Support" +choice + prompt "C++ Locale and Stream select" + default CXX_NO_LOCALIZATION + +config CXX_NO_LOCALIZATION + bool "No Locale and Stream Support" + +config CXX_MINI_LOCALIZATION + bool "Enable mini Locale and Stream Support" + config CXX_LOCALIZATION bool "Enable Locale and Stream Support" depends on LIBC_LOCALE +endchoice + if UCLIBCXX config UCLIBCXX_BUFSIZE diff --git a/libs/libxx/__config_site b/libs/libxx/__config_site index e7d5116ceb0..7e1477746cd 100644 --- a/libs/libxx/__config_site +++ b/libs/libxx/__config_site @@ -27,8 +27,10 @@ /* #undef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION */ /* #undef _LIBCPP_HAS_NO_FILESYSTEM */ /* #undef _LIBCPP_HAS_NO_RANDOM_DEVICE */ -#ifndef CONFIG_CXX_LOCALIZATION +#if defined(CONFIG_CXX_NO_LOCALIZATION) # define _LIBCPP_HAS_NO_LOCALIZATION +#elif defined(CONFIG_CXX_MINI_LOCALIZATION) +# define _LIBCPP_HAS_MINI_LOCALIZATION #endif #ifndef CONFIG_CXX_WCHAR # define _LIBCPP_HAS_NO_WIDE_CHARACTERS diff --git a/libs/libxx/libcxx/CMakeLists.txt b/libs/libxx/libcxx/CMakeLists.txt index 8f4b408c1b8..020c1ad05db 100644 --- a/libs/libxx/libcxx/CMakeLists.txt +++ b/libs/libxx/libcxx/CMakeLists.txt @@ -119,7 +119,7 @@ if(CONFIG_LIBCXX) list(REMOVE_ITEM SRCS ${SRCSTMP}) endif() - if(NOT CONFIG_CXX_LOCALIZATION) + if(CONFIG_CXX_NO_LOCALIZATION) file( GLOB SRCSTMP diff --git a/libs/libxx/libcxx/Make.defs b/libs/libxx/libcxx/Make.defs index 0382d6ba61c..fcbdd9dd854 100644 --- a/libs/libxx/libcxx/Make.defs +++ b/libs/libxx/libcxx/Make.defs @@ -89,7 +89,7 @@ ifeq ($(shell [ $(CPP_STD_VER) -le 14 ] && echo true),true) CPPSRCS := $(filter-out $(EXCLUDE_FILES), $(CPPSRCS)) endif -ifeq ($(CONFIG_CXX_LOCALIZATION),) +ifeq ($(CONFIG_CXX_NO_LOCALIZATION),y) LOCALE_CPPSRCS := libcxx/libcxx/src/ios.cpp LOCALE_CPPSRCS += libcxx/libcxx/src/ios.instantiations.cpp LOCALE_CPPSRCS += libcxx/libcxx/src/iostream.cpp