[cfe-dev] __has_attribute in system headers

Jean-Daniel Dupas devlists at shadowlab.org
Thu Feb 23 03:20:36 PST 2012


I got hit by this issue too. 

I tried to declare a cxx_noreturn macros (which is perfectly legal AFAIK), but it conflicted with clang  __has_feature() .

Having an alternate syntax for __has_xxx() special functions, or disabling macro evaluation in such context, would be really useful.


Le 22 févr. 2012 à 11:49, Tijl Coosemans a écrit :

> Hi,
> 
> Currently only __has_attribute(attr) seems to work but not
> __has_attribute(__attr__), which means it cannot safely be used in
> system headers because applications may define attr. The same goes for
> things like __has_extension(attribute_deprecated_with_message).
> 
> Should support for these alternative spellings be added?
> 
> PS: I also noticed __has_attribute(const) produces an error:
> 
> test.c:3:5: error: builtin feature check macro requires a parenthesized identifier
> #if     __has_attribute(const)
>        ^
> test.c:3:26: error: expected end of line in preprocessor expression                                 
> #if     __has_attribute(const)
>                             ^
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- Jean-Daniel








More information about the cfe-dev mailing list