8

我已经设置了 -Wno-unused-parameter (和其他一些)编译器标志,它确实被传递给编译器,但我仍然收到这个警告:

clang++ -c -pipe -Wno-self-assign -Wno-unused-parameter -Wno-unused-variable -g -gdwarf-2 -arch x86_64 -fPIC -Wall -W F/Library/Frameworks -o ../build/cobject.o src/cobject.cpp                                                     ^
src/cobject.cpp:102:68: warning: unused parameter 'client' [-Wunused-parameter]
void cobject::processNetMsg( int type, CNetMsg& msg, CClient& client )
                                                                   ^

是因为-Wall也指定了吗?不-Wno-...应该优先吗?如何告诉 clang 显示除某些警告之外的所有警告?

4

1 回答 1

12

警告参数的作用类似于切换。例如,当您这样做时-Wno-unused-parameter,您会关闭该警告,但是稍后在命令行上您会-Wall再次将其重新打开。论点的顺序很重要。

因此,要解决它,请在打开参数放置参数。

于 2013-04-17T09:00:55.440 回答