how to use #pragma clang diagnostics

Johnykutty picture Johnykutty · Nov 19, 2013 · Viewed 21.7k times · Source

I know that #pragma clang diagnostics can be used for ignoring some warnings generated by clang. But I don't know how to use this correctly.

For example, for an unused variable warning we can avoid warning by

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"

int number;

#pragma clang diagnostic pop

But I don't know how to get correct parameter for #pragma clang diagnostic ignored ("-Wunused-variable" here)

Is there any way to fing this kind of warning name for specific warnings with xcode?

Answer

iOS Gamer picture iOS Gamer · Jan 8, 2014

Right click on the issue in the issue navigator and select "Reveal in Log". The error message will specify the warning.