Skip to content

Commit

Permalink
treewide: Use CONFIG_CPP instead of CONFIG_CPLUSPLUS
Browse files Browse the repository at this point in the history
This commit updates all in-tree code to use `CONFIG_CPP` instead of
`CONFIG_CPLUSPLUS`, which is now deprecated.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
  • Loading branch information
stephanosio authored and cfriedt committed Jan 13, 2023
1 parent 05aea1c commit 4a64bfe
Show file tree
Hide file tree
Showing 47 changed files with 97 additions and 97 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ zephyr_compile_options(${OPTIMIZATION_FLAG})
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,required>>)

# @Intent: Obtain compiler specific flags for compiling under different ISO standards of C++
if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
# From kconfig choice, pick a single dialect.
# Kconfig choice ensures only one of these CONFIG_STD_CPP* is set.
if(CONFIG_STD_CPP98)
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/arcmwdt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_ARCMWDT_LIBC OR CONFIG_CPLUSPLUS)
if(CONFIG_ARCMWDT_LIBC OR CONFIG_CPP)
zephyr_sources(arcmwdt-dtr-stubs.c)
endif()
2 changes: 1 addition & 1 deletion arch/arm/core/aarch32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ zephyr_library_sources(
)

zephyr_library_sources_ifdef(CONFIG_GEN_SW_ISR_TABLE isr_wrapper.S)
zephyr_library_sources_ifdef(CONFIG_CPLUSPLUS __aeabi_atexit.c)
zephyr_library_sources_ifdef(CONFIG_CPP __aeabi_atexit.c)
zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c)
zephyr_library_sources_ifdef(CONFIG_SW_VECTOR_RELAY irq_relay.S)
zephyr_library_sources_ifdef(CONFIG_THREAD_LOCAL_STORAGE ../common/tls.c)
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler/gcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if(${CMAKE_C_COMPILER} STREQUAL CMAKE_C_COMPILER-NOTFOUND)
message(FATAL_ERROR "C compiler ${CROSS_COMPILE}${CC} not found - Please check your toolchain installation")
endif()

if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
set(cplusplus_compiler ${CROSS_COMPILE}${C++})
else()
if(EXISTS ${CROSS_COMPILE}${C++})
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler/host-gcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

find_program(CMAKE_C_COMPILER gcc)

if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
set(cplusplus_compiler g++)
else()
if(EXISTS g++)
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler/xcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set_ifndef(C++ g++)

find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)

if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
set(cplusplus_compiler ${CROSS_COMPILE}${C++})
else()
if(EXISTS ${CROSS_COMPILE}${C++})
Expand Down
2 changes: 1 addition & 1 deletion cmake/linker_script/arm/linker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ zephyr_linker_section_configure(SECTION .text INPUT ".glue_7")
zephyr_linker_section_configure(SECTION .text INPUT ".vfp11_veneer")
zephyr_linker_section_configure(SECTION .text INPUT ".v4_bx")

