Make noreturn proxies and stubs actually not return

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2020-12-03 16:42:25 +02:00 committed by Xiang Xiao
parent 82a75122b0
commit 8334843bad
2 changed files with 25 additions and 7 deletions

View File

@ -1,4 +1,4 @@
"_exit","unistd.h","","void","int"
"_exit","unistd.h","","noreturn","int"
"accept","sys/socket.h","defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *"
"adjtime","sys/time.h","defined(CONFIG_CLOCK_TIMEKEEPING)","int","FAR const struct timeval *","FAR struct timeval *"
"aio_cancel","aio.h","defined(CONFIG_FS_AIO)","int","int","FAR struct aiocb *"
@ -23,7 +23,7 @@
"eventfd","sys/eventfd.h","defined(CONFIG_EVENT_FD)","int","unsigned int","int"
"exec","nuttx/binfmt/binfmt.h","!defined(CONFIG_BINFMT_DISABLE) && !defined(CONFIG_BUILD_KERNEL)","int","FAR const char *","FAR char * const *","FAR const struct symtab_s *","int"
"execv","unistd.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS)","int","FAR const char *","FAR char * const []|FAR char * const *"
"exit","stdlib.h","","void","int"
"exit","stdlib.h","","noreturn","int"
"fcntl","fcntl.h","","int","int","int","...","int"
"fs_fdopen","nuttx/fs/fs.h","defined(CONFIG_FILE_STREAM)","int","int","int","FAR struct tcb_s *","FAR struct file_struct **"
"fstat","sys/stat.h","","int","int","FAR struct stat *"
@ -90,7 +90,7 @@
"pthread_cond_wait","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t *","FAR pthread_mutex_t *"
"pthread_create","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_t *","FAR const pthread_attr_t *","pthread_startroutine_t","pthread_addr_t"
"pthread_detach","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t"
"pthread_exit","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void","pthread_addr_t"
"pthread_exit","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","noreturn","pthread_addr_t"
"pthread_getaffinity_np","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SMP)","int","pthread_t","size_t","FAR cpu_set_t*"
"pthread_getschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","FAR int *","FAR struct sched_param *"
"pthread_join","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","FAR pthread_addr_t *"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -224,7 +224,16 @@ static void generate_proxy(int nfixed, int nparms)
* prototype
*/
fprintf(stream, "%s %s(", g_parm[RETTYPE_INDEX], g_parm[NAME_INDEX]);
if (strcmp(g_parm[RETTYPE_INDEX], "noreturn") == 0)
{
fprintf(stream, "void ");
}
else
{
fprintf(stream, "%s ", g_parm[RETTYPE_INDEX]);
}
fprintf(stream, "%s(", g_parm[NAME_INDEX]);
/* Generate the formal parameter list */
@ -301,7 +310,8 @@ static void generate_proxy(int nfixed, int nparms)
* are special cases.
*/
if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0)
if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0 ||
strcmp(g_parm[RETTYPE_INDEX], "noreturn") == 0)
{
fprintf(stream, " (void)sys_call%d(", nparms);
}
@ -339,7 +349,14 @@ static void generate_proxy(int nfixed, int nparms)
/* Handle the tail end of the function. */
fprintf(stream, ");\n}\n");
fprintf(stream, ");\n");
if (strcmp(g_parm[RETTYPE_INDEX], "noreturn") == 0)
{
fprintf(stream, " while(1);\n");
}
fprintf(stream, "}\n");
if (g_parm[COND_INDEX][0] != '\0')
{
fprintf(stream, "\n#endif /* %s */\n", g_parm[COND_INDEX]);
@ -448,7 +465,8 @@ static void generate_stub(int nfixed, int nparms)
* a special case.
*/
if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0)
if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0 ||
strcmp(g_parm[RETTYPE_INDEX], "noreturn") == 0)
{
fprintf(stream, " %s(", g_parm[NAME_INDEX]);
}