public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65213] New: Extend -Wmissing-declarations to variables
@ 2015-02-25 20:10 eugene.zelenko at gmail dot com
  2020-06-07 23:39 ` [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations] egallager at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: eugene.zelenko at gmail dot com @ 2015-02-25 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65213
           Summary: Extend -Wmissing-declarations to variables
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eugene.zelenko at gmail dot com

Will be good idea to -Wmissing-declarations to variables. Global variable
should have extern declaration in header file, otherwise variable should be
static.

Clang detect such situations with -Wmissing-variable-declarations.

Same should be done for C++.


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

* [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations]
  2015-02-25 20:10 [Bug c/65213] New: Extend -Wmissing-declarations to variables eugene.zelenko at gmail dot com
@ 2020-06-07 23:39 ` egallager at gcc dot gnu.org
  2023-06-14  0:41 ` egallager at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-06-07 23:39 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

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

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
Now that -fno-common is the default, having this flag would make it easier to
catch mis-declared variables that will turn into link errors at link time by
catching them at compile time instead, so I'd think it's a bit more important
now.

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

* [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations]
  2015-02-25 20:10 [Bug c/65213] New: Extend -Wmissing-declarations to variables eugene.zelenko at gmail dot com
  2020-06-07 23:39 ` [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations] egallager at gcc dot gnu.org
@ 2023-06-14  0:41 ` egallager at gcc dot gnu.org
  2023-07-31 19:04 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-06-14  0:41 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-June/62
                   |                            |1564.html

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
A patch has been posted to the gcc-patches mailing list:
https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621564.html

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

* [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations]
  2015-02-25 20:10 [Bug c/65213] New: Extend -Wmissing-declarations to variables eugene.zelenko at gmail dot com
  2020-06-07 23:39 ` [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations] egallager at gcc dot gnu.org
  2023-06-14  0:41 ` egallager at gcc dot gnu.org
@ 2023-07-31 19:04 ` cvs-commit at gcc dot gnu.org
  2023-07-31 19:06 ` jsm28 at gcc dot gnu.org
  2023-08-08 15:42 ` ndesaulniers at google dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-31 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <jsm28@gcc.gnu.org>:

https://gcc.gnu.org/g:ffc74822468a39324722eef4c4412ea3224ca976

commit r14-2888-gffc74822468a39324722eef4c4412ea3224ca976
Author: Hamza Mahfooz <someguy@effective-light.com>
Date:   Mon Jul 31 19:03:47 2023 +0000

    c: add -Wmissing-variable-declarations [PR65213]

    Resolves:
    PR c/65213 - Extend -Wmissing-declarations to variables [i.e. add
    -Wmissing-variable-declarations]

    gcc/c-family/ChangeLog:

            PR c/65213
            * c.opt (-Wmissing-variable-declarations): New option.

    gcc/c/ChangeLog:

            PR c/65213
            * c-decl.cc (start_decl): Handle
            -Wmissing-variable-declarations.

    gcc/ChangeLog:

            PR c/65213
            * doc/invoke.texi (-Wmissing-variable-declarations): Document
            new option.

    gcc/testsuite/ChangeLog:

            PR c/65213
            * gcc.dg/Wmissing-variable-declarations.c: New test.

    Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>

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

* [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations]
  2015-02-25 20:10 [Bug c/65213] New: Extend -Wmissing-declarations to variables eugene.zelenko at gmail dot com
                   ` (2 preceding siblings ...)
  2023-07-31 19:04 ` cvs-commit at gcc dot gnu.org
@ 2023-07-31 19:06 ` jsm28 at gcc dot gnu.org
  2023-08-08 15:42 ` ndesaulniers at google dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2023-07-31 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |14.0

--- Comment #5 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Implemented for GCC 14.

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

* [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations]
  2015-02-25 20:10 [Bug c/65213] New: Extend -Wmissing-declarations to variables eugene.zelenko at gmail dot com
                   ` (3 preceding siblings ...)
  2023-07-31 19:06 ` jsm28 at gcc dot gnu.org
@ 2023-08-08 15:42 ` ndesaulniers at google dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ndesaulniers at google dot com @ 2023-08-08 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

Nick Desaulniers <ndesaulniers at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ndesaulniers at google dot com

--- Comment #6 from Nick Desaulniers <ndesaulniers at google dot com> ---
Thanks for implementing this!

I filed a follow up wrt to how this diagnostic interacts with `register`
storage variables.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110947 PTAL

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

end of thread, other threads:[~2023-08-08 15:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 20:10 [Bug c/65213] New: Extend -Wmissing-declarations to variables eugene.zelenko at gmail dot com
2020-06-07 23:39 ` [Bug c/65213] Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations] egallager at gcc dot gnu.org
2023-06-14  0:41 ` egallager at gcc dot gnu.org
2023-07-31 19:04 ` cvs-commit at gcc dot gnu.org
2023-07-31 19:06 ` jsm28 at gcc dot gnu.org
2023-08-08 15:42 ` ndesaulniers at google dot com

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