Bug 93252 - Warning for symbols that could be internalized
Summary: Warning for symbols that could be internalized
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 10.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, lto
Depends on:
Blocks: new-warning, new_warning
  Show dependency treegraph
 
Reported: 2020-01-13 15:43 UTC by Trass3r
Modified: 2020-01-23 01:17 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-01-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trass3r 2020-01-13 15:43:27 UTC
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++).
Comment 1 Andrew Pinski 2020-01-14 00:10:30 UTC
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.
Comment 2 Trass3r 2020-01-14 01:52:49 UTC
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(); }
Comment 3 Richard Biener 2020-01-14 08:13:46 UTC
Confirmed.