This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50134] -Wmissing-prototypes doesn't work for C++


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50134

--- Comment #10 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2012-05-15 12:23:50 UTC ---
Nonetheless, this is a patch that explains the current situation:

--- gcc/doc/invoke.texi (revision 187462)
+++ gcc/doc/invoke.texi (working copy)
@@ -4413,21 +4413,26 @@ This warning is also enabled by @option{
 @item -Wmissing-prototypes @r{(C and Objective-C only)}
 @opindex Wmissing-prototypes
 @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. The aim is to detect global functions that are
+not declared in header files, independently of whether the declaration
+is a prototype.  This option does not apply to C++ because there is no
+concept of prototype.  Use @option{-Wmissing-declarations} to detect
+missing declarations in C++.

 @item -Wmissing-declarations
 @opindex Wmissing-declarations
 @opindex Wno-missing-declarations
 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,
-or for inline functions, or for functions in anonymous namespaces.
+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, this option does not warn if there is a previous
+non-prototype declaration; use @option{-Wmissing-prototype} to detect
+those.  In C++, no warnings are issued for function templates, or for
+inline functions, or for functions in anonymous namespaces.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]