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:
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.