Similar to -Wsuggest-final it would be nice to have a warning that identifies functions that could be marked static (resp. anonymous namespaces for classes in C++).
Do you have an example? I suspects this is more for a warning to add to analyzer patches than GCC itself. Also this requires the whole program to find out.
Yeah it's in the same vein as the other -Wsuggest warnings which run during lto. Like a.c void f() {} // can be made static void g() { f(); } b.c void g(); int main() { g(); }
Confirmed.