Passing -fno-diagnostics-show-option will prevent Clang from printing the [-Wextra-tokens] information in the diagnostic. This information tells you the flag needed to enable or disable the diagnostic, either from the command line or through #pragma GCC diagnostic.
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.
clang::Diagnostic Class Reference. A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) that allows clients to enquire about the currently in-flight diagnostic.
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).
You can disable individual warnings using -Wno-XYZ
, XYZ being the name of the warning feature to be disabled.
In XCode 5 I had to build, then right click on an issue and select "Reveal in Log" then set the Middle Pane tab to "All" too get the issues displayed in the log.
Then clicking on the "Hamburger" Icon to the right and scrolling down I finally got an exact description of the Warning.
/.../SettingsViewController.m:91:58: warning: creating selector for nonexistent method 'setSegueIdentifier:' [-Wselector]
[segue.destinationViewController performSelector:@selector(setSegueIdentifier:)
So in my case the following does the job.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wselector"
...
#pragma clang diagnostic pop
I just bumped into a site that lists all Clang warnings and the flags that disable them (using #pragma clang diagnostic ignored "-Wxyz"
):
http://goo.gl/hwwIUa (when you visit it you'll understand why I've shortened the URL).
I'm guessing you know how to update the build settings to enable/disable individual warnings and want to disable the warning in your code. Here is an example:
#ifdef TESTFLIGHT_USERTRACKING
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
[TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];
#pragma clang diagnostic pop
#endif
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