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

Richard tarka.t.otter at googlemail.com
Wed Jan 23 12:35:33 PST 2013


Hey Hagi,

As for the analyzer side of things, I have a working checker written, I just need to clean it up and write some tests and then try and get it committed I guess. Send me a mail if you are interested in the details.

See you,
Richard

On 23 Jan 2013, at 20:23, cfe-dev-request at cs.uiuc.edu wrote:
> 
> Hi Sebastian,
> 
> Richard has been doing some great work to try and wire up the necessary infrastructure to implement some (or all) of this warning in the static analyzer.  My own goal is to try and make this a compiler warning at some point in addition to a static analyzer warning, since it will get the highest visibility among users.  It's much tricker to do as a compiler warning, given the performance requirements of the compiler and the tricks we will need to do to get the necessary accuracy which we get for free with the static analyzer.  It's a back burner project for me right now, but there is definitely interest in pushing this forward.
> 
> Ted
> 
> On Jan 23, 2013, at 10:58 AM, Sebastian Hagedorn <hagi.dd at web.de> wrote:
> 
>> Hi Richard, Hi Ted,
>> 
>> I just found this post in the archive and was wondering if this was still on your (or anyone else's) radar? I absolutely agree with Richard in that I find it pretty inconvenient to find new APIs in projects with an older deployment target. If you use the Android SDK & tools, Lint will give you warnings for any APIs that are newer than your deployment target (it's called minimum SDK there...). If you use them deliberately and only under certain conditions, you can add a @TargetAPI annotation to surpress the warning:
>> 
>> http://tools.android.com/recent/lintapicheck
>> 
>> A similar behaviour should be fairly easy to add to Clang and would make it heaps easier to implement/ensure backward compatibility of iOS/Mac apps. As a matter of fact, I've made the topic of backward compatibility the subject of my diploma thesis and started hacking on Clang a few days ago and already see these warnings popping up.
>> 
>> An initial (very informal) survey on this issue revealed that app developers would appreciate such a feature and they'd prefer having the compiler issue the warnings with every build (with a command line option to disable the feature) rather than running the analyzer separately. For my first hacks, I started checking the API version in the methods of "SemaExprObjC.cpp", although I can see that from a conceptial point of view, it's probably not the best place... 
>> 
>> I'm keen to hear your thoughts on that, and whether or not you are working on similar Clang features.
>> 
>> Cheers
>> Hagi




More information about the cfe-dev mailing list