[clang] [Clang] restrict use of attribute names reserved by the C++ standard (PR #106036)

Jonathan Wakely via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 16:31:17 PDT 2024


================
@@ -177,6 +177,26 @@ static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr,
   return false;
 }
 
+static bool isReservedAttrName(Preprocessor &PP, IdentifierInfo *II) {
----------------
jwakely wrote:

> I think they absolutely should, but those names are not portable to other compilers.

They _should_ be. GCC has always accepted `__attribute__((__foo__))` as well as the `foo` spelling, and uses the same rule for `[[...]]` attributes. I assume Intel compilers do the same for compatibility.

Maybe MSVC doesn't? Seems like something they might support if asked to though.

https://github.com/llvm/llvm-project/pull/106036


More information about the cfe-commits mailing list