From c3a43311c13fb31610cdc82f8600dd0c254169c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Fri, 1 Jun 2012 08:47:06 +0000 Subject: [PATCH] re PR c++/50134 (-Wmissing-prototypes doesn't work for C++) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2012-06-01 Manuel López-Ibáñez Jonathan Wakely PR c++/50134 * doc/invoke.texi (Warning Options): Explain purpose and differences between -Wmissing-prototypes and -Wmissing-declarations. Co-Authored-By: Jonathan Wakely From-SVN: r188103 --- gcc/ChangeLog | 7 +++++++ gcc/doc/invoke.texi | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25bf994c2c9..1b9b7a72a38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2012-06-01 Manuel López-Ibáñez + Jonathan Wakely + + PR c++/50134 + * doc/invoke.texi (Warning Options): Explain purpose and differences + between -Wmissing-prototypes and -Wmissing-declarations. + 2012-06-01 Christian Bruel * gcc.c (save_switch): Add user_p parameter. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3ad07f35eda..eb582b32e82 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 -- 2.30.2