You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/18 07:49:04 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5518: tools/mkallsyms.sh: Disable the mismatch warning of builtin declaration

xiaoxiang781216 commented on pull request #5518:
URL: https://github.com/apache/incubator-nuttx/pull/5518#issuecomment-1044080978


   > could you please point to some warnings?
   
   Here is(sim:elf and remove -fno-builtin from Make.defs):
   ```
   tests/symtab.c:6:14: warning: built-in function ‘exit’ declared as non-function [-Wbuiltin-declaration-mismatch]
       6 | extern void *exit;
         |              ^~~~
   tests/symtab.c:9:14: warning: built-in function ‘fprintf’ declared as non-function [-Wbuiltin-declaration-mismatch]
       9 | extern void *fprintf;
         |              ^~~~~~~
   tests/symtab.c:10:14: warning: built-in function ‘fwrite’ declared as non-function [-Wbuiltin-declaration-mismatch]
      10 | extern void *fwrite;
         |              ^~~~~~
   tests/symtab.c:13:14: warning: built-in function ‘memset’ declared as non-function [-Wbuiltin-declaration-mismatch]
      13 | extern void *memset;
         |              ^~~~~~
   tests/symtab.c:15:14: warning: built-in function ‘printf’ declared as non-function [-Wbuiltin-declaration-mismatch]
      15 | extern void *printf;
         |              ^~~~~~
   tests/symtab.c:23:14: warning: built-in function ‘puts’ declared as non-function [-Wbuiltin-declaration-mismatch]
      23 | extern void *puts;
         |              ^~~~
   tests/symtab.c:32:14: warning: built-in function ‘strcmp’ declared as non-function [-Wbuiltin-declaration-mismatch]
      32 | extern void *strcmp;
         |              ^~~~~~
   tests/symtab.c:33:14: warning: built-in function ‘strncmp’ declared as non-function [-Wbuiltin-declaration-mismatch]
      33 | extern void *strncmp;
         |              ^~~~~~~
   ```
   
   > I do not understand why we suppress debug option instead of fixing the declaration
   
   Here is the code generated by apps/tools/mksymtab.sh(same as nuttx/tools/mkallsyms.sh:
   ```
   #include <nuttx/compiler.h>
   #include <nuttx/symtab.h>
   
   extern void *__errno;
   extern void *__stack_chk_fail;
   extern void *exit;
   extern void *fflush;
   extern void *fopen;
   extern void *fprintf;
   extern void *fwrite;
   extern void *getpid;
   extern void *kill;
   extern void *memset;
   extern void *nxsched_get_streams;
   extern void *printf;
   extern void *pthread_attr_init;
   extern void *pthread_create;
   extern void *pthread_exit;
   extern void *pthread_join;
   extern void *pthread_mutex_init;
   extern void *pthread_mutex_lock;
   extern void *pthread_mutex_unlock;
   extern void *puts;
   extern void *sem_destroy;
   extern void *sem_init;
   extern void *sem_post;
   extern void *sem_wait;
   extern void *sigaction;
   extern void *sigemptyset;
   extern void *sigqueue;
   extern void *sleep;
   extern void *strcmp;
   extern void *strncmp;
   extern void *task_create;
   extern void *usleep;
   
   const struct symtab_s g_elf_exports[] = 
   {
     {"__errno", &__errno},
     {"__stack_chk_fail", &__stack_chk_fail},
     {"exit", &exit},
     {"fflush", &fflush},
     {"fopen", &fopen},
     {"fprintf", &fprintf},
     {"fwrite", &fwrite},
     {"getpid", &getpid},
     {"kill", &kill},
     {"memset", &memset},
     {"nxsched_get_streams", &nxsched_get_streams},
     {"printf", &printf},
     {"pthread_attr_init", &pthread_attr_init},
     {"pthread_create", &pthread_create},
     {"pthread_exit", &pthread_exit},
     {"pthread_join", &pthread_join},
     {"pthread_mutex_init", &pthread_mutex_init},
     {"pthread_mutex_lock", &pthread_mutex_lock},
     {"pthread_mutex_unlock", &pthread_mutex_unlock},
     {"puts", &puts},
     {"sem_destroy", &sem_destroy},
     {"sem_init", &sem_init},
     {"sem_post", &sem_post},
     {"sem_wait", &sem_wait},
     {"sigaction", &sigaction},
     {"sigemptyset", &sigemptyset},
     {"sigqueue", &sigqueue},
     {"sleep", &sleep},
     {"strcmp", &strcmp},
     {"strncmp", &strncmp},
     {"task_create", &task_create},
     {"usleep", &usleep},
   };
   
   const int g_elf_nexports = sizeof(g_elf_exports) / sizeof(struct symtab_s);
   ```
   
   You can see the code declare all function as void * because it's hard to create the right declaration in a general script.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org