samples, tests, boards: 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.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2023-02-07 21:00:59 -08:00 committed by Stephanos Ioannidis
commit 0b90fd5adf
447 changed files with 1617 additions and 1231 deletions

View file

@ -15,7 +15,8 @@ bst_test_install_t test_installers[] = {
NULL
};
void main(void)
int main(void)
{
bst_main();
return 0;
}

View file

@ -15,7 +15,8 @@ bst_test_install_t test_installers[] = {
NULL
};
void main(void)
int main(void)
{
bst_main();
return 0;
}

View file

@ -15,7 +15,8 @@ bst_test_install_t test_installers[] = {
NULL
};
void main(void)
int main(void)
{
bst_main();
return 0;
}

View file

@ -15,7 +15,8 @@ bst_test_install_t test_installers[] = {
NULL
};
void main(void)
int main(void)
{
bst_main();
return 0;
}

View file

@ -125,7 +125,8 @@ bst_test_install_t test_installers[] = {
NULL
};
void main(void)
int main(void)
{
bst_main();
return 0;
}