[Bug c/51437] GCC should warn on the use of reserved identifier/macro names

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 23 14:24:34 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51437

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redi at gcc dot gnu.org

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Josh Triplett from comment #5)
> I'd like to see this as well.  While issuing such a warning by default would
> cause numerous warnings with existing code, having it as an opt-in
> -Wreserved-identifiers would help greatly.

Clang does this now, with -Wreserved-identifier (N.B. singular, not
"identifiers")

> Also, the rules for C prohibit a leading underscore followed by a capital
> letter, or two adjacent underscores *anywhere* in the identifier.  So, for
> example, this__identifier, or_this_identifier__.

No, that's only in C++. C allows two adjacent underscores anywhere except the
start. C++ does not.


More information about the Gcc-bugs mailing list