treewide: Update deprecated CONFIG_LIB_CPLUSPLUS usages

This commit updates all deprecated `CONFIG_LIB_CPLUSPLUS` usages to:

* check if the Zephyr minimal C++ library is enabled using
  `CONFIG_MINIMAL_LIBCPP` instead of relying on the
  `CONFIG_LIB_CPLUSPLUS`-based inference.

* select `CONFIG_REQUIRES_FULL_LIBCPP` when there exists a component-
  level C++ standard library dependency. This allows a component to
  declare C++ standard library dependency without designating a
  specific libray implementation.

* select the correct type of C++ standard library implementation to use
  through one of the `CONFIG_LIBCPP_IMPLEMENTATION` choices.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit is contained in:
Stephanos Ioannidis 2022-12-10 03:19:58 +09:00 committed by Christopher Friedt
commit cf211aa7af
12 changed files with 10 additions and 16 deletions

View file

@ -339,7 +339,7 @@ if(NOT CONFIG_NATIVE_APPLICATION)
toolchain_ld_baremetal() toolchain_ld_baremetal()
endif() endif()
if(CONFIG_LIB_CPLUSPLUS) if(NOT CONFIG_MINIMAL_LIBCPP)
# @Intent: Set linker specific flags for C++ # @Intent: Set linker specific flags for C++
toolchain_ld_cpp() toolchain_ld_cpp()
endif() endif()
@ -1881,7 +1881,7 @@ endif()
zephyr_compile_options($<TARGET_PROPERTY:compiler,nostdinc>) zephyr_compile_options($<TARGET_PROPERTY:compiler,nostdinc>)
target_include_directories(zephyr_interface SYSTEM INTERFACE $<TARGET_PROPERTY:compiler,nostdinc_include>) target_include_directories(zephyr_interface SYSTEM INTERFACE $<TARGET_PROPERTY:compiler,nostdinc_include>)
if(NOT CONFIG_LIB_CPLUSPLUS) if(CONFIG_MINIMAL_LIBCPP)
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,nostdincxx>>) zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,nostdincxx>>)
endif() endif()

View file

@ -7,6 +7,7 @@ config ZEPHYR_TFLITE-MICRO_MODULE
config TENSORFLOW_LITE_MICRO config TENSORFLOW_LITE_MICRO
bool "TensorFlow Lite Micro Support" bool "TensorFlow Lite Micro Support"
select REQUIRES_FULL_LIBCPP
help help
This option enables the TensorFlow Lite Micro library. This option enables the TensorFlow Lite Micro library.

View file

@ -5,5 +5,4 @@ CONFIG_CHRE_LOG_LEVEL_DBG=y
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_STD_CPP17=y CONFIG_STD_CPP17=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_CPP_MAIN=y CONFIG_CPP_MAIN=y

View file

@ -13,7 +13,5 @@
# limitations under the License. # limitations under the License.
# ==============================================================================s # ==============================================================================s
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y CONFIG_TENSORFLOW_LITE_MICRO=y
CONFIG_MAIN_STACK_SIZE=2048 CONFIG_MAIN_STACK_SIZE=2048

View file

@ -13,8 +13,6 @@
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_SENSOR=y CONFIG_SENSOR=y
CONFIG_NETWORKING=n CONFIG_NETWORKING=n

View file

@ -1,8 +1,6 @@
#application default configuration #application default configuration
# include TFLM based on CMSIS NN optimization and ETHOSU acceleration # include TFLM based on CMSIS NN optimization and ETHOSU acceleration
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y CONFIG_TENSORFLOW_LITE_MICRO=y
CONFIG_ARM_ETHOS_U=y CONFIG_ARM_ETHOS_U=y
CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_HEAP_MEM_POOL_SIZE=16384

View file

@ -1,5 +1,4 @@
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_STD_CPP17=y CONFIG_STD_CPP17=y
CONFIG_ZTEST=y CONFIG_ZTEST=y
CONFIG_ZTEST_STACK_SIZE=5120 CONFIG_ZTEST_STACK_SIZE=5120

View file

@ -1,5 +1,5 @@
tests: tests:
cpp.libcxx.newlib: cpp.libcxx.glibcxx.newlib:
filter: TOOLCHAIN_HAS_NEWLIB == 1 filter: TOOLCHAIN_HAS_NEWLIB == 1
toolchain_exclude: xcc toolchain_exclude: xcc
min_flash: 54 min_flash: 54
@ -7,10 +7,11 @@ tests:
tags: cpp tags: cpp
extra_configs: extra_configs:
- CONFIG_NEWLIB_LIBC=y - CONFIG_NEWLIB_LIBC=y
- CONFIG_GLIBCXX_LIBCPP=y
- CONFIG_CPP_EXCEPTIONS=y - CONFIG_CPP_EXCEPTIONS=y
integration_platforms: integration_platforms:
- mps2_an385 - mps2_an385
cpp.libcxx.newlib_nano: cpp.libcxx.glibcxx.newlib_nano:
filter: TOOLCHAIN_HAS_NEWLIB == 1 filter: TOOLCHAIN_HAS_NEWLIB == 1
toolchain_exclude: xcc toolchain_exclude: xcc
min_flash: 54 min_flash: 54
@ -19,6 +20,7 @@ tests:
extra_configs: extra_configs:
- CONFIG_NEWLIB_LIBC=y - CONFIG_NEWLIB_LIBC=y
- CONFIG_NEWLIB_LIBC_NANO=y - CONFIG_NEWLIB_LIBC_NANO=y
- CONFIG_GLIBCXX_LIBCPP=y
integration_platforms: integration_platforms:
- mps2_an385 - mps2_an385
cpp.libcxx.arcmwdtlib: cpp.libcxx.arcmwdtlib:
@ -27,3 +29,4 @@ tests:
tags: cpp tags: cpp
extra_configs: extra_configs:
- CONFIG_ARCMWDT_LIBC=y - CONFIG_ARCMWDT_LIBC=y
- CONFIG_ARCMWDT_LIBCPP=y

View file

@ -2,4 +2,3 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_NEW_API=y
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y

View file

@ -5,4 +5,3 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_NEW_API=y
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y

View file

@ -5,4 +5,4 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_NEW_API=y
CONFIG_CPP=y CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y CONFIG_EXTERNAL_LIBCPP=y

View file

@ -29,7 +29,7 @@ manifest:
revision: dec12fa3f0d790cafa8414a4c2930ea71ab72ffd revision: dec12fa3f0d790cafa8414a4c2930ea71ab72ffd
path: modules/lib/canopennode path: modules/lib/canopennode
- name: chre - name: chre
revision: fe0ab36e0fa7453a4c9b97bedac89709f45cf965 revision: b7955c27e50485b7dafdc3888d7d6afdc2ac6d96
path: modules/lib/chre path: modules/lib/chre
- name: cmsis - name: cmsis
revision: 74981bf893e8b10931464b9945e2143d99a3f0a3 revision: 74981bf893e8b10931464b9945e2143d99a3f0a3