public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-91972-4-rOaZh6EWzK@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-91972-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91972 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (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 though > 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?
next prev parent reply other threads:[~2020-05-05 13:24 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-91972-4@http.gcc.gnu.org/bugzilla/> 2020-05-05 9:42 ` amonakov at gcc dot gnu.org 2020-05-05 13:24 ` redi at gcc dot gnu.org [this message] 2020-05-05 13:34 ` rguenth at gcc dot gnu.org 2020-05-05 14:01 ` amonakov at gcc dot gnu.org 2020-06-08 1:55 ` egallager at gcc dot gnu.org 2021-11-30 7:18 ` egallager at gcc dot gnu.org 2021-11-30 10:38 ` amonakov at gcc dot gnu.org 2021-11-30 11:48 ` egallager at gcc dot gnu.org 2023-09-10 15:34 ` egallager at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-91972-4-rOaZh6EWzK@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).