Violet Giraffe
Violet Giraffe

Reputation: 33579

Impossible to suppress a specific clang warning on Mac OS X

I have set -Wno-unused-parameter (and some others) compiler flag, and it is indeed passed to the compiler, but I'm still getting this warning:

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 )
                                                                   ^

Is it because -Wall is also specified? Shouldn't -Wno-... take precedence? How to tell clang to display all warnings except for some?

Upvotes: 9

Views: 6272

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409146

The warning arguments acts like toggles. When you do e.g. -Wno-unused-parameter you turn off that warning, however later on the command line you do -Wall which turns it back on again. The order of the arguments matter.

So to solve it, place the off-argument after it's turned on.

Upvotes: 12

Related Questions