[cfe-dev] warning if method availability is newer than minimum deployment target

Ted Kremenek kremenek at apple.com
Sat Oct 27 22:00:01 PDT 2012


On Oct 27, 2012, at 6:09 AM, Richard <tarka.t.otter at googlemail.com> wrote:

> hey ted, john
> 
> i understand the concept of weak linking to apis newer than the deployment target, but it is very easy to accidentally include api calls and receive no warning about this until the app crashes at runtime, and it is not really feasible to test an entire app flow on all possible ios versions when updating older projects. i have recently had to fix a couple of bugs for this exact reason.
> 
> perhaps it would be nice just to have an optional analysis step that would always output a warning to highlight api calls that are newer than the minimum deployment target, that could be ignored by the developer if an optional code path has been used? i feel that accidentally including newer apis is probably the more common case than the developer correctly handling this situation (well it is where i work anyway :). i agree that doing this right is a lot more work, and unless a standard convention is used it is going to be almost impossible to do well.
> 
> thoughts?

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121027/f886a9c3/attachment.html>


More information about the cfe-dev mailing list