public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] PR 50134: improve docs for -Wmissing-prototypes and -Wmissing-declarations
@ 2012-06-01  0:38 Jonathan Wakely
       [not found] ` <CAAiZkiC66tQUfqiAxxx2030W6epsHveb7ayNHDASdtFE8fOoCg@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2012-06-01  0:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Manuel López-Ibáñez, Joseph S. Myers

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

2012-06-01  Manuel López-Ibáñez  <manu@gcc.gnu.org>
            Jonathan Wakely  <jwakely.gcc@gmail.com>

        PR c++/50134
        * doc/invoke.texi (Warning Options): Explain purpose and differences
        between -Wmissing-prototypes and -Wmissing-declarations.

This patch tries to improve the docs to clarify the intent of these options.

The new wording isn't strictly accurate when it says that in C++ "all
function declarations provide prototypes" because C++ doesn't use the
term "prototype" at all, but I think it's clear what it means.

OK for trunk?

[-- Attachment #2: 50134.txt --]
[-- Type: text/plain, Size: 1605 bytes --]

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 3ad07f3..eb582b3 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4416,8 +4416,12 @@ This warning is also enabled by @option{-Wextra}.
 @opindex Wno-missing-prototypes
 Warn if a global function is defined without a previous prototype
 declaration.  This warning is issued even if the definition itself
-provides a prototype.  The aim is to detect global functions that 
-are not declared in header files.
+provides a prototype.  Use this option to detect global functions
+that do not have a matching prototype declaration in a header file.
+This option is not valid for C++ because all function declarations
+provide prototypes and a non-matching declaration will declare an
+overload rather than conflict with an earlier declaration.
+Use @option{-Wmissing-declarations} to detect missing declarations in C++.
 
 @item -Wmissing-declarations
 @opindex Wmissing-declarations
@@ -4425,7 +4429,9 @@ are not declared in header files.
 Warn if a global function is defined without a previous declaration.
 Do so even if the definition itself provides a prototype.
 Use this option to detect global functions that are not declared in
-header files.  In C++, no warnings are issued for function templates,
+header files.  In C, no warnings are issued for functions with previous
+non-prototype declarations; use @option{-Wmissing-prototype} to detect
+missing prototypes.  In C++, no warnings are issued for function templates,
 or for inline functions, or for functions in anonymous namespaces.
 
 @item -Wmissing-field-initializers

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

* Re: [patch] PR 50134: improve docs for -Wmissing-prototypes and -Wmissing-declarations
       [not found] ` <CAAiZkiC66tQUfqiAxxx2030W6epsHveb7ayNHDASdtFE8fOoCg@mail.gmail.com>
@ 2012-06-01  9:36   ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2012-06-01  9:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: Joseph S. Myers, Manuel López-Ibáñez, gdr

For the record, Gaby approved this change (thanks, Gaby,) but his mail
didn't show up in the archives (gmail likes to send HTML mail, which
the GCC lists reject.)

On 1 June 2012 05:22, Gabriel Dos Reis wrote:
> Ok.

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

end of thread, other threads:[~2012-06-01  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-01  0:38 [patch] PR 50134: improve docs for -Wmissing-prototypes and -Wmissing-declarations Jonathan Wakely
     [not found] ` <CAAiZkiC66tQUfqiAxxx2030W6epsHveb7ayNHDASdtFE8fOoCg@mail.gmail.com>
2012-06-01  9:36   ` Jonathan Wakely

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