LLVM toolchain provides its own C++ standard library called libc++.
This patch adds new LLVM_LIBCXX config which should be used to indicate
that libc++ is used.
Information about library can be found at https://libcxx.llvm.org
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Picolibc dependencies limit ability to use third party minimal
implementations of CPP when enablng PICOLIBC_USE_MODULE.
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
Add a name to the choice group for selecting the C++
standard to be able to override the default standard in
Kconfig.* files.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
So they depend or select on the right NATIVE_BUILD
instead of NATIVE_APPLICATION.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
With Zephyr now always using `int main(void)`, there's no longer any need
for this definition. The last remaining use which gated the declaration of
_posix_zephyr_main isn't necessary as adding that declaration
unconditionally is harmless.
Signed-off-by: Keith Packard <keithp@keithp.com>
Introduce Kconfig symbol FULL_LIBCPP_SUPPORTED that is similar to the
C version FULL_LIBC_SUPPORTED. This way we can utilize the same
pattern in tests and samples to filter for when a full libc++ is
needed.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Add a prompt to the Kconfig symbol so that applications can select this in
to guide C++ standard library selection towards configurations which
provide a complete implementation.
Signed-off-by: Keith Packard <keithp@keithp.com>
libstdc++ is supported with Picolibc only when the toolchain version of
Picolibc is use -- libstdc++ must be built using a specific Picolibc build
and libstdc++ is included with the toolchain.
Ideally, we'd allow the use of the Picolibc module whenever we weren't
using the GNU libstdc++, including when using the minimal libc++. However,
the obvious dependency settings create a loop:
config PICOLIBC
depends on PICOLIBC_SUPPORTED
config PICOLIBC_SUPPORTED
depends on !(GLIBCXX_LIBCPP && "$(ZEPHYR_TOOCHAIN_VARIANT" = "zephyr")
config GLIBCXX_LIBCPP
depends on NEWLIB_LIBC || PICOLIBC
To break this loop, we replace GLIBCXX_LIBCPP in the second block with
CPP:
config PICOLIBC_SUPPORTED
depends on !(CPP && "$(ZEPHYR_TOOCHAIN_VARIANT" = "zephyr")
This means that picolibc cannot be used with any C++ apps when using the
Zephyr SDK, even when not using the GNU libstdc++. However, Zephyr SDK 0.16
will come with an additional Kconfig file that includes:
config PICOLIBC_SUPPORTED
def_bool y
depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr"
This will override the Kconfig bits included in Zephyr and allow use of the
Picolibc module with C++ code, including using the minimal libc++ bits.
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit reworks the C++ standard library configurations such that:
* the separation between the Zephyr minimal C++ library and the fully
featured C++ standard libraries, such as GNU libstdc++, is clear.
This is done by deprecating the Kconfig `CONFIG_LIB_CPLUSPLUS`
symbol, which implies that the minimal C++ library is selected when
set to `n`, and introducing the `CONFIG_MINIMAL_LIBCPP` symbol.
* the type of the selected C++ standard library is clear. This is done
by introducing a Kconfig choice, `LIBCPP_IMPLEMENTATION`, for the C++
standard library type and providing the choice symbols for each
library type supported, such as `CONFIG_MINIMAL_LIBCPP` and
`CONFIG_GLIBCXX_LIBCPP`.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
The Kconfig `CONFIG_RTTI` symbol enables the C++ Run-Time Type
Information (RTTI) support and is a feature of the standard C++
library; therefore, it should be prefixed with `CPP_` as with the rest
of the C++-specific symbols.
This commit renames the Kconfig `CONFIG_RTTI` symbol to
`CONFIG_CPP_RTTI` in order to better align with the other existing C++
Kconfig symbols, and deprecates the old `CONFIG_RTTI` symbol.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
`CONFIG_EXCEPTIONS` is ambiguous in that the word "exception" may be
used to refer to many different types of exceptions, from the hardware
generated faults and interrupts (aka. exceptions) to the C++
exceptions.
This commit renames the Kconfig `CONFIG_EXCEPTIONS` symbol to
`CONFIG_CPP_EXCEPTIONS` in order to clarify that the symbol refers to
the C++ exceptions and eliminate any ambiguity, and deprecates the old
`CONFIG_EXCEPTIONS` symbol.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
There is no reason for the top-level C++ Kconfig symbol to be called
`CPLUSPLUS` when the convention used throughout the Zephyr codebase is
to use "cpp" to refer to C++ and the rest of the C++-related Kconfig
symbols are prefixed with `CPP_`.
This commit renames the Kconfig `CPLUSPLUS` symbol to `CPP` in order to
better align with the de-facto standard naming convention used throughout
the Zephyr codebase, and deprecates the old `CPLUSPLUS` symbol.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit moves the files under `subsys/cpp` directory to the
`lib/cpp` directory because the C++ ABI runtime library and the
standard C++ library components are not a "subsystem" (aka. API) in
conventional sense and is better described as a "library."
Classifying the C++ ABI runtime library and the standard C++ library as
"libraries" instead of "subsystems" also better aligns with how the
existing C standard library implementation (`lib/libc`) is handled.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>