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?
Using _Pragma to suppress the warning. Using #pragma to suppress the warning. Using command line options to suppress the warning.
If you want to disable all warnings, you can pass the -suppress-warnings flag (or turn on "Suppress Warnings" under "Swift Compiler - Warning Policies" in Xcode build settings).
To answer your question about disabling specific warnings in GCC, you can enable specific warnings in GCC with -Wxxxx and disable them with -Wno-xxxx. From the GCC Warning Options: You can request many specific warnings with options beginning -W , for example -Wimplicit to request warnings on implicit declarations.
From Xcode 4.2, Clang is the default compiler for Mac OS X.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With