[cfe-dev] magic __has_feature macro

Chris Lattner clattner at apple.com
Fri Jun 12 18:03:07 PDT 2009


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.  This would allow us to  
have something like this:

#if defined(__has_feature) && __has_feature(whatever)
...
#endif

... where "whatever" is an identifier.  The list of accepted  
identifiers would be listed in the extensions manual.

I want to add this, because I really hate the proliferation of random  
predefines macros that the preprocessor ends up accreting.  Does  
anyone have any objection to this?

-Chris



More information about the cfe-dev mailing list