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?