Friday, May 8, 2015 [Tweets]

Clang’s New -Wpartial-availability

Clang (via Matt Stevens):

This warns when using decls that are not available on all deployment targets. For example, a call to

- (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8)));

will warn if -mmacosx-version-min is set to less than 10.8.

To silence the warning, one has to explicitly redeclare the method like so:

@interface Whatever(MountainLionAPI)
- (void)ppartialMethod;
@end

This way, one cannot accidentally call a function that isn't available everywhere. Having to add the redeclaration will hopefully remind the user to add an explicit respondsToSelector: call as well.

I’m not sure why this wasn’t added years ago, when Apple stopped supporting older SDKs, but it’s good to finally have it.

Previously: Deploymate 1.0.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment