The C++ standard requires the main() function to have the return type of 'int' and does not allow the main() to be defined with the 'void' return type. Moreover, GCC goes as far as to emit a hard error when the '::main()' has the return type of `void`. This commit introduces an option to instruct the Zephyr kernel to call the 'int main(void)' instead of the 'void main(void)' in case a Zephyr application defines main() in a C++ source file. Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
98 lines
2.1 KiB
Plaintext
98 lines
2.1 KiB
Plaintext
# C++ configuration options
|
|
|
|
# Copyright (c) 2018 B. Leforestier
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menuconfig CPLUSPLUS
|
|
bool "C++ support for the application"
|
|
help
|
|
This option enables the use of applications built with C++.
|
|
|
|
if CPLUSPLUS
|
|
|
|
choice
|
|
prompt "C++ Standard"
|
|
default STD_CPP11
|
|
help
|
|
C++ Standards.
|
|
|
|
config STD_CPP98
|
|
bool "C++ 98"
|
|
help
|
|
1998 C++ standard as modified by the 2003 technical corrigendum
|
|
and some later defect reports.
|
|
|
|
config STD_CPP11
|
|
bool "C++ 11"
|
|
help
|
|
2011 C++ standard, previously known as C++0x.
|
|
|
|
config STD_CPP14
|
|
bool "C++ 14"
|
|
help
|
|
2014 C++ standard.
|
|
|
|
config STD_CPP17
|
|
bool "C++ 17"
|
|
help
|
|
2017 C++ standard, previously known as C++0x.
|
|
|
|
config STD_CPP2A
|
|
bool "C++ 2a"
|
|
help
|
|
Next revision of the C++ standard, which is expected to be published in 2020.
|
|
|
|
config STD_CPP20
|
|
bool "C++ 20"
|
|
help
|
|
2020 C++ standard, previously known as C++2A.
|
|
|
|
config STD_CPP2B
|
|
bool "C++ 2b"
|
|
help
|
|
Next revision of the C++ standard, which is expected to be published in 2023.
|
|
|
|
endchoice
|
|
|
|
config CPP_MAIN
|
|
bool "C++ main() function definition"
|
|
help
|
|
This option instructs the Zephyr kernel to call the 'int main(void)'
|
|
instead of the 'void main(void)', which is the default main() type
|
|
for Zephyr.
|
|
|
|
C++ does not allow the main() to be defined with 'void' return type,
|
|
and any applications defining its main() in a C++ source file must
|
|
enable this option.
|
|
|
|
config LIB_CPLUSPLUS
|
|
bool "Link with STD C++ library"
|
|
depends on !MINIMAL_LIBC
|
|
help
|
|
Link with STD C++ Library.
|
|
|
|
if LIB_CPLUSPLUS
|
|
|
|
config EXCEPTIONS
|
|
bool "C++ exceptions support"
|
|
depends on !NEWLIB_LIBC_NANO
|
|
help
|
|
This option enables support of C++ exceptions.
|
|
|
|
config RTTI
|
|
bool "C++ RTTI support"
|
|
help
|
|
This option enables support of C++ RTTI.
|
|
|
|
endif # LIB_CPLUSPLUS
|
|
|
|
config CPP_STATIC_INIT_GNU
|
|
# As of today only ARC MWDT toolchain doesn't support GNU-compatible
|
|
# initialization of CPP static objects, new toolchains can be added
|
|
# here if required.
|
|
def_bool "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "arcmwdt"
|
|
help
|
|
GNU-compatible initialization of CPP static objects
|
|
|
|
endif # CPLUSPLUS
|