5

When using Xcode analysis (product>analyze) is there a way of ignoring any errors in a given file?

Eg a pragma or something?

We just want to ignore any warnings on third party code, so that it's more obvious to us when there's a problem in our code.

Thanks

Chris
  • 39,719
  • 45
  • 189
  • 235
  • 1
    Great question. Though you'd have to modify the third party code, this answer seems to be what you want: http://stackoverflow.com/questions/5806101/is-it-possible-to-suppress-xcode-4-static-analyzer-warnings/5833430#5833430 (I haven't tried it myself, just did the research based on your question, but I plan to soon). – Matthew Frederick May 23 '11 at 00:32

2 Answers2

2

As suggested by matthew:

#ifndef __clang_analyzer__ 
...
#endif
Chris
  • 39,719
  • 45
  • 189
  • 235
1
#pragma clang diagnostic ignored "-Wall"

See the clang user's manual for other useful related #pragmas for clang.

This also works for GCC.

#pragma GCC diagnostic ignored "-Wall"
zpasternack
  • 17,838
  • 2
  • 63
  • 81
  • So will that only affect the single file that it is placed in? If so, good – Chris May 23 '11 at 01:34
  • Tested this, and it doesn't work. Possibly this disables compiler warnings? I'm after something to disable code analysis warnings – Chris May 23 '11 at 03:51
  • @Chris yes, this disables compiler warnings; sorry, that's what I thought you were asking. – zpasternack May 23 '11 at 16:05