if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
zephyr_linker_section(NAME .ARM.extab GROUP ROM_REGION)
zephyr_linker_section_configure(SECTION .ARM.extab INPUT ".gnu.linkonce.armextab.*")
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/linker_script/common/common-rom.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ zephyr_linker_section_configure(SECTION initlevel_error INPUT ".z_init_[_A-Z0-9]
# ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")


if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
zephyr_linker_section(NAME ctors KVMA RAM_REGION GROUP RODATA_REGION NOINPUT)
#
# The compiler fills the constructor pointers table below,
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ endfunction()
# Support an optional second option for when the first option is not
# supported.
function(target_cc_option_fallback target scope option1 option2)
if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
foreach(lang C CXX)
# For now, we assume that all flags that apply to C/CXX also
# apply to ASM.
Expand Down Expand Up @@ -2051,7 +2051,7 @@ function(check_set_compiler_property)
separate_arguments(option UNIX_COMMAND ${option})
endif()

if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
zephyr_check_compiler_flag(CXX "${option}" check)

if(${check})
Expand Down
2 changes: 1 addition & 1 deletion doc/develop/application/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ assignment:

.. code-block:: none
CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
Looking at :ref:`existing samples <samples-and-demos>` is a good way to get
started.
Expand Down
2 changes: 1 addition & 1 deletion doc/develop/languages/cpp/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Enabling C++ Support

Zephyr supports applications written in both C and C++. However, to use C++ in
an application you must configure Zephyr to include C++ support by selecting
the :kconfig:option:`CONFIG_CPLUSPLUS` in the application configuration file.
the :kconfig:option:`CONFIG_CPP` in the application configuration file.

To enable C++ support, the compiler toolchain must also include a C++ compiler
and the included compiler must be supported by the Zephyr build system. The
Expand Down
8 changes: 4 additions & 4 deletions include/zephyr/arch/arc/v2/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ SECTIONS {
#include <snippets-rodata.ld>
#include <zephyr/linker/kobject-rom.ld>

#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
#if defined(CONFIG_CPP) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
. = ALIGN(4);
_fctors = .;
KEEP(*(.ctors*))
_ectors = .;
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
#endif /* CONFIG_CPP && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */

MPU_ALIGN(ABSOLUTE(.) - __rom_region_start);
} GROUP_LINK_IN(ROMABLE_REGION)
Expand Down Expand Up @@ -293,11 +293,11 @@ SECTIONS {
#endif

/DISCARD/ : {
#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
#if defined(CONFIG_CPP) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
*(.dtors*)
*(.fini*)
*(.eh_frame*)
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
#endif /* CONFIG_CPP && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
*(.note.GNU-stack)
*(.got.plt)
*(.igot.plt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ SECTIONS
. = ALIGN(_region_min_align);
} GROUP_LINK_IN(ROMABLE_REGION)

#if defined (CONFIG_CPLUSPLUS)
#if defined (CONFIG_CPP)
SECTION_PROLOGUE(.ARM.extab,,)
{
/*
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/arch/arm/aarch32/cortex_m/scripts/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ SECTIONS

__text_region_end = .;

#if defined (CONFIG_CPLUSPLUS)
#if defined (CONFIG_CPP)
SECTION_PROLOGUE(.ARM.extab,,)
{
/*
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/arch/arm64/scripts/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ SECTIONS
__text_region_end = .;
__text_region_size = __text_region_end - __text_region_start;

#if defined (CONFIG_CPLUSPLUS)
#if defined (CONFIG_CPP)
SECTION_PROLOGUE(.ARM.extab,,)
{
/*
Expand Down
4 changes: 2 additions & 2 deletions include/zephyr/linker/cplusplus-ram.ld
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#if defined (CONFIG_CPLUSPLUS)
#if defined (CONFIG_CPP)
SECTION_DATA_PROLOGUE(.gcc_except_table,,ONLY_IF_RW)
{
*(.gcc_except_table .gcc_except_table.*)
Expand All @@ -18,4 +18,4 @@
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
#endif /* CONFIG_EXCEPTIONS */

#endif /* CONFIG_CPLUSPLUS */
#endif /* CONFIG_CPP */
4 changes: 2 additions & 2 deletions include/zephyr/linker/cplusplus-rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#if defined (CONFIG_CPLUSPLUS)
#if defined (CONFIG_CPP)
SECTION_PROLOGUE(.gcc_except_table,,ONLY_IF_RO)
{
*(.gcc_except_table .gcc_except_table.*)
Expand All @@ -23,4 +23,4 @@
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
#endif /* CONFIG_EXCEPTIONS */

#endif /* CONFIG_CPLUSPLUS */
#endif /* CONFIG_CPP */
2 changes: 1 addition & 1 deletion include/zephyr/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct k_spinlock {
#endif /* CONFIG_SPIN_LOCK_TIME_LIMIT */
#endif /* CONFIG_SPIN_VALIDATE */

#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_SMP) && \
#if defined(CONFIG_CPP) && !defined(CONFIG_SMP) && \
!defined(CONFIG_SPIN_VALIDATE)
/* If CONFIG_SMP and CONFIG_SPIN_VALIDATE are both not defined
* the k_spinlock struct will have no members. The result
Expand Down
2 changes: 1 addition & 1 deletion kernel/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
#endif
boot_banner();

#if defined(CONFIG_CPLUSPLUS)
#if defined(CONFIG_CPP)
void z_cpp_init_static(void);
z_cpp_init_static();
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(NOT CONFIG_EXTERNAL_LIBC)
add_subdirectory(libc)
add_subdirectory(posix)
endif()
add_subdirectory_ifdef(CONFIG_CPLUSPLUS cpp)
add_subdirectory_ifdef(CONFIG_CPP cpp)
add_subdirectory(os)
add_subdirectory(util)
add_subdirectory_ifdef(CONFIG_SMF smf)
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp/cpp_synchronization/prj.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
CONFIG_CPP_MAIN=y
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=128
2 changes: 1 addition & 1 deletion samples/modules/chre/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_CHRE_LOG_LEVEL_DBG=y

CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
CONFIG_STD_CPP17=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_CPP_MAIN=y
2 changes: 1 addition & 1 deletion samples/modules/tflite-micro/hello_world/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TensorFlow, you must enable the below Kconfig options in your :file:`prj.conf`:

.. code-block:: kconfig
CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y
Expand Down
2 changes: 1 addition & 1 deletion samples/modules/tflite-micro/hello_world/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================s
CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y
Expand Down
2 changes: 1 addition & 1 deletion samples/modules/tflite-micro/magic_wand/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ TensorFlow, you must enable the below Kconfig options in your :file:`prj.conf`:

.. code-block:: kconfig
CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y
Expand Down
2 changes: 1 addition & 1 deletion samples/modules/tflite-micro/magic_wand/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
Expand Down
2 changes: 1 addition & 1 deletion samples/modules/tflite-micro/tflm_ethosu/prj.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#application default configuration
# include TFLM based on CMSIS NN optimization and ETHOSU acceleration
CONFIG_CPLUSPLUS=y
CONFIG_CPP=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_TENSORFLOW_LITE_MICRO=y
Expand Down
2 changes: 1 addition & 1 deletion samples/net/sockets/echo_client/boards/atsamr21_xpro.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#

# Reduced buffers to fit into SAMR21 SoC
CONFIG_CPLUSPLUS=n
CONFIG_CPP=n

CONFIG_NET_PKT_RX_COUNT=6
CONFIG_NET_PKT_TX_COUNT=6
Expand Down
2 changes: 1 addition & 1 deletion samples/net/sockets/echo_server/boards/atsamr21_xpro.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#

# Reduced buffers to fit into SAMR21 SoC
CONFIG_CPLUSPLUS=n
CONFIG_CPP=n

CONFIG_NET_PKT_RX_COUNT=6
CONFIG_NET_PKT_TX_COUNT=6
Expand Down
2 changes: 1 addition & 1 deletion samples/subsys/logging/syst/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(syst)

target_sources(app PRIVATE src/main.c)

if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
# When building for C++, force C++ compilation
set_source_files_properties(src/main.c PROPERTIES LANGUAGE CXX)
endif()
8 changes: 4 additions & 4 deletions samples/subsys/logging/syst/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ tests:
regex:
- "SYS-T RAW DATA: "
extra_configs:
- CONFIG_CPLUSPLUS=y
- CONFIG_CPP=y
filter: (TOOLCHAIN_HAS_NEWLIB == 1) or CONFIG_PICOLIBC_SUPPORTED
sample.logger.syst.immediate_cpp:
toolchain_exclude: xcc
Expand All @@ -104,7 +104,7 @@ tests:
regex:
- "SYS-T RAW DATA: "
extra_configs:
- CONFIG_CPLUSPLUS=y
- CONFIG_CPP=y
filter: (TOOLCHAIN_HAS_NEWLIB == 1) or CONFIG_PICOLIBC_SUPPORTED
sample.logger.syst.catalog.deferred_cpp:
toolchain_exclude: xcc
Expand All @@ -121,7 +121,7 @@ tests:
- "SYS-T RAW DATA: "
extra_configs:
- CONFIG_LOG_MIPI_SYST_USE_CATALOG=y
- CONFIG_CPLUSPLUS=y
- CONFIG_CPP=y
filter: (TOOLCHAIN_HAS_NEWLIB == 1) or CONFIG_PICOLIBC_SUPPORTED
sample.logger.syst.catalog.immediate_cpp:
toolchain_exclude: xcc
Expand All @@ -137,5 +137,5 @@ tests:
- "SYS-T RAW DATA: "
extra_configs:
- CONFIG_LOG_MIPI_SYST_USE_CATALOG=y
- CONFIG_CPLUSPLUS=y
- CONFIG_CPP=y
filter: (TOOLCHAIN_HAS_NEWLIB == 1) or CONFIG_PICOLIBC_SUPPORTED
2 changes: 1 addition & 1 deletion subsys/net/l2/openthread/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ menuconfig NET_L2_OPENTHREAD

select SETTINGS if FLASH
select OPENTHREAD_SETTINGS_RAM if !FLASH
select CPLUSPLUS
select CPP
select REBOOT
select ENTROPY_GENERATOR

Expand Down
4 changes: 2 additions & 2 deletions subsys/testsuite/ztest/include/zephyr/arch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {

/* Architecture thread structure */
struct _callee_saved {
#ifdef CONFIG_CPLUSPLUS
#ifdef CONFIG_CPP
/* C++ does not allow empty structs, add an extra 1 byte */
uint8_t c;
#endif
Expand All @@ -23,7 +23,7 @@ struct _callee_saved {
typedef struct _callee_saved _callee_saved_t;

struct _thread_arch {
#ifdef CONFIG_CPLUSPLUS
#ifdef CONFIG_CPP
/* C++ does not allow empty structs, add an extra 1 byte */
uint8_t c;
#endif
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/cbprintf_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(cbprintf_package)

target_sources(app PRIVATE src/main.c)
if(CONFIG_CPLUSPLUS)
if(CONFIG_CPP)
# When testing for C++ force test file C++ compilation
set_source_files_properties(src/main.c PROPERTIES LANGUAGE CXX)
endif()
Loading

0 comments on commit 4a64bfe

Please sign in to comment.