[cfe-dev] [PATCH] New syntax and functionality for __has_attribute

Alp Toker alp at nuanti.com
Sun Jan 12 17:40:37 PST 2014


On 12/01/2014 23:57, Aaron Ballman wrote:
> Also, as I mentioned above, the same argument could be made for any of
> the feature test macros. Saying "but there's documentation" is not a
> compelling argument to me.

Hi David,

The point Aaron makes here is significant.

The reality goes even further: feature detection macros are little more 
than "fun" opportunistic features intended to save the hassle of a 
configure-time feature check. Many of your criticisms are valid and 
apply to other detection macros but that doesn't stop them being useful 
in a lot of trivial use cases.

Serious projects* with an expectation of full-featured portability and 
guarantees that a given language construct works as intended shouldn't 
be using these macros in the first place.

So I'd suggest getting the recommended usage documented as a resolution.

* LLVM's Compiler.h is an exception because it's biased and optimizes 
for bootstrap clang builds. Much of Compiler.h was simply disabled in 
non-clang builds until very recently without anyone noticing.

Alp.

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-dev mailing list