消除-Werror=unused-result警告
1、改代码
if (setegid(getgid()) == -1) {
perror("setegid");
exit(EXIT_FAILURE);
// or handle the error appropriately
}
2、局部忽略
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
setegid(getgid());
#pragma GCC diagnostic pop
3、整体忽略
#pragma GCC diagnostic ignored "-Wunused-result"
搜索更多相关主题的帖子:
编译 c语言 gcc