我可以通过glibc安全地忽略这些pthread警告吗?

时间:2016-11-29 22:50:21

标签: gcc pthreads compiler-warnings glibc

我收到glibc版本2.22的一对警告:

In file included from /net/module/sw/glibc/2.22/include/pthread.h:23:0,
                 from foo.h:48,
                 from foo.c:23:
/net/module/sw/glibc/2.22/include/sched.h:74:57: warning: ‘struct timespec’ declared inside parameter list
 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
                                                         ^
/net/module/sw/glibc/2.22/include/sched.h:74:57: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from foo.h:48:0,
                 from foo.c:23:
/net/module/sw/glibc/2.22/include/pthread.h:1002:21: warning: ‘struct timespec’ declared inside parameter list
        const struct timespec *__restrict __abstime)
                     ^

In file included from /net/module/sw/glibc/2.22/include/sys/param.h:26:0,
                 from foo.h:51,
                 from foo.c:23:
/net/module/sw/glibc/2.22/include/limits.h:123:3: warning: #include_next is a GCC extension
 # include_next <limits.h>
   ^

我正在使用GCC 5.3.0版本的glibc。

由于这些警告引用了我无法控制的外部库,如果我的应用程序似乎通过测试,我可以安全地忽略这些警告吗?

我担心的是这些警告(特别是那些与pthread相关的警告)可能表明引入了一些我没有接受测试的细微错误。

1 个答案:

答案 0 :(得分:0)

是的,这些警告应该是无害的,但struct timespec警告肯定是奇怪的。通常,它们会被GCC对系统头的警告抑制所掩盖。