From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 20CE0388E831; Tue, 5 May 2020 13:24:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20CE0388E831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588685067; bh=hTEOzzS8Th8QVEoWQE9UhROgpcjT9jFjAZ65uHTP+ls=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iO+D3oF3ffEJ7nie1vqg2pNEeCcZ72dweMFv2G+UJPNnWBzI0DWmVFJ9daDzNy5Um EnB8IaXBqaf+8dHYi06Lz/kW91JmM0DzI8VRYErvdPl2npEB1lCbV93jBTf76Jccgi wb4gjEiV6iyqTMHwKRHBWAiw/z81/Eq/eiLBOol8= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/91972] Bootstrap should use -Wmissing-declarations Date: Tue, 05 May 2020 13:24:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2020 13:24:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D91972 --- Comment #2 from Jonathan Wakely --- (In reply to Alexander Monakov from comment #0) > Transition to C++ did not change -Wmissing-prototypes to > -Wmissing-declarations, so over time several violations crept in. In > particular this penalizes optimization during non-LTO bootstrap (the > compiler has to assume the function might be used in another TU, even tho= ugh > in reality all uses are in current file and it simply misses the 'static' > keyword). Why is it missing the static keyword then? (Or alternatively, why isn't it = in an anonymous namespace?) (In reply to Alexander Monakov from comment #1) > Another reason to have -Wmissing-declarations is that otherwise mismatches > of unused functions are not caught until it's too late (mismatching > definition is assumed to be an overload of the function declared in the > header file). A more robust way to avoid that problem is to declare the function in a namespace, and define it using a qualified name: // declaration namespace targ { void foo(void*); } // definition void targ::foo(class vec_info*); // ERROR Because no foo with that signature was declared in namespace targ it's an error, not just a warning. Should the coding convention be adjusted to avoid this problem?=