Xcode 3.2:构建 &分析永远不会发现任何问题 [英] Xcode 3.2: Build & Analyze never finds any issues

查看:17
本文介绍了Xcode 3.2:构建 &分析永远不会发现任何问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前在命令行中使用过 Clang 静态分析器.我想通过 Build & 尝试 Xcode 的内置版本分析.即使我专门为我的代码准备了 Clang 总是能够指出的非常明显的问题,我也从未得到任何负面结果:

I've used the Clang Static Analyzer from the command line before. I wanted to try Xcode's built-in version via Build & Analyze. I never get any negative results even though i specially prepared my code with very obvious issues Clang was always able to 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];

结果总是一样的:一个绿色的复选框,没有问题.我读到 C++ 代码可能会导致问题.我正在使用包含 box2d 的 cocos2d 运行它.这可能是一个原因吗?有没有人从 Build &用cocos2d引擎分析?还能是什么?

The result is always the same: a green checkbox, no issues. I read that C++ code can cause issues. I'm running this with cocos2d that includes box2d. Could this be a cause? Did anyone get results from Build & Analyze with the cocos2d engine? What else could it be?

我也尝试启用静态分析器构建设置,然后构建,但结果是一样的.我重新启动了 Xcode,清理了所有目标并清空了 Xcode 缓存,但无济于事.

I also tried enabling the Static Analyzer Build Settings and then Build but the result was the same. I have restarted Xcode, cleaned all targets and emptied Xcode caches to no avail.

更新:我的问题可能是由于将 cocos2d 添加为对我的项目的跨项目引用引起的.单独分析 cocos2d 项目本身会发现一些分析结果.

UPDATE: my issue could be caused by having added cocos2d as a cross-project reference to my project. Analyzing the cocos2d project itself seperately reveals some analyzer results.

此外,我发现我从我的 RELEASE 构建配置中获得了分析器结果,而不是从 DEBUG 构建中获得.

In addition i found out that i get Analyzer results from my RELEASE build configurations but not from DEBUG builds.

推荐答案

我正在使用 Cocos2d 和 Box2d,我从 Build and Analyze 收到大量警告.检查以确保您的项目的编译器在构建设置中的编译器版本"下设置为 GCC 4.2.

I'm using Cocos2d and Box2d, and I get plenty of warnings from Build and Analyze. Check to make sure your project's compiler is set to GCC 4.2 under "Compiler Version" in the Build Settings.

这篇关于Xcode 3.2:构建 &分析永远不会发现任何问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