Khakionion
Khakionion

Reputation: 742

How do I disable Xcode static analysis (Clang) messages?

I'd like my Xcode project to go through a Build And Analyze step without generating any errors, warnings, or static analysis messages. A problem with this is that my project includes libraries that generate (possibly innocuous) warnings and static analysis messages.

I can't find a way to disable specific Clang warnings so that "my" code builds with zero issues. Is this possible?

Upvotes: 5

Views: 4402

Answers (2)

Khakionion
Khakionion

Reputation: 742

I wasn't able to find any way to do this, and filed a bug against Clang. The team seems to want to add this functionality, but it's not there yet.

The bug is: http://llvm.org/bugs/show_bug.cgi?id=7296

Also, one can use a __clang_analyzer__ macro to ifdef out any code that one doesn't want Clang to process.

Upvotes: 4

RyanR
RyanR

Reputation: 7758

The Build and Analyze step is clang - thats the "analyze" part. It wouldn't make sense to analyze your code and not have clang tell you about issues it find. That's like going to a car wash and telling them not to touch the car.

From talking to the guy that wrote clang at WWDC, it is extremely unlikely that anything it identifies as an issue is actually not. If you think you have some examples of code that works fine but clang complains, please file a bugreport with example code so Apple can fix that.

You can disable some compiler warnings through the use of flags, but not all of them are an option.

Upvotes: -1

Related Questions