Skip to content

Commit

Permalink
treewide: Update deprecated CONFIG_LIB_CPLUSPLUS usages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stephanosio authored and cfriedt committed Jan 13, 2023
1 parent 669a0f5 commit cf211aa
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ if(NOT CONFIG_NATIVE_APPLICATION)
toolchain_ld_baremetal()
endif()

if(CONFIG_LIB_CPLUSPLUS)
if(NOT CONFIG_MINIMAL_LIBCPP)
# @Intent: Set linker specific flags for C++
toolchain_ld_cpp()
endif()
Expand Down Expand Up @@ -1881,7 +1881,7 @@ endif()
zephyr_compile_options($<TARGET_PROPERTY:compiler,nostdinc>)
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>>)
endif()

Expand Down
1 change: 1 addition & 0 deletions modules/tflite-micro/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ config ZEPHYR_TFLITE-MICRO_MODULE

config TENSORFLOW_LITE_MICRO
bool "TensorFlow Lite Micro Support"
select REQUIRES_FULL_LIBCPP
help
This option enables the TensorFlow Lite Micro library.

Expand Down
1 change: 0 additions & 1 deletion samples/modules/chre/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ CONFIG_CHRE_LOG_LEVEL_DBG=y

CONFIG_CPP=y
CONFIG_STD_CPP17=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_CPP_MAIN=y
2 changes: 0 additions & 2 deletions samples/modules/tflite-micro/hello_world/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@
# limitations under the License.
# ==============================================================================s
CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y
CONFIG_MAIN_STACK_SIZE=2048
2 changes: 0 additions & 2 deletions samples/modules/tflite-micro/magic_wand/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# limitations under the License.
# ==============================================================================
CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_SENSOR=y
CONFIG_NETWORKING=n
Expand Down
2 changes: 0 additions & 2 deletions samples/modules/tflite-micro/tflm_ethosu/prj.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#application default configuration
# include TFLM based on CMSIS NN optimization and ETHOSU acceleration
CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y
CONFIG_ARM_ETHOS_U=y
CONFIG_HEAP_MEM_POOL_SIZE=16384
Expand Down
1 change: 0 additions & 1 deletion tests/lib/cpp/libcxx/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_STD_CPP17=y
CONFIG_ZTEST=y
CONFIG_ZTEST_STACK_SIZE=5120
Expand Down
7 changes: 5 additions & 2 deletions tests/lib/cpp/libcxx/testcase.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
tests:
cpp.libcxx.newlib:
cpp.libcxx.glibcxx.newlib:
filter: TOOLCHAIN_HAS_NEWLIB == 1
toolchain_exclude: xcc
min_flash: 54
min_ram: 24
tags: cpp
extra_configs:
- CONFIG_NEWLIB_LIBC=y
- CONFIG_GLIBCXX_LIBCPP=y
- CONFIG_CPP_EXCEPTIONS=y
integration_platforms:
- mps2_an385
cpp.libcxx.newlib_nano:
cpp.libcxx.glibcxx.newlib_nano:
filter: TOOLCHAIN_HAS_NEWLIB == 1
toolchain_exclude: xcc
min_flash: 54
Expand All @@ -19,6 +20,7 @@ tests:
extra_configs:
- CONFIG_NEWLIB_LIBC=y
- CONFIG_NEWLIB_LIBC_NANO=y
- CONFIG_GLIBCXX_LIBCPP=y
integration_platforms:
- mps2_an385
cpp.libcxx.arcmwdtlib:
Expand All @@ -27,3 +29,4 @@ tests:
tags: cpp
extra_configs:
- CONFIG_ARCMWDT_LIBC=y
- CONFIG_ARCMWDT_LIBCPP=y
1 change: 0 additions & 1 deletion tests/ztest/base/prj_cpp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y

CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
1 change: 0 additions & 1 deletion tests/ztest/fail/core/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y

CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
2 changes: 1 addition & 1 deletion tests/ztest/fail/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y

CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_EXTERNAL_LIBCPP=y
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ manifest:
revision: dec12fa3f0d790cafa8414a4c2930ea71ab72ffd
path: modules/lib/canopennode
- name: chre
revision: fe0ab36e0fa7453a4c9b97bedac89709f45cf965
revision: b7955c27e50485b7dafdc3888d7d6afdc2ac6d96
path: modules/lib/chre
- name: cmsis
revision: 74981bf893e8b10931464b9945e2143d99a3f0a3
Expand Down

0 comments on commit cf211aa

Please sign in to comment.