samples & tests: Correct main() type

The application main() in Zephyr is defined as having a prototype:
void main(void), as expected by the kernel init (bg_thread_main).

So, correct the different samples and tests that were defined
otherwise.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This commit is contained in:
Alberto Escolar Piedras 2019-12-02 10:58:13 +01:00 committed by Carles Cufí
commit 0b8678a2b0
13 changed files with 17 additions and 31 deletions

View file

@ -133,7 +133,7 @@ void coop_thread_entry(void)
} }
} }
int main(void) void main(void)
{ {
struct k_timer timer; struct k_timer timer;
@ -154,6 +154,4 @@ int main(void)
/* Wait for coop thread to let us have a turn */ /* Wait for coop thread to let us have a turn */
sem_main.wait(); sem_main.wait();
} }
return 0;
} }

View file

@ -214,7 +214,7 @@ error:
(void)close(sock); (void)close(sock);
} }
int main(void) void main(void)
{ {
static struct addrinfo hints; static struct addrinfo hints;
struct addrinfo *res; struct addrinfo *res;
@ -314,6 +314,4 @@ int main(void)
} }
mbedtls_md_free(&hash_ctx); mbedtls_md_free(&hash_ctx);
return 0;
} }

View file

@ -166,7 +166,7 @@ void *main_pthread(void *arg)
return 0; return 0;
} }
int main(void) void main(void)
{ {
pthread_attr_t civetweb_attr; pthread_attr_t civetweb_attr;
pthread_t civetweb_thread; pthread_t civetweb_thread;
@ -177,6 +177,4 @@ int main(void)
(void)pthread_create(&civetweb_thread, &civetweb_attr, (void)pthread_create(&civetweb_thread, &civetweb_attr,
&main_pthread, 0); &main_pthread, 0);
return 0;
} }

View file

@ -40,7 +40,7 @@ static const char content[] = {
#endif #endif
}; };
int main(void) void main(void)
{ {
int serv; int serv;
struct sockaddr_in bind_addr; struct sockaddr_in bind_addr;

View file

@ -23,7 +23,7 @@
#define PORT 4242 #define PORT 4242
int main(void) void main(void)
{ {
int serv; int serv;
struct sockaddr_in bind_addr; struct sockaddr_in bind_addr;

View file

@ -104,7 +104,7 @@ void pollfds_del(int fd)
} }
} }
int main(void) void main(void)
{ {
int res; int res;
static int counter; static int counter;

View file

@ -83,7 +83,7 @@ void pollfds_del(int fd)
FD_CLR(fd, &readfds); FD_CLR(fd, &readfds);
} }
int main(void) void main(void)
{ {
int res; int res;
static int counter; static int counter;

View file

@ -55,7 +55,7 @@ void dump_addrinfo(const struct addrinfo *ai)
((struct sockaddr_in *)ai->ai_addr)->sin_port); ((struct sockaddr_in *)ai->ai_addr)->sin_port);
} }
int main(void) void main(void)
{ {
static struct addrinfo hints; static struct addrinfo hints;
struct addrinfo *res; struct addrinfo *res;
@ -76,7 +76,7 @@ int main(void)
if (st != 0) { if (st != 0) {
printf("Unable to resolve address, quitting\n"); printf("Unable to resolve address, quitting\n");
return 1; return;
} }
#if 0 #if 0
@ -116,7 +116,7 @@ int main(void)
if (len < 0) { if (len < 0) {
printf("Error reading response\n"); printf("Error reading response\n");
return 1; return;
} }
if (len == 0) { if (len == 0) {
@ -130,6 +130,4 @@ int main(void)
printf("\n"); printf("\n");
(void)close(sock); (void)close(sock);
return 0;
} }

View file

@ -17,7 +17,7 @@
LOG_MODULE_REGISTER(main); LOG_MODULE_REGISTER(main);
int main(void) void main(void)
{ {
int ret = -1; int ret = -1;
@ -29,7 +29,7 @@ int main(void)
server_certificate, server_certificate,
sizeof(server_certificate)) < 0) { sizeof(server_certificate)) < 0) {
LOG_ERR("Failed to register server certificate"); LOG_ERR("Failed to register server certificate");
return -1; return;
} }
if (tls_credential_add(CA_CERTIFICATE_TAG, if (tls_credential_add(CA_CERTIFICATE_TAG,
@ -37,7 +37,7 @@ int main(void)
private_key, private_key,
sizeof(private_key)) < 0) { sizeof(private_key)) < 0) {
LOG_ERR("Failed to register private key"); LOG_ERR("Failed to register private key");
return -1; return;
} }
#endif #endif
@ -81,6 +81,4 @@ int main(void)
break; break;
} }
#endif #endif
return ret;
} }

View file

@ -10,7 +10,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
int main(void) void main(void)
{ {
struct timeval tv; struct timeval tv;

View file

@ -288,7 +288,7 @@ typedef struct {
havege, ctr_drbg, hmac_drbg, rsa, dhm, ecdsa, ecdh; havege, ctr_drbg, hmac_drbg, rsa, dhm, ecdsa, ecdh;
} todo_list; } todo_list;
int main(int argc, char *argv[]) void main(void)
{ {
mbedtls_ssl_config conf; mbedtls_ssl_config conf;
unsigned char tmp[200]; unsigned char tmp[200];
@ -1062,6 +1062,4 @@ int main(int argc, char *argv[])
} }
#endif #endif
mbedtls_printf("\n Done\n"); mbedtls_printf("\n Done\n");
return 0;
} }

View file

@ -373,7 +373,7 @@ K_THREAD_DEFINE(pi_low, STACKSIZE, calculate_pi_low, NULL, NULL, NULL,
K_THREAD_DEFINE(pi_high, STACKSIZE, calculate_pi_high, NULL, NULL, NULL, K_THREAD_DEFINE(pi_high, STACKSIZE, calculate_pi_high, NULL, NULL, NULL,
HI_PRI, THREAD_FP_FLAGS, K_NO_WAIT); HI_PRI, THREAD_FP_FLAGS, K_NO_WAIT);
void main(void *p1, void *p2, void *p3) void main(void)
{ {
/* This very old test didn't have a main() function, and would /* This very old test didn't have a main() function, and would
* dump gcov data immediately. Sleep forever, we'll invoke * dump gcov data immediately. Sleep forever, we'll invoke

View file

@ -1478,7 +1478,7 @@ static const struct {
{ "Test observer client", test_observer_client, }, { "Test observer client", test_observer_client, },
}; };
int main(int argc, char *argv[]) void main(void)
{ {
int count, pass, result; int count, pass, result;
@ -1495,6 +1495,4 @@ int main(int argc, char *argv[])
result = pass == count ? TC_PASS : TC_FAIL; result = pass == count ? TC_PASS : TC_FAIL;
TC_END_REPORT(result); TC_END_REPORT(result);
return 0;
} }