[cfe-dev] magic __has_feature macro
clattner at apple.com
Fri Jun 12 22:44:18 PDT 2009
On Jun 12, 2009, at 6:18 PM, Eli Friedman wrote:
> On Fri, Jun 12, 2009 at 6:03 PM, Chris Lattner<clattner at apple.com>
>> Hi All,
>> As Clang "grows up", it will continue to get more features. I'd like
>> to add new "__has_feature" builtin function-like macro that evaluates
>> to 0 or 1 if clang has a specified feature.
> What does it evaluate to if clang doesn't have the specified
> feature? :)
> Sounds like a good idea.
Ok, my proposed use of if defined won't work because of the parsing
structure of pp conditionals. However, something like this will work:
#define __has_feature(x) 0
... whatever ...
I also plan to add a __has_builtin(x) as well, so that we can write
Look, no autoconf, and no fragile compiler version checks! :)
I'll start working on this.
More information about the cfe-dev