Commit graph

11 commits

Author SHA1 Message Date
Marc Herbert
d3a1ce8791 doc: languages: add new section "headers and C/C++ compatibility"
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>
2024-06-13 08:03:13 -04:00
Timm Knape
019fbefa0f doc: Clarified usage of STL with Minimal C++ Library
STL is not available, so the applications should *not* rely on it.

Signed-off-by: Timm Knape <timm@knp.de>
2024-01-25 08:54:38 +01:00
Keith Packard
3a197934fc doc: Switch main return type from void to int.
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>
2023-04-14 07:49:41 +09:00
Andy Ross
10b9aab86b doc: Clarify C++ standards support
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>
2023-03-01 19:42:32 -05:00
Stephanos Ioannidis
3f058cc04e doc: languages: cpp: Improve C++ standard library documentation
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>
2023-01-13 17:42:55 -05:00
Stephanos Ioannidis
669a0f5bec lib: cpp: Rework C++ standard library configurations
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>
2023-01-13 17:42:55 -05:00
Stephanos Ioannidis
404e7a9bf7 treewide: Use CONFIG_CPP_EXCEPTIONS instead of CONFIG_EXCEPTIONS
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>
2023-01-13 17:42:55 -05:00
Stephanos Ioannidis
4a64bfe351 treewide: Use CONFIG_CPP instead of CONFIG_CPLUSPLUS
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>
2023-01-13 17:42:55 -05:00
Stephanos Ioannidis
feaab27c1b lib: cpp: Relocate subsys/cpp to lib/cpp
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>
2023-01-13 17:42:55 -05:00
Stephanos Ioannidis
8073115b4c doc: languages: cpp: Add notes about C++ main()
This commit adds notes about the C++ main() function prototype in the
C++ documentation.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-11-05 16:41:45 +09:00
Stephanos Ioannidis
123e6918f4 doc: develop: Improve C++ language support documentation
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>
2022-06-01 15:26:48 +02:00