Writing headers compatible with both C and C++ _and_ a range of
toolchains can be very challenging, see for instance long discussions in
commit c15f029a71 ("init.h: restore designated initializers in
SYS_INIT_NAMED()"), PR #69411 and a few others linked from there.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.
Signed-off-by: Keith Packard <keithp@keithp.com>
We weren't explicit about what we mean by "C++ support" as it relates
to standards versions, and it's been causing some friction in the tree
vs. some of our cruftier toolchains. Add a paragraph to clarify
things.
Fixes#55204
Signed-off-by: Andy Ross <andyross@google.com>
This commit improves the C++ standard library documentation by adding
the list of supported C++ standard libraries.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
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>
This commit updates all in-tree code to use `CONFIG_CPP_EXCEPTIONS`
instead of `CONFIG_EXCEPTIONS`, which is now deprecated.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
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>
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>
This commit adds notes about the C++ main() function prototype in the
C++ documentation.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit reworks the C++ language support documentation such that:
1. it contains more up-to-date information regarding the available
features.
2. it makes a clear distinction between the Zephyr C++ subsystem and
the C++ standard library and describe the functionalities they
provide.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>