Search code examples
objective-cxcodecompiler-warningsunused-variables

Disable one unused variable warning


How can I disable one warning in one place only?

I have one variable which I temporarily don't use. Xcode shows me a warning about the "unused variable". I want to disable the warning, but for this variable only, not all warnings of this type.

Is it possible without setting/getting this variable's value?


Solution

  • From GCC / Specifying Attributes of Variables (understood by Clang as well):

    int x __attribute__ ((unused));
    

    or

    int y __attribute__((unused)) = initialValue ;