__has_attribute in system headers

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)
                             ^

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.

Hello,

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.

GCC's attributes have an '__attribute__' form to avoid this case (as identifiers beginning with '__' are reserved for the
system and the compiler). Maybe clang should follow this example.

Jonathan

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.

GCC's attributes have an '__attribute__' form to avoid this case (as identifiers beginning with '__' are reserved for the
system and the compiler). Maybe clang should follow this example.

For those not reading cfe-commits: It now (r151445) does (cf. clang's language extension manual at
<http://clang.llvm.org/docs/LanguageExtensions.html#feature_check>).

Jonathan