GCC编译指示错误以禁止警告

时间:2019-01-25 08:02:22

标签: c gcc gcc-warning

我已使用以下代码禁止显示警告:

从第25行开始

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#include <main.h>
#pragma GCC diagnostic pop

但是我收到以下警告:

main.c:25: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
main.c:26: warning: unknown option after ‘#pragma GCC diagnostic’ kind

在main.c:28包含的文件中:

main.h: In function ‘libstart’:
main.h:55: warning: assignment from incompatible pointer type
main.h:58: warning: assignment from incompatible pointer type
main.c: At top level:
main.c:28: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’

我的代码有问题吗?还有其他方法可以抑制来自特定文件的警告吗?

0 个答案:

没有答案