public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113532] New: Warn about definition of macros that shadow keywords
@ 2024-01-21 22:19 redi at gcc dot gnu.org
  2024-01-21 22:22 ` [Bug c++/113532] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-21 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113532
           Summary: Warn about definition of macros that shadow keywords
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 87403
  Target Milestone: ---

[macro.names] says:

A translation unit shall not #define or #undef names lexically identical to
keywords, to the identifiers listed in Table 4, or to the attribute-tokens
described in 9.12, except that the names likely and unlikely may be defined as
function-like macros (15.6).

(Where Table 4 contains "final", "import", "module", and "override".)

We should warn when code does something silly like:

#define namespace _namespace


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/113532] Warn about definition of macros that shadow keywords
  2024-01-21 22:19 [Bug c++/113532] New: Warn about definition of macros that shadow keywords redi at gcc dot gnu.org
@ 2024-01-21 22:22 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-21 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh this is a dup of my own PR.

*** This bug has been marked as a duplicate of bug 109994 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-21 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-21 22:19 [Bug c++/113532] New: Warn about definition of macros that shadow keywords redi at gcc dot gnu.org
2024-01-21 22:22 ` [Bug c++/113532] " redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).