kernel: 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>
This commit is contained in:
Keith Packard 2023-02-08 21:20:55 -08:00 committed by Stephanos Ioannidis
parent 3a197934fc
commit fc076f5a1d

View file

@ -21,16 +21,10 @@
#include <kernel_internal.h>
#ifdef CONFIG_CPP_MAIN
int __weak main(void)
#else
void __weak main(void)
#endif
{
/* NOP default main() if the application does not provide one. */
arch_nop();
#ifdef CONFIG_CPP_MAIN
return 0;
#endif
}