【问题标题】:Can I safely ignore these pthread warnings via glibc?我可以通过 glibc 安全地忽略这些 pthread 警告吗?
【发布时间】:2017-04-14 02:52:12
【问题描述】:

我在 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>
   ^

我在这个版本的 glibc 中使用 GCC 5.3.0。

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

我担心这些警告(尤其是与pthread 相关的警告)可能表明引入了一些我没有测试要捕获的细微错误。

【问题讨论】:

    标签: gcc pthreads compiler-warnings glibc


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-24
      • 2011-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-23
      相关资源
      最近更新 更多