1
votes

I'm trying to enable code blocks in our iphone application so that i can run the static analyzer tool included with xcode. I get this warning (or error, depending on which compiler i use) when i run the build and analyze task:

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:252:72: error: blocks support disabled - compile with -fblocks or pick a deployment target that supports them

I've changed my deployment target to compiler default from iPhone OS 3.0, and i've changed the compiler from GCC 4.2 to LLVM 1.5 and LLVM GCC 4.2 with no luck. I'm not sure what else I have to change to make this work, or where i need to add the -fblocks argument. Does anyone know?

1
The Clang Static Analyzer should not need block support to run (we've been using it since 3.0, when blocks weren't in the iPhone OS). Have you cleaned your project before building and analyzing?Brad Larson
I have. The hiccup comes from when it analyzes the prefix header file which includes uikit and all it entails, and my guess is that by building this on ios 4.0 it can't recognize the new block syntax unless it is enabled somehow. If i compile against 3.2, i dont have this problem which is a workaround, but i'd like to do it against all targets if possible.Kevlar

1 Answers

2
votes

In SDK 4.0, if you use the new methods including blocks as arguments, then the static analyzer does not work. You must explicitly enable blocks as follows: in your project's settings, put -fblocks in the "Other C Flags" setting.