From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20126 invoked by alias); 15 May 2012 12:24:22 -0000 Received: (qmail 20115 invoked by uid 22791); 15 May 2012 12:24:21 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 May 2012 12:24:08 +0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/50134] -Wmissing-prototypes doesn't work for C++ Date: Tue, 15 May 2012 12:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg01530.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D50134 --- Comment #10 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 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=20 -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.