【发布时间】:2019-02-25 06:12:10
【问题描述】:
我有一个使用 C 库的 cgo 应用程序。在构建过程中,编译器会显示一些警告:
In file included from ./libsolv-sys/src/qsort_r.c:40:0,
from ./libsolv-sys/src/util.c:181,
from ./libsolv.go:16:
/usr/include/sys/cdefs.h:1:2: warning: #warning usage of non-standard #include <sys/cdefs.h> is deprecated [-Wcpp]
#warning usage of non-standard #include <sys/cdefs.h> is deprecated
^~~~~~~
这个库不是我自己维护的,我不能直接修复这个警告。不过我已经厌倦了这个警告。
问题:如何在 CGO 中隐藏警告?
使用的 CGO 标志:
CFLAGS: -I./libsolv-sys/src -D LIBSOLV_INTERNAL
LDFLAGS: ${SRCDIR}/libsolv-sys.a
【问题讨论】: