https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64955
Bug ID: 64955 Summary: RFE: have -Wformat suggest the correct format string to use Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Currently, -Wformat tells me that I got something wrong but doesn't tell we what the correct format string is: $ ./xgcc --version xgcc (GCC) 5.0.0 20150204 (experimental) (etc) $ cat test.c #include <stdio.h> void test (long long ll) { printf ("%i\n", ll); } $ ./xgcc -c -B. test.c -Wformat test.c: In function ‘test’: test.c:5:11: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=] printf ("%i\n", ll); ^ It would be helpful if gcc could emit something like: test.c:5:11: note: ‘printf‘ expects format string ‘%lli’ for type ‘long long int’. and maybe, if it can't be handled: test.c:5:11: note: ‘printf‘ does not have a format string for handling type ‘struct foo’. as an additional clarifying note after the warning/error (Bonus points: have GCC generate a patch to fix it ;) )