Xcode 3.2: Build & Analyze never detects any problems

I've used the Clang static analyzer from the command line before. I wanted to try the built-in version of Xcode via Build and Analyze. I never get any negative results, although I specially prepared my code with very obvious problems that Klang could always point out:

    // over-releasing an object:
    [label release];
    [label release];

    // uninitialized vars, allocating but not freeing an object
    NSString* str;
    int number;
    CCLabel* newLabel = [[CCLabel alloc] initWithString:str fontName:str fontSize:number];
    [newLabel setPosition:CGPointZero];

      

The result is always the same: green flag, no problem. I read that C ++ code can cause problems. I am running this with cocos2d which includes box2d. Could this be the reason? Has anyone gotten results from build and analysis with cocos2d engine? What else could it be?

I also tried to enable static analyzer build settings and then build, but the result was the same. I restarted Xcode, cleared all targets, and freed Xcode caches to no avail.


UPDATE: my problem could be caused by adding cocos2d as a cross-project reference to my project. The analysis of the cocos2d project itself shows some of the analyzer results.

Also, I found out that I am getting parser results from my RELEASE build configurations, but not from the DEBUG compilations.

+2


a source to share


3 answers


I am using Cocos2d and Box2d and I am getting a lot of build and analysis warnings. Make sure your project compiler is set to GCC 4.2 under Compiler Version in build settings.



+1


a source


For those who may run into this thread (and for the OP in case the issue persists):

I had this problem while building for the Simulator. However, the move to device assembly made Analyzer work.



This site may shed some light on the problem: http://useyourloaf.com/blog/2010/10/5/xcode-build-and-analyze-broken-for-simulator.html

+1


a source


I also get a lot of analytic warnings with my Cocos2d game. I've cleaned up most of them, but cocos2d 0.99.1 has 3 built in! (Which should be easy to fix.)

I noticed that sometimes the parser doesn't find things, unless I open that file when I run it ... go figure.

0


a source







All Articles