[clang] [C] Diagnose use of C++ keywords in C (PR #137234)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 30 05:39:14 PDT 2025
AaronBallman wrote:
> The ObjC `@` is essentially an escape into a completely different grammar, and it doesn't matter whether the following identifier is a keyword or not in the base language. This warning should never kick in on that identifier.
Okay, I've done that.
> Similarly, ObjC selector components exist outside of the normal keyword rules, and the warning should never kick in on them.
I don't know about selectors all that much; can you give me a test case that you think I should handle?
> Otherwise, this warning would be very useful in baseline Objective-C as a way of discovering names that would be keywords in Objective-C++, mostly in the incorporated C subset but also for ObjC features that ultimately end up in the C namespace and therefore are subject to the normal keyword rules, like method parameters and class names.
Okay, it remains enabled in Objective-C, just silenced if the preceding token is `@`.
https://github.com/llvm/llvm-project/pull/137234
More information about the cfe-commits
mailing list