[cfe-dev] warning if method availability is newer than minimum deployment target
Richard
tarka.t.otter at googlemail.com
Sun Oct 28 04:41:50 PDT 2012
On 28 Oct 2012, at 06:00, Ted Kremenek <kremenek at apple.com> wrote:
>
> Hi Richard,
>
> I think it would be easy to add a warning that checks if a use API is newer than the minimum deployment target, but I would not want that warning to go into mainline Clang because (1) most developers would hate the warning as it would produce too many false positives and (2) I believe we can do much better than that. While it might be "hard" to get it right, I think it is quite doable.
>
> I'm curious about your last comment, that "unless a standard convention is used it is going to be almost impossible to do well." Can you elaborate? I thought there were standard conventions for checking for weak linked APIs, etc?
>
> Cheers,
> Ted
hey ted,
perhaps you are right, maybe i was just being too lazy. the current documentation on using weakly linked apis is here:
https://developer.apple.com/library/mac/#documentation/developertools/conceptual/cross_development/Using/using.html#//apple_ref/doc/uid/20002000-SW6
so maybe it is as simple as checking that every call to an api newer than the minimum deployment target is contained in a block like this example:
if ([UIImagePickerController instancesRespondToSelector:@selector (availableCaptureModesForCameraDevice:)]) {
// Method is available for use.
} else {
// Method is not available.
}
but i have the feeling there are some edge cases to take care of here, as well as handling C apis.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121028/e7781dbb/attachment.html>
More information about the cfe-dev
mailing list