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

Ted Kremenek kremenek at apple.com
Fri Oct 26 12:49:25 PDT 2012


On Oct 26, 2012, at 11:46 AM, John McCall <rjmccall at apple.com> wrote:

> On Oct 26, 2012, at 7:39 AM, Richard wrote:
>> i am trying to generate warnings building an xcode project when calling a method that is available later than the current minimum deployment target. is this a job for a clang analyzer plugin, or is there some easier way to achieve this that i am not aware of?
> 
> In theory it's really straightforward to do;  there's an availability attribute which should give us this information.  In practice it's quite a bit harder because real code often intentionally uses APIs that aren't available on the minimum deployment target, and that's totally fine *if that code just doesn't run on such targets*.  Detecting that latter condition and suppressing the warning there is quite a bit harder.


Hi Richard,

John is absolutely right.  There are well-known idioms, such as those published in Apple's SDK Compatibility Guide, which allow to use APIs newer than your minimum deployment target but then gracefully degrade when not running on a newer OS.  Doing this well regards doing dataflow and control-flow analysis.  It's something I have been thinking about recently, and if you have specific concerns or requests about such a warning I would love to hear them.

Cheers,
Ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121026/2c99c882/attachment.html>


More information about the cfe-dev mailing list